Introduction
Set operations allow us to combine, compare, and manipulate sets. These operations form the basis of logic, probability, and computer science.
Interactive: Visualize Set Operations
Click the operation buttons to see the corresponding Venn diagram region highlighted:
Union of Sets
Definition
The union of sets $A$ and $B$ is the set of elements that belong to $A$ OR $B$ (or both).
$$\boxed{A \cup B = \{x : x \in A \text{ or } x \in B\}}$$Venn Diagram
Shaded region: Everything inside A OR B (or both)
| Region | Included? |
|---|---|
| Only in A | Yes |
| Only in B | Yes |
| In both A and B | Yes |
| Outside both | No |
Example
If $A = \{1, 2, 3\}$ and $B = \{3, 4, 5\}$:
$$A \cup B = \{1, 2, 3, 4, 5\}$$(Note: 3 appears only once!)
Intersection of Sets
Definition
The intersection of sets $A$ and $B$ is the set of elements that belong to BOTH $A$ AND $B$.
$$\boxed{A \cap B = \{x : x \in A \text{ and } x \in B\}}$$Venn Diagram
Shaded region: Only the overlapping part (elements in BOTH A and B)
| Region | Included? |
|---|---|
| Only in A | No |
| Only in B | No |
| In both A and B | Yes |
| Outside both | No |
Example
If $A = \{1, 2, 3\}$ and $B = \{3, 4, 5\}$:
$$A \cap B = \{3\}$$Disjoint Sets
Sets $A$ and $B$ are disjoint if they have no common elements:
$$A \cap B = \emptyset$$Difference of Sets
Definition
The difference $A - B$ (or $A \setminus B$) is the set of elements in $A$ but not in $B$.
$$\boxed{A - B = \{x : x \in A \text{ and } x \notin B\}}$$Example
If $A = \{1, 2, 3, 4\}$ and $B = \{3, 4, 5\}$:
$$A - B = \{1, 2\}$$ $$B - A = \{5\}$$Complement of a Set
Definition
The complement of set $A$ (denoted $A'$ or $\bar{A}$ or $A^c$) with respect to universal set $U$ is:
$$\boxed{A' = \{x : x \in U \text{ and } x \notin A\} = U - A}$$Example
If $U = \{1, 2, 3, 4, 5\}$ and $A = \{1, 2\}$:
$$A' = \{3, 4, 5\}$$Properties of Complement
- $(A')' = A$ (double complement)
- $A \cup A' = U$ (exhaustive)
- $A \cap A' = \emptyset$ (mutually exclusive)
- $U' = \emptyset$
- $\emptyset' = U$
Symmetric Difference
The symmetric difference $A \triangle B$ contains elements in either $A$ or $B$ but not both:
$$A \triangle B = (A - B) \cup (B - A) = (A \cup B) - (A \cap B)$$Algebraic Properties
Commutative Laws
$$A \cup B = B \cup A$$ $$A \cap B = B \cap A$$Associative Laws
$$(A \cup B) \cup C = A \cup (B \cup C)$$ $$(A \cap B) \cap C = A \cap (B \cap C)$$Distributive Laws
$$A \cup (B \cap C) = (A \cup B) \cap (A \cup C)$$ $$A \cap (B \cup C) = (A \cap B) \cup (A \cap C)$$Identity Laws
$$A \cup \emptyset = A$$ $$A \cap U = A$$Domination Laws
$$A \cup U = U$$ $$A \cap \emptyset = \emptyset$$Idempotent Laws
$$A \cup A = A$$ $$A \cap A = A$$Absorption Laws
$$A \cup (A \cap B) = A$$ $$A \cap (A \cup B) = A$$De Morgan’s Laws
The Laws
$$\boxed{(A \cup B)' = A' \cap B'}$$ $$\boxed{(A \cap B)' = A' \cup B'}$$How to Remember
“Break the bracket, change the operation, complement each set”
| Original | Step 1: Complement | Step 2: Change Operation | Step 3: Complement Each |
|---|---|---|---|
| $A \cup B$ | $(A \cup B)'$ | $\cap$ | $A' \cap B'$ |
| $A \cap B$ | $(A \cap B)'$ | $\cup$ | $A' \cup B'$ |
Generalized De Morgan’s Laws
For any number of sets:
$$(A_1 \cup A_2 \cup ... \cup A_n)' = A_1' \cap A_2' \cap ... \cap A_n'$$ $$(A_1 \cap A_2 \cap ... \cap A_n)' = A_1' \cup A_2' \cup ... \cup A_n'$$Power Set
Definition
The power set of $A$, denoted $P(A)$ or $2^A$, is the set of ALL subsets of $A$.
$$P(A) = \{S : S \subseteq A\}$$Examples
If $A = \{1\}$:
$$P(A) = \{\emptyset, \{1\}\}$$If $A = \{1, 2\}$:
$$P(A) = \{\emptyset, \{1\}, \{2\}, \{1, 2\}\}$$If $A = \{1, 2, 3\}$:
$$P(A) = \{\emptyset, \{1\}, \{2\}, \{3\}, \{1,2\}, \{1,3\}, \{2,3\}, \{1,2,3\}\}$$
Cardinality of Power Set
$$\boxed{|P(A)| = 2^{|A|} = 2^n}$$where $n = |A|$ is the number of elements in $A$.
Why 2^n? Each element has 2 choices: be in the subset or not.
Power Set Properties
- $\emptyset \in P(A)$ for any set $A$
- $A \in P(A)$ for any set $A$
- If $A \subseteq B$, then $P(A) \subseteq P(B)$
Cardinality Formulas
Two Sets
$$|A \cup B| = |A| + |B| - |A \cap B|$$Three Sets
$$|A \cup B \cup C| = |A| + |B| + |C| - |A \cap B| - |B \cap C| - |A \cap C| + |A \cap B \cap C|$$General Inclusion-Exclusion Principle
For $n$ sets:
$$\left|\bigcup_{i=1}^{n} A_i\right| = \sum|A_i| - \sum|A_i \cap A_j| + \sum|A_i \cap A_j \cap A_k| - ... + (-1)^{n+1}|A_1 \cap ... \cap A_n|$$Calculations
Example 1: Using Inclusion-Exclusion
Problem: In a class of 60 students, 35 study Math, 40 study Physics, and 20 study both. How many study neither?
Solution:
$$|M \cup P| = |M| + |P| - |M \cap P| = 35 + 40 - 20 = 55$$Students studying neither = $60 - 55 = 5$
Example 2: Using De Morgan’s Law
Problem: If $n(U) = 50$, $n(A) = 30$, $n(B) = 25$, $n(A \cap B) = 15$, find $n(A' \cap B')$.
Solution:
$$A' \cap B' = (A \cup B)' \text{ (De Morgan)}$$ $$n(A \cup B) = 30 + 25 - 15 = 40$$ $$n(A' \cap B') = n(U) - n(A \cup B) = 50 - 40 = 10$$Practice Problems
If $A = \{1, 2, 3, 4\}$ and $B = \{2, 4, 6\}$, find $A \cup B$, $A \cap B$, $A - B$, $B - A$.
Verify De Morgan’s Laws for $A = \{1, 2\}$ and $B = \{2, 3\}$ with $U = \{1, 2, 3, 4\}$.
How many elements are in $P(P(\{a\}))$? (Power set of power set)