Venn Diagrams and Sets

Understanding how to use Venn diagrams to represent the relationships between sets.

Giulio Laurenti, PhD
Geek Culture

--

Image by the author

In a previous post, we learned how to create and manipulate sets in Python.

Here we will learn to represent the relationships between sets using Venn diagrams.

Let’s assume that we are looking to buy a used car. We go to a dealership and find the following:

  • Total used cars: 34
  • Hatchback cars: 12
  • White cars: 8

Now let’s represent the data above using a Venn diagram.

First, we start by drawing a rectangle that represents the universal set (U): the set that contains all the elements of interest.

In our example, the universal set contains all the used cars in the dealership, independently of their body shape or color.

Inside the universal set, we draw circles (we can also use ovals or other shapes) that represent the other sets of interest. In our example, one circle for the hatchback cars (H) and one for the white cars (W).

Disjoint sets (Image by the author)

--

--

Giulio Laurenti, PhD
Geek Culture

A Molecular Biologist who enjoys writing about programming, science, and the wonderful world around us.