Set operations

Set operations are methods to combine or compare sets. Here we look at unions, intersections, disjoint sets, differences, complements, and how these can be visualized with Venn diagrams.

 

Union

The union of two sets \( \large A\) and \( \large B\) is the set of all elements that are in either \( \large A\) or \( \large B\) (or both). It is written as:

 

$$ \large A \cup B = \{x \mid x \in A \;\vee\; x \in B\} $$

 

Example: If \( \large A = \{1,2,3\}\) and \( \large B = \{3,4,5\}\), then \( \large A \cup B = \{1,2,3,4,5\}\).

 

 

Union

 

 

Intersection

The intersection of two sets is the elements they have in common. It is written as:

 

$$ \large A \cap B = \{x \mid x \in A \;\wedge\; x \in B\} $$

 

Example: If \( \large A = \{1,2,3\}\) and \( \large B = \{3,4,5\}\), then \( \large A \cap B = \{3\}\).

 

 

Intersection

 

 

Disjoint sets

Two sets are disjoint if they have no elements in common. That is, their intersection is empty:

 

$$ \large A \cap B = \emptyset $$

 

Example: \( \large A = \{1,2,3\}, B = \{4,5,6\}\).

 

 

Disjoint sets

 

 

Difference

The difference of two sets \( \large A\) and \( \large B\), written as \( \large A - B\) or \( \large A \setminus B\), is the elements that are in \( \large A\) but not in \( \large B\):

 

$$ \large A - B = \{x \mid x \in A \;\wedge\; x \notin B\} $$

 

Example: If \( \large A = \{1,2,3\}, B = \{3,4,5\}\), then \( \large A - B = \{1,2\}\).

 

 

Difference

 

 

Complement

If we have a universe \( \large U\) that contains all possible elements, we can define the complement of a set \( \large A\) as all the elements in \( \large U\) that are not in \( \large A\). It is written as:

 

$$ \large A^{c} = \{x \in U \mid x \notin A\} $$

 

Example: If \( \large U = \{1,2,3,4,5\}\) and \( \large A = \{1,2\}\), then \( \large A^{c} = \{3,4,5\}\).

 

 

Complement

 

 

Venn diagrams

Venn diagrams are often used to illustrate set operations graphically.

Circles represent sets, and overlapping areas show how union, intersection, difference, and complement work.

 

 

Venn diagrams

 

 

 

 

Formulas

Logical symbols

$$ \begin{array}{rl} \forall & = \; \text{for all} \\[12pt] \exists & = \; \text{there exists} \\[12pt] \wedge & = \; \text{and} \\[12pt] \vee & = \; \text{or} \\[12pt] \neg & = \; \text{not} \\[12pt] \Rightarrow & = \; \text{if ... then} \\[12pt] \Leftrightarrow & = \; \text{if and only if} \end{array} $$

Notation

$$ \begin{array}{rl} a \in A & = \; \text{element $a$ is in the set $A$} \\[12pt] a \notin A & = \; \text{element $a$ is not in the set $A$} \\[12pt] A = B & = \; \text{$A$ is equal to $B$} \\[12pt] A \subseteq B & = \; \text{$A$ is a subset of $B$} \\[12pt] A \subset B & = \; \text{$A$ is a proper subset of $B$} \\[12pt] A \supseteq B & = \; \text{$A$ is a superset of $B$} \\[12pt] A \supset B & = \; \text{$A$ is a proper superset of $B$} \\[12pt] A \cup B & = \; \text{union of $A$ and $B$} \\[12pt] A \cap B & = \; \text{intersection of $A$ and $B$} \\[12pt] A \setminus B & = \; \text{difference of $A$ and $B$} \\[12pt] A^c & = \; \text{complement of $A$} \\[12pt] |A| & = \; \text{cardinality of $A$} \\[12pt] \varnothing & = \; \text{empty set} \end{array} $$