Sets and Subsets
A set is an unordered collection of distinct objects, called its elements. A set A is a subset of a set B, written A ⊆ B, when every element of A is also an element of B. Sets are written in roster form or set-builder notation, and the empty set ∅ is a subset of every set.
Before this lesson: Predicates and Quantifiers and Direct Proof
What is a set?
A set is defined only by which objects belong to it. Write x ∈ A for “x is an element of A” and x ∉ A for “x is not an element of A.” Order and repeats don’t matter, so {1, 2, 3}, {3, 1, 2} and {1, 1, 2, 3} are all the same set.
The number of elements in a finite set A is its cardinality, written |A|. The empty set ∅ = { } has no elements, so |∅| = 0. Sets can also contain other sets: {∅} is a set with one element, the empty set, so |{∅}| = 1.
Some sets of numbers have standard names. ℕ = {0, 1, 2, 3, …} is the natural numbers (some books start at 1), ℤ is the integers, ℚ is the rational numbers and ℝ is the real numbers, as in rational and irrational numbers.
Roster form and set-builder notation
Roster form lists the elements between braces, such as {2, 4, 6, 8}. Set-builder notation describes the elements with a rule. It reads “the set of all x in a domain such that P(x) is true,” where P(x) is a predicate.
\{x \in D : P(x)\}For example, {x ∈ ℤ : 0 < x ≤ 4} = {1, 2, 3, 4}. Some books write a vertical bar instead of a colon: {x ∈ ℤ | 0 < x ≤ 4}.
| Symbol | Meaning | Example |
|---|---|---|
| x \in A | x is an element of A | 3 \in \{1, 2, 3\} |
| x \notin A | x is not an element of A | 5 \notin \{1, 2, 3\} |
| A \subseteq B | every element of A is in B | \{1, 2\} \subseteq \{1, 2, 3\} |
| A \subset B | A ⊆ B and A ≠ B (proper subset) | \{1, 2\} \subset \{1, 2, 3\} |
| \varnothing | the empty set | \vert\varnothing\vert = 0 |
| \vert A\vert | the number of elements of A | \vert\{a, b, c\}\vert = 3 |
Subsets, proper subsets and equal sets
A ⊆ B means that every element of A is in B. In the language of quantifiers:
A \subseteq B \iff \forall x\,(x \in A \to x \in B)
A is a proper subset of B, written A ⊂ B, when A ⊆ B and B has at least one element that A doesn’t. Some books write A ⊊ B for a proper subset and use ⊂ to mean any subset, so check which convention your class uses. Two sets are equal when each is a subset of the other: A = B exactly when A ⊆ B and B ⊆ A.
Every set is a subset of itself, and ∅ ⊆ A for every set A. The statement “every element of ∅ is in A” is true because ∅ has no elements that could break it.
How to prove A ⊆ B or A = B
- To prove A ⊆ B, let x be an arbitrary element of A.
- Use the rule that defines A to say what x is like.
- Show that x satisfies the rule that defines B, so x ∈ B. This is a direct proof of “if x ∈ A, then x ∈ B.”
- To prove A ⊄ B, give one counterexample: an element of A that is not in B.
- To prove A = B, prove A ⊆ B and B ⊆ A.
Sets and subsets examples
Example 1: Roster form and set-builder notation
(a) Write A = {x ∈ ℤ : −2 ≤ x < 3} in roster form and find |A|. (b) Write B = {1, 4, 9, 16, 25} in set-builder notation.
-2 \le x \lt 3,\ x \in \mathbb{Z}(a) A contains the integers from −2 up to, but not including, 3.
A = \{-2, -1, 0, 1, 2\}List those integers: 3 is excluded because the inequality is strict.
\vert A\vert = 5
Count the elements.
1, 4, 9, 16, 25 = 1^2, 2^2, 3^2, 4^2, 5^2
(b) Each element is a perfect square.
B = \{n^2 : n \in \mathbb{Z},\ 1 \le n \le 5\}Describe the elements by the rule that makes them.
Answer: A = {−2, −1, 0, 1, 2} with |A| = 5, and B = {n2 : n ∈ ℤ, 1 ≤ n ≤ 5}. Other correct rules for B exist, such as {n2 : n ∈ ℕ, 1 ≤ n ≤ 5}.
Example 2: Element or subset?
Let S = {1, {1}, {2, 3}, ∅}. Decide whether each statement is true: 1 ∈ S, {1} ∈ S, {1} ⊆ S, 2 ∈ S, {2, 3} ⊆ S, ∅ ∈ S, ∅ ⊆ S. Then find |S|.
1 \in S
True: 1 is listed as an element.
\{1\} \in STrue: the set {1} is listed as an element.
\{1\} \subseteq STrue: the only element of {1} is 1, and 1 ∈ S.
2 \notin S
False that 2 ∈ S: 2 is inside the element {2, 3}, but 2 itself is not listed.
\{2, 3\} \not\subseteq SFalse that {2, 3} ⊆ S: 2 ∉ S. (But {2, 3} ∈ S is true.)
\varnothing \in S
True: ∅ is listed as an element.
\varnothing \subseteq S
True: ∅ is a subset of every set.
\vert S\vert = 4
S has four elements: 1, {1}, {2, 3} and ∅.
Answer: all the statements are true except 2 ∈ S and {2, 3} ⊆ S, and |S| = 4. The key question is always whether you are asking about one element (∈) or about every element of a set (⊆).
Example 3: Quiz results (word problem)
Five students passed Quiz 1: Q1 = {Ana, Ben, Cara, Dev, Eli}. Three passed Quiz 2: Q2 = {Ben, Dev, Eli}. Did everyone who passed Quiz 2 also pass Quiz 1? Is Q2 a proper subset of Q1?
\text{Ben} \in Q_1Check the first element of Q2.
\text{Dev} \in Q_1Check the second element.
\text{Eli} \in Q_1Check the third element.
Q_2 \subseteq Q_1
Every element of Q2 is in Q1.
\text{Ana} \in Q_1,\ \text{Ana} \notin Q_2Q1 has an element that Q2 lacks, so Q1 ≠ Q2.
Q_2 \subset Q_1
A subset that is not equal is a proper subset.
Answer: yes, everyone who passed Quiz 2 also passed Quiz 1, and Q2 ⊂ Q1 is a proper subset. Q1 ⊄ Q2, since Ana passed only Quiz 1.
Example 4: Proving one set is a subset of another
Let A = {x ∈ ℤ : x = 6k for some k ∈ ℤ} and B = {x ∈ ℤ : x = 2k for some k ∈ ℤ}. Prove that A ⊆ B, then show that A is a proper subset of B.
x \in A
Let x be an arbitrary element of A.
x = 6k
By the rule for A, x = 6k for some integer k.
x = 2(3k)
Factor out 2, since 6 = 2 · 3.
3k \in \mathbb{Z}3k is an integer, because k is.
x \in B
x is 2 times an integer, so x satisfies the rule for B.
2 = 2(1) \in B
For the proper subset part, pick an element of B: 2 = 2 · 1.
2 \notin A
2 = 6k would need k = 1/3, which is not an integer.
Answer: every multiple of 6 is even, so A ⊆ B, and 2 ∈ B but 2 ∉ A, so A ⊂ B. The proof used an arbitrary element x, not one example such as 12.
Example 5: A subset of real numbers
Let A = {x ∈ ℝ : |x − 1| < 2} and B = {x ∈ ℝ : x2 < 16}. Prove that A ⊆ B, and show that B ⊄ A.
x \in A
Let x be an arbitrary element of A.
\vert x - 1\vert \lt 2
By the rule for A.
-2 \lt x - 1 \lt 2
Rewrite the absolute value inequality as a compound inequality.
-1 \lt x \lt 3
Add 1 to all three parts.
\vert x\vert \lt 3
Every number between −1 and 3 is within 3 of 0.
x^2 \lt 9
Square: if |x| < 3, then x² = |x|² < 3² = 9.
x^2 \lt 16
9 is less than 16, so x ∈ B.
(-2)^2 = 4 \lt 16
For B ⊄ A, try x = −2: it is in B.
\vert -2 - 1\vert = 3 \not\lt 2
But x = −2 is not in A.
Answer: A ⊆ B, and x = −2 is a counterexample showing B ⊄ A. In interval notation, A = (−1, 3) and B = (−4, 4).
Common mistakes
| Mistake | Example of the error | Fix |
|---|---|---|
| Mixing up ∈ and ⊆ | Writing 1 ⊆ {1, 2} | 1 is an element, so write 1 ∈ {1, 2}, or use the set {1} ⊆ {1, 2}. |
| Treating ∅ and {∅} as the same | Saying |{∅}| = 0 | {∅} has one element, the empty set, so |{∅}| = 1. Only |∅| = 0. |
| Counting repeated elements | Saying |{1, 1, 2}| = 3 | Repeats don’t count: {1, 1, 2} = {1, 2}, so the cardinality is 2. |
| Thinking order matters | Saying {1, 2} ≠ {2, 1} | A set has no order, so {1, 2} = {2, 1}. Order matters only for ordered pairs like (1, 2). |
| Proving a subset with one example | “12 is in A and in B, so A ⊆ B” | Start with an arbitrary x ∈ A and show x ∈ B. One example can only disprove A ⊆ B. |
| Reading ⊂ the wrong way | Assuming A ⊂ B allows A = B | In this lesson ⊂ means a proper subset. Some books use ⊂ for any subset and ⊊ for proper, so check the convention. |
Related ideas
Set-builder notation turns any predicate from predicates and quantifiers into a set, and the definition of A ⊆ B is a “for all” statement. Intervals such as (−1, 3) from compound inequalities are sets of real numbers written in a shorthand. In probability, an event is a subset of the sample space, as in basic probability.
Practice problems
- Write {x ∈ ℤ : x2 ≤ 9} in roster form and find its cardinality.
- Write {3, 6, 9, 12, 15} in set-builder notation.
- Let T = {a, {b}, ∅}. Decide whether each is true: b ∈ T, {b} ∈ T, {a} ⊆ T, {b} ⊆ T, ∅ ⊆ T. Then find |T|.
- Find |{∅, {∅}}|. Is ∅ an element of this set, a subset of it, or both?
- Are {1, 2, 2, 3} and {3, 2, 1} equal? Explain.
- Prove that {x ∈ ℝ : x2 − 5x + 6 = 0} = {2, 3}.
- Prove that {x ∈ ℤ : 4 divides x} ⊆ {x ∈ ℤ : 2 divides x}, and that the subset is proper.
- Show that {x ∈ ℤ : x is odd} ⊄ {x ∈ ℤ : x is prime}.
- A pool lets in only members P = {Gia, Hal, Ike, Jo, Kai}. Today’s swimmers were S = {Hal, Jo, Lu}. Is S ⊆ P? What does the answer mean?
- Prove that {x ∈ ℝ : 0 < x < 1} = {x ∈ ℝ : x2 < x}.
Show answers
1.
x^2 \le 9 \iff -3 \le x \le 3
Take square roots: x² ≤ 9 exactly when |x| ≤ 3.
\{-3, -2, -1, 0, 1, 2, 3\}List the integers from −3 to 3.
Answer: {−3, −2, −1, 0, 1, 2, 3}, with cardinality 7
2.
3, 6, 9, 12, 15 = 3 \cdot 1, 3 \cdot 2, 3 \cdot 3, 3 \cdot 4, 3 \cdot 5
Each element is 3 times an integer from 1 to 5.
Answer: {3k : k ∈ ℤ, 1 ≤ k ≤ 5}
3.
b \notin T
False that b ∈ T: b appears only inside the element {b}.
\{b\} \in TTrue: {b} is listed.
\{a\} \subseteq TTrue: a ∈ T.
\{b\} \not\subseteq TFalse that {b} ⊆ T: b ∉ T.
\varnothing \subseteq T
True: ∅ is a subset of every set.
\vert T\vert = 3
The elements are a, {b} and ∅.
Answer: true: {b} ∈ T, {a} ⊆ T, ∅ ⊆ T; false: b ∈ T, {b} ⊆ T; |T| = 3
4.
\vert\{\varnothing, \{\varnothing\}\}\vert = 2The two elements are ∅ and {∅}.
\varnothing \in \{\varnothing, \{\varnothing\}\}∅ is listed as an element.
\varnothing \subseteq \{\varnothing, \{\varnothing\}\}∅ is a subset of every set.
Answer: the cardinality is 2, and ∅ is both an element and a subset
5.
\{1, 2, 2, 3\} = \{1, 2, 3\}Remove the repeated 2.
\{1, 2, 3\} = \{3, 2, 1\}Order doesn’t matter.
Answer: yes; both sets have exactly the elements 1, 2 and 3
6.
x^2 - 5x + 6 = 0
Let x be in the first set.
(x - 2)(x - 3) = 0
Factor the trinomial (see factoring trinomials).
x = 2 \text{ or } x = 3Zero product property; so the first set ⊆ {2, 3}.
2^2 - 5(2) + 6 = 4 - 10 + 6 = 0
Check 2 is in the first set.
3^2 - 5(3) + 6 = 9 - 15 + 6 = 0
Check 3 is in the first set; so {2, 3} ⊆ the first set.
Answer: each set is a subset of the other, so the sets are equal
7.
x = 4k
Let x be an integer divisible by 4, so x = 4k for some integer k.
x = 2(2k)
Factor out 2; 2k is an integer, so 2 divides x.
2 = 2(1),\ 4 \nmid 2
For proper: 2 is in the second set but is not divisible by 4.
Answer: every multiple of 4 is even, and 2 shows the subset is proper
8.
9 = 2(4) + 1
9 is odd, so it is in the first set.
9 = 3 \cdot 3
9 is not prime, so it is not in the second set.
Answer: 9 is an odd integer that is not prime, so the first set is not a subset of the second (1 also works)
9.
\text{Hal} \in P,\ \text{Jo} \in PCheck each swimmer against the member list.
\text{Lu} \notin PLu is not a member.
Answer: no, S ⊄ P; Lu swam without being a member, so the pool’s rule was broken
10.
0 \lt x \lt 1
(⊆) Let x be in the first set.
x \cdot x \lt 1 \cdot x
Multiply x < 1 by the positive number x (see solving inequalities); the sign stays.
x^2 \lt x
Simplify; so x is in the second set.
x^2 - x \lt 0
(⊇) Let x² < x and subtract x from both sides.
x(x - 1) \lt 0
Factor out x.
0 \lt x \lt 1
A product is negative only when its factors have opposite signs; x > 0 and x − 1 < 0 is the only possible case.
Answer: each set is a subset of the other, so they are equal; both are the interval (0, 1)
Sets and subsets FAQ
What is the difference between ∈ and ⊆?
The symbol ∈ compares one object with a set: 2 ∈ {1, 2, 3}. The symbol ⊆ compares two sets: {2} ⊆ {1, 2, 3} means every element of {2} is in {1, 2, 3}.
Is the empty set a subset of every set?
Yes. A ⊆ B fails only if A has an element missing from B, and ∅ has no elements, so ∅ ⊆ B is always true. The empty set is an element of B only if it is listed in B.
What is a proper subset?
A is a proper subset of B when A ⊆ B and A ≠ B, so B has at least one element that A doesn’t. For example, {1, 2} is a proper subset of {1, 2, 3}, but {1, 2, 3} is not a proper subset of itself.
What is set-builder notation?
Set-builder notation describes a set by a rule instead of a list. {x ∈ ℤ : x > 0} reads “the set of all integers x such that x is greater than 0.”
Summary
- A set is an unordered collection of distinct elements; x ∈ A means x is an element of A.
- Roster form lists the elements, and set-builder notation {x ∈ D : P(x)} describes them with a predicate.
- A ⊆ B means every element of A is in B; A ⊂ B adds that A ≠ B.
- ∅ is a subset of every set, and A = B exactly when A ⊆ B and B ⊆ A.
- Prove A ⊆ B with an arbitrary element, and disprove it with one counterexample.
Previous lesson: Strong Induction
Next lesson: Set Operations
Back to the Discrete Math Index