Reading a Set-Builder Expression
In Set Equality, equality of condition-defined sets was connected to whether their membership conditions agree. Set-builder notation gives a compact way to write such a condition-defined set. A common form is $$ \{x\in D:P(x)\}. $$ Read this as “the set of all \(x\) in \(D\) such that \(P(x)\).” The letter \(x\) stands for a possible element, \(D\) specifies where the possible elements come from, and \(P(x)\) is the condition that determines which candidates are included.
The notation between the braces can be written with a colon or a vertical bar. Thus \(\{x\in D:P(x)\}\) and \(\{x\in D\mid P(x)\}\) have the same meaning. In either version, the condition is not an extra element of the set. It is an instruction for deciding which elements of the stated domain to include.
The membership criterion follows from the definition of a set described by a condition: for any object \(y\), $$ y\in\{x\in D:P(x)\} \quad\Longleftrightarrow\quad y\in D\ \text{and}\ P(y). $$ This is the set-builder membership characterization introduced in Set Membership. It is useful to substitute the candidate \(y\) into the condition and check both requirements. A candidate outside the domain is not included, even if it would satisfy the written condition.
Conditions May Have Several Parts
A condition can be a single equation or inequality, but it can also combine statements using “and,” “or,” or quantifiers. For example, \(\{x\in\mathbb R:-1\leq x<2\}\) uses a conjunction: a real number is included exactly when both inequalities hold. Similarly, “there is an integer \(k\) such that \(n=4k+1\)” is an existential condition on an integer \(n\).
When translating a sentence into set-builder notation, identify the domain first. Then write a condition that refers to a general candidate from that domain. For instance, to describe the integers that leave remainder \(1\) when divided by \(4\), use an integer variable \(n\), and state that \(n=4k+1\) for some integer \(k\). The quantified variable \(k\) has a different role from the candidate \(n\): \(n\) is the potential element, while \(k\) helps express the property.
Choose a variable for a possible element and state the set it must come from.
Translate the defining property into a precise equation, inequality, or logical statement about the candidate.
For a proposed object, verify that it belongs to the domain and that it satisfies the condition.
Worked Example: An Interval Described by a Condition
Consider $$ A=\{x\in\mathbb R:-2\leq x<3\}. $$ The domain is \(\mathbb R\), and the condition requires both that \(x\geq-2\) and that \(x<3\). To test \(-2\), note that \(-2\in\mathbb R\), \(-2\leq-2\), and \(-2<3\). Therefore \(-2\in A\). For \(3\), although \(3\in\mathbb R\) and \(-2\leq3\), the inequality \(3<3\) is false. Hence \(3\notin A\).
The number \(1/2\) belongs to \(A\), because \(-2\leq1/2<3\). A number such as \(-5\) is in the domain but fails the lower inequality. Thus this set consists of the real numbers from \(-2\) up to, but not including, \(3\). The strictness or non-strictness of each inequality determines whether its endpoint is included.
Worked Example: An Existential Condition on Integers
Let $$ B=\{n\in\mathbb Z:\text{there exists }k\in\mathbb Z\text{ such that }n=3k+1\}. $$ The candidate elements are integers. An integer belongs to \(B\) if it can be written as \(3k+1\) for some integer \(k\). For \(n=10\), choose \(k=3\). Since \(10=3(3)+1\), we have \(10\in B\). For \(n=-5\), choose \(k=-2\); then \(-5=3(-2)+1\), so \(-5\in B\) as well.
By contrast, \(8\notin B\). If \(8=3k+1\), then \(3k=7\), so \(k=7/3\), which is not an integer. No integer \(k\) satisfies the required equation. The word “there exists” is important: the condition asks for at least one suitable integer \(k\), not for every integer \(k\).
The Candidate Variable Is Not a Fixed Element
The variable immediately inside the braces is a placeholder for possible elements. Once the set has been defined, its elements do not depend on the particular letter chosen for that placeholder. The candidate variable is often called a bound or dummy variable: its role is local to the expression in which it appears.
Proposition (Renaming the Candidate Variable). Let \(D\) be a domain, and let \(P\) be a condition whose variable can be renamed without changing its meaning. Then $$ \{x\in D:P(x)\}=\{t\in D:P(t)\}. $$
Proof. Let \(y\) be any object. By the set-builder membership characterization, \(y\in\{x\in D:P(x)\}\) exactly when \(y\in D\) and \(P(y)\). Also, \(y\in\{t\in D:P(t)\}\) exactly when \(y\in D\) and \(P(y)\). Thus \(y\) belongs to the first set if and only if it belongs to the second. Since this holds for every object \(y\), the sets have the same elements and are equal.
This renaming does not permit changing a variable that has a separate role in the condition without checking the result. For example, in \(\{n\in\mathbb Z:\exists k\in\mathbb Z,\ n=3k+1\}\), the candidate \(n\) and the quantified integer \(k\) do different jobs. Renaming \(n\) to \(m\) is harmless if the equation is changed consistently to \(m=3k+1\). Replacing \(k\) with \(n\) without adjusting the rest of the expression could instead create confusion about which variable is being quantified.
Worked Example: Renaming Without Changing the Set
The expressions $$ C=\{r\in\mathbb R:r^2=16\}, \qquad D=\{s\in\mathbb R:s^2=16\} $$ differ only in the name of the candidate variable. In either expression, a real number is included exactly when its square is \(16\). The equation \(z^2=16\) is equivalent to \((z-4)(z+4)=0\), so its real solutions are \(z=4\) and \(z=-4\). Therefore both expressions describe the set \(\{-4,4\}\), and \(C=D\).
The variable name itself does not identify an element. What matters is the domain and the condition applied to each candidate.
Filtering a Domain in Stages
A condition-defined set can itself be used as the domain for another condition. This is a useful way to describe a selection made in two stages: first retain the elements satisfying one property, then retain from those the elements satisfying a second property. The two stages can be combined into a single condition using “and.”
Theorem (Combining Successive Conditions). Let \(D\) be a domain, and let \(P(x)\) and \(Q(x)\) be conditions defined on \(D\). Define $$ A=\{x\in D:P(x)\}. $$ Then $$ \{x\in A:Q(x)\} = \{x\in D:P(x)\text{ and }Q(x)\}. $$
Proof. Let \(y\) be any object. By the membership characterization, \(y\in\{x\in A:Q(x)\}\) if and only if \(y\in A\) and \(Q(y)\). Since \(A=\{x\in D:P(x)\}\), membership in \(A\) means \(y\in D\) and \(P(y)\). Consequently, $$ y\in\{x\in A:Q(x)\} \quad\Longleftrightarrow\quad y\in D,\ P(y),\ \text{and }Q(y). $$ The right-hand side says exactly that \(y\in\{x\in D:P(x)\text{ and }Q(x)\}\). Thus the two sets have the same elements. By the Equality by Double Inclusion theorem from Set Equality, they are equal.
The domain \(A\) in the left-hand expression is already restricted to elements of \(D\) satisfying \(P\). That is why the single condition on the right must include both \(P\) and \(Q\). Omitting \(P\) would generally admit elements of \(D\) that pass \(Q\) but fail the first selection.
Worked Example: Applying Two Restrictions
Let \(D=\mathbb Z\), and first select integers divisible by \(3\): $$ A=\{n\in\mathbb Z:\text{there exists }k\in\mathbb Z\text{ such that }n=3k\}. $$ Now retain from \(A\) only the integers greater than \(10\). The resulting set is $$ \{n\in A:n>10\} = \{n\in\mathbb Z:\text{there exists }k\in\mathbb Z\text{ such that }n=3k\text{ and }n>10\}, $$ by the Combining Successive Conditions theorem.
For example, \(12\) belongs: it is an integer, \(12=3\cdot4\) for the integer \(4\), and \(12>10\). The integer \(9\) satisfies the divisibility condition but not \(n>10\), so it is excluded. The integer \(11\) satisfies \(n>10\), but it is not divisible by \(3\), so it is excluded too. The conjunction makes both requirements explicit.
Finite Domains and Roster Notation
When the domain has only finitely many listed elements, a condition can be evaluated on each candidate to recover a roster. This gives a direct link between set-builder notation and the roster notation introduced in Sets and Elements. Repeated entries in the resulting roster are unnecessary, because a set records its elements rather than the number of times they are written.
Proposition (Evaluating a Condition on a Finite Domain). Let \(D=\{d_1,\ldots,d_n\}\), where the \(d_i\) are distinct, and let \(P\) be a condition defined on \(D\). Then \(\{x\in D:P(x)\}\) contains exactly those \(d_i\) for which \(P(d_i)\) is true. If none of the \(d_i\) satisfies \(P\), the set is \(\varnothing\).
Proof. Let \(y\in\{x\in D:P(x)\}\). By the set-builder membership characterization, \(y\in D\) and \(P(y)\). Since \(D=\{d_1,\ldots,d_n\}\), the finite-roster membership criterion from Set Membership gives \(y=d_i\) for at least one index \(i\). Therefore \(P(d_i)\) holds, and \(y\) is one of the listed elements satisfying the condition.
Conversely, take any listed element \(d_i\) for which \(P(d_i)\) is true. Since \(d_i\in D\), the membership characterization gives \(d_i\in\{x\in D:P(x)\}\). Thus every listed element satisfying the condition is included, and no other element is included. If no listed element satisfies \(P\), there is no element in the condition-defined set, so it is the empty set \(\varnothing\). This proves the proposition.
Worked Example: Selecting from a Finite Domain
Let $$ E=\{x\in\{2,4,6,9\}:x^2<40\}. $$ The domain consists of \(2,4,6,\) and \(9\). Evaluate the condition on each: $$ 2^2=4<40,\qquad 4^2=16<40,\qquad 6^2=36<40,\qquad 9^2=81\not<40. $$ The first three candidates satisfy the condition, and the last one does not. Therefore \(E=\{2,4,6\}\).
The conclusion depends on the stated finite domain. For example, \(5\) also satisfies \(x^2<40\), but \(5\notin\{2,4,6,9\}\), so it is not eligible and does not belong to \(E\). A condition alone does not determine the intended set unless its domain is also clear.
Keep the Domain Visible
A frequent source of ambiguity is writing a condition without saying what objects are being considered. The expression \(\{x:x^2<40\}\), for example, does not specify whether \(x\) ranges over integers, rational numbers, real numbers, or some other domain. Under the domain \(\mathbb Z\), the set is \(\{-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6\}\). Under the domain \(\mathbb R\), it contains every real number strictly between \(-\sqrt{40}\) and \(\sqrt{40}\). These are different sets.
In a context where a domain has already been fixed, authors sometimes omit it for brevity. That convention is safe only when the intended domain is genuinely unambiguous. In a proof or a new definition, writing \(\{x\in D:P(x)\}\) makes the allowed inputs explicit and helps ensure that every condition is defined for the objects being considered.
| Part of the notation | Role |
|---|---|
| \(x\) | A placeholder for a possible element of the set. |
| \(x\in D\) | The domain restriction: only elements of \(D\) are eligible. |
| \(P(x)\) | The condition that determines whether an eligible candidate is included. |
| \(\{x\in D:P(x)\}\) | The set of elements of \(D\) satisfying \(P\). |
For each question, identify the domain and test the condition rather than relying on the appearance of the notation.
Check Your Understanding
- In \(A=\{x\in\mathbb R:1\leq x<5\}\), does \(1\) belong to \(A\)? Does \(5\)? Explain using the condition.
- Let \(B=\{n\in\mathbb Z:\text{there exists }k\in\mathbb Z\text{ such that }n=5k+2\}\). Show that \(17\in B\), and determine whether \(12\in B\).
- Why is it important to state the domain in \(\{x:x^2<9\}\)? Describe how the meaning differs if the domain is \(\mathbb Z\) or \(\mathbb R\).
- Explain why \(\{r\in\mathbb R:r^2=25\}\) and \(\{s\in\mathbb R:s^2=25\}\) describe the same set. Identify its elements.
- If \(A=\{x\in D:P(x)\}\), write \(\{x\in A:Q(x)\}\) as one set-builder expression with domain \(D\).
- Evaluate \(\{x\in\{1,3,5,8\}:x\text{ is odd}\}\) as a roster. Which domain elements are excluded?