# Venn diagram

A Venn diagram is a visual way of representing the mathematical relationship between sets.

## Two Set Example

The following diagram is a Venn diagram for sets $A$ and $B$: The red region contains all the elements that are in $A$ only. The blue region contains all the elements that are in $B$ only. The black region contains all the elements in both $A$ and $B$ which is called the intersection of $A$ and $B$, denoted $A\cap B$. The red, black, and blue regions together represent the elements that are in $A$, $B$, or both. This is called the union of $A$ and $B$, denoted $A\cup B$.

If we consider the region bounded by the rectangle to be the universal set, then the gray area is called the complement of $A\cup B$ -- that is, the things which are neither in $A$ nor in $B$.

All of this information can be summarized in the following table:

Region (by color) Description Notation
Red elements in $A$ only $A - (A\cap B)$
Blue elements in $B$ only $B - (A\cap B)$
Black elements in both $A$ and $B$ $(A\cap B)$
Gray elements in neither $A$ nor $B$ $(A\cup B)^C$
or $(A\cup B)'$
or $\overline{(A\cup B)}$
or $U - (A\cup B)$

## Three Set Example

The following diagram is a Venn diagram for the sets $A, B$ and $C$. The following table describes the various regions in the diagram:

Region (by color) Description Notation
Blue elements in $A$ only $A - (A\cap B)-(C\cap A) + (A\cap B\cap C)$
Yellow elements in $B$ only $B - (A\cap B) - (B\cap C) + (A\cap B\cap C)$
Red elements in $C$ only $C - (B\cap C)-(C\cap A) + (A\cap B\cap C)$
Green elements in both $A$ and $B$ but not $C$ $(A\cap B) - (A\cap B\cap C)$
Orange elements in both $B$ and $C$ but not $A$ $(B\cap C) - (A\cap B\cap C)$
Purple elements in $C$ and $A$ but not $B$ $(C\cap A) - (A\cap B\cap C)$
Black elements in $A,B$ and $C$ $(A\cap B\cap C)$
Gray elements in neither $A,B$ or $C$ $(A\cup B\cup C)^C$
or $(A\cup B\cup C)'$
or $\overline{(A\cup B\cup C)}$
or $U - (A\cup B\cup C)$

## Using Venn Diagrams

Venn diagrams are very useful for organizing data. In particular, the Principle of Inclusion-Exclusion can be explained for small cases nicely using them.