4 minutes read

When you work with abstract concepts, visualizing them can help a lot. In this topic, we'll present a well-known way to visualize sets.

Euler diagrams

To show relations between sets, one can use Euler diagrams (sometimes also called Euler-Venn diagrams). You can start drawing an Euler diagram by drawing a rectangle that represents the universal set UU, which contains all the objects under consideration. Note that the universal set, or universe, varies depending on which objects are of interest. Inside this rectangle, you can use circles (or, more rarely, other geometrical figures) to represent sets. You can also mark points on the diagram, representing the particular elements of the set.

For example, the universe UU may be the set of all integers or the set of all fruits and berries. Let's proceed with the second example. Suppose thatA={Lemon, Banana, Mango, Apple, Pineapple}A = \{\text{Lemon, Banana, Mango, Apple, Pineapple}\} and B={Cranberry, Gooseberry, Raspberry, Blueberry, Currant},B = \{\text{Cranberry, Gooseberry, Raspberry, Blueberry, Currant}\},To represent these sets graphically, you can use the following Euler diagram:

Set of fruits and set of berries

You can show more than two sets on an Euler diagram.

If your universe is the set of school subjects and the sets are P={History, English}P = \{\text{History, English}\}, Q={English, Russian}Q = \{\text{English, Russian}\}, R={Biology, English}R = \{\text{Biology, English}\}, you can draw them on a diagram:

Set intersection

Suppose you have two sets: A={1,2,3}A = \{1, 2, 3\} and B={2,3,5}B = \{2, 3, 5\}. You can denote the intersection operation by \cap. The set ABA \cap B, the intersection of AA and BB, is the set that contains all elements that belong to both AA and BB. Thus, you can write AB={2,3}A \cap B = \{2, 3\}. Again, you can use an Euler diagram to show this graphically:

Set intersection

These circles overlap. One circle would be the set AA, and the other circle would be the set BB.

Since the intersection is a set that contains only the elements that are in both sets, it is just the area where two circles overlap. It means that the set ABA \cap B is the overlapping area.

Thus, AB={x  xA and xB}A \cap B = \{x \ | \ x \in A \ \text{and} \ x \in B\}

If you have two circles that don't overlap at all, then their intersection is an empty set.

For example, if A={Python, C++}A = \{\text{Python, C++}\}, B={Scala, R}B = \{\text{Scala, R}\}, then AB=A \cap B = \emptyset. Again, let's look at it on an Euler diagram:

There is no overlap between the two sets

As you can see, there is no overlap between AA and BB.

Set union

Suppose you have a set A={0,1,2}A = \{0, 1, 2\} and a set B={1,2,3,1,2}B = \{-1, -2, -3, 1, 2\}. The symbol \cup denotes the union of two sets. The set ABA \cup B, the union of AA and BB, is the set that contains all elements belonging to either the set AA, or the set BB, or both. Thus, AB={0,1,2,1,2,3}A \cup B = \{ 0, 1, 2, -1, -2, -3\}. To imagine it visually, look at the Euler diagram:

Set union

Everything in the set AA, everything in the set BB, and the overlapping area belong to the set ABA \cup B.

Thus, AB={x  xA or xB}A \cup B = \{x \ | \ x \in A \ \text{or} \ x \in B\}

If two sets don't overlap, for instance, A={Sun, Moon}A = \{\text{Sun, Moon}\} and B={Earth, Mars}B = \{\text{Earth, Mars}\}, then AB={Sun, Moon, Earth, Mars}A \cup B = \{\text{Sun, Moon, Earth, Mars}\}. In this case, you would have the following Euler diagram:

Union two sets without overlap

Set complement

Suppose you have a universal set U={1,2,3,,10}U = \{1, 2, 3, \ldots, 10\} and a set A={1,3,5,7,9}A = \{1, 3, 5, 7, 9\}. The complement of AA (which is denoted by AA' or A\overline{A}) is a set of all elements in the UU that are not in AA. In your case, A={2,4,6,8,10}\overline{A} = \{2, 4, 6, 8, 10\}. The following Euler diagram shows this situation graphically:

Set complement


A\overline{A} is everything that is in the UU, but outside the circle.

Hence, A={x  xU and x∉A}\overline{A} = \{x \ | \ x \in U \ \text{and} \ x \not \in A\}

Sets difference, or relative complement

You have a set A={1,2,3,4,5}A = \{1, 2, 3, 4, 5\} and a set B={4,5,6,7}B = \{4, 5, 6, 7\}. If you choose all elements that are in the set AA but are not in the set BB, you will get a set A\B={1,2,3}A\backslash B = \{1, 2, 3\}: it is the difference, or the relative complements, of BB in AA. Look at the following Euler diagram that show it graphically:

Sets difference, or relative complement

Thus, A\B={x  xA and x∉B}A \backslash B = \{x \ | \ x \in A \ \text{and} \ x \not \in B\}

We can see that ABBAA \setminus B \neq B \setminus A.

Sets difference, or relative complement (2)

Symmetric difference

The symmetric difference of sets AA and BB is the set of all elements belonging to one and only one of these sets. For example, forA={1,2,3,4,5}A = \{1, 2, 3, 4, 5\} and B={4,5,6,7}B = \{4, 5, 6, 7\} the symmetric difference is

AB={1,2,3,6,7}A \triangle B = \{1, 2, 3, 6, 7\}The elements 1,2,31, 2, 3 belong only to AA and the elements 6,76, 7 only to BB. You can see that

AB=(AB)(BA)A \triangle B = (A \setminus B) \cup (B \setminus A)

Symmetric difference

Another equivalent formula for set difference is

AB=(AB)(AB)A \triangle B = (A \cup B) \setminus (A \cap B)showing that you can take the union of the sets and throw away the elements belonging to both sets (that is, the elements from their intersection).

Conclusion

Euler diagrams allow you to organize information visually, and with them, you can clearly see the relations between two (or more) sets of items. People use them across many other disciplines. In this topic, you have learned about operations with sets (intersection, union, set complement, and set difference) and looked at how Euler diagrams can represent them. The set theory underlies many concepts, such as logics, hence it's crucial to understand operations with sets and to be able to visualize them.

70 learners liked this piece of theory. 1 didn't like it. What about you?
Report a typo