Sub topic 5
Writing Solution Sets in Set-Builder Notation
Prerequisites and Scope
This chapter assumes you can solve a linear inequality, plot a solution on a number line, and write it in interval notation. It covers one more way to state the answer: set-builder notation. You will read it, write it, and convert between it and interval notation. It also covers the usual errors.
What Set-Builder Notation Says
Set-builder notation describes a set by stating the rule its members must follow. It does not list the members. For a solution set of an inequality, the rule is the inequality itself.
{x | x < -2}Read this aloud as "the set of all x such that x is less than -2."
The pieces are:
- The braces
{ }mean "the set of." - The letter
xbefore the bar is the variable that stands for a typical member. - The vertical bar
|means "such that." Many books use a colon instead:{x : x < -2}. Both mean the same thing. - The condition after the bar is the rule a number must satisfy to belong to the set.
Naming the Number Set
By default, the variable ranges over the real numbers. You can state this explicitly with the symbol ∈, which means "is an element of," and the symbol ℝ, which means the set of all real numbers.
{x ∈ ℝ | x < -2}This reads "the set of all real numbers x such that x is less than -2." It is the same set as {x | x < -2} when the context is real numbers. The explicit form matters when the context could be different. For example, {x ∈ ℤ | x < -2} uses ℤ, the integers, and gives only -3, -4, -5, and so on. This set has no members between -3 and -2, so it is a different set from the real-number version.
| Notation | Meaning | Column |
|---|---|---|
| `{x ∈ ℝ \ | x < -2}` | All real numbers less than -2 |
| `{x ∈ ℤ \ | x < -2}` | Integers less than -2: -3, -4, -5, ... |
| `{x ∈ ℕ \ | x < 4}` | Natural numbers less than 4 (1, 2, 3 if ℕ starts at 1; 0, 1, 2, 3 if it starts at 0) |
Because the starting point of ℕ varies by textbook, state the set explicitly when it matters.
From a Solved Inequality to Set-Builder Notation
Solve the inequality first, then copy the final inequality into the condition. Here is an example from this tutorial.
-3x + 5 > 11
-3x > 6 (subtract 5 from both sides)
x < -2 (divide by -3 and reverse the inequality)
Interval notation: (-∞, -2)
Set-builder notation: {x | x < -2}The set-builder condition is the last line of the algebra. Keep the strict symbol < because the original inequality was strict, so -2 is not in the set.
Matching Symbols
The symbols carry over directly, which is one advantage of this notation over interval notation. You don't translate to brackets and parentheses. You keep the inequality as it is.
| Solved inequality | Interval notation | Set-builder notation | Column |
|---|---|---|---|
| x < 5 | (-∞, 5) | {x \ | x < 5} |
| x ≤ 5 | (-∞, 5] | {x \ | x ≤ 5} |
| x > 5 | (5, ∞) | {x \ | x > 5} |
| x ≥ 5 | [5, ∞) | {x \ | x ≥ 5} |
Compound Conditions
A bounded interval needs a condition with two sides. Set-builder notation has two ways to write this.
The first is a chained inequality, which is the same chain you get from solving a compound inequality.
-1 ≤ 2x + 3 < 9
-4 ≤ 2x < 6 (subtract 3 from all three parts)
-2 ≤ x < 3 (divide all three parts by 2)
Interval notation: [-2, 3)In set-builder notation this is:
{x | -2 ≤ x < 3}The second way uses the word "and." It writes the same set as two conditions joined together.
{x | x ≥ -2 and x < 3}Some texts use the symbol ∧ for "and." The chained form is shorter and is preferred when both pieces describe the same variable.
Unions with "or"
Some solution sets have two separate pieces. The absolute value inequality from this tutorial is an example.
|x - 1| ≥ 3
x - 1 ≤ -3 or x - 1 ≥ 3
x ≤ -2 or x ≥ 4
Interval notation: (-∞, -2] ∪ [4, ∞)In set-builder notation, the word "or" joins the two conditions:
{x | x ≤ -2 or x ≥ 4}You must write the conditions separately. A chain such as 4 ≤ x ≤ -2 would describe no numbers at all, because no number is both at least 4 and at most -2. The chain form works only for "and" conditions, where the pieces overlap in one stretch of the number line.
From Set-Builder Notation Back to Interval Notation
Reading a set-builder expression and converting it is a skill of its own. Follow these steps:
- Identify the variable and the number set it belongs to.
- Read the condition as a region on the number line.
- Decide for each endpoint whether it is included. Symbols
<and>exclude it. Symbols≤and≥include it. - Write the region with parentheses for excluded endpoints and brackets for included ones.
For example, {x | x ≥ 2 and x < 7} has an included left endpoint and an excluded right endpoint, so the interval notation is [2, 7).
Special Cases
Two outcomes from solving inequalities have short set-builder forms.
- When every real number works, such as in
2x + 1 > 2x, the solution set is all real numbers. Write{x | x ∈ ℝ}or simplyℝ. - When no real number works, such as in
x + 3 < x, the solution set is empty. Write{ }or∅. Do not write{∅}, which is a set that contains one element, the empty set. That is a different object.
Checking a Set-Builder Answer
The check is the same as for any solution set: test the boundary value and one value on each side. Here the condition after the bar is exactly what you test.
def satisfies(x):
return -3 * x + 5 > 11
print([x for x in (-3, -2, -1) if satisfies(x)]) # [-3]Only -3 passes. The boundary -2 fails because the inequality is strict, and -1 is on the wrong side. This matches {x | x < -2}.
The same idea works as a program that mirrors the notation. A Python set comprehension is close to set-builder notation, because it also states a rule and a source of candidates:
solution = {x for x in range(-10, 1) if -3 * x + 5 > 11}
print(sorted(solution)) # [-10, -9, -8, -7, -6, -5, -4, -3]Here the source is a finite range of integers, so this lists only part of the set. It models {x ∈ ℤ | -10 ≤ x ≤ 0 and x < -2}, not the full real-number answer. A computer test of finitely many values can reveal a mistake but cannot prove the answer correct.
Common Errors
- Writing the answer without the bar:
{x < -2}is incomplete. Use{x | x < -2}. - Using a bracket in a set-builder condition. Brackets belong to interval notation, so
{x | x [-2, 3)}is wrong. - Forgetting to reverse the inequality before writing the set. If you divided by -3 and kept
x > -2, the set describes the wrong region. - Writing an "or" set as one chain, as shown above.
- Mixing the notations, such as
{x | (-∞, -2)}. Choose one form for the condition. - Ignoring the number set. If the problem asks for integer solutions, say
x ∈ ℤ.
Choosing Between the Notations
Each notation has strengths.
| Situation | Better choice |
|---|---|
| Reporting a simple range of real numbers briefly | Interval notation |
| Restricting to integers or another number set | Set-builder notation |
| Stating a condition with extra requirements, such as "x is even" | Set-builder notation |
| Writing unions of many pieces compactly | Interval notation |
Your course may require a specific form, so check the instructions in each problem.
Exercise
Solve 4 - 2x ≥ 10 and write the solution set in set-builder notation and in interval notation.
Show answer
Subtract 4 from both sides: -2x ≥ 6. Divide by -2 and reverse the inequality: x ≤ -3. Set-builder notation: {x | x ≤ -3}. Interval notation: (-∞, -3].
Exercise
Write {x | x < -1 or x ≥ 5} in interval notation, and explain why it cannot be written as one chain.
Show answer
The interval notation is (-∞, -1) ∪ [5, ∞). A chain such as 5 ≤ x < -1 would require x to be at least 5 and less than -1 at once, which no number satisfies. The two pieces are separate regions, so they need the word "or".
Exercise
How do {x ∈ ℝ | x > 2} and {x ∈ ℤ | x > 2} differ? List the first three members of the second set.
Show answer
The first set contains every real number greater than 2, including 2.5 and √5. The second contains only integers greater than 2. Its first three members are 3, 4, and 5.