Mathwords logoMathwords

Set-Builder Notation

Set-Builder Notation

A shorthand used to write sets, often sets with an infinite number of elements.

Note: The set {x : x > 0} is read aloud, "the set of all x such that x is greater than 0." It is read aloud exactly the same way when the colon : is replaced by the vertical line | as in {x | x > 0}.

General Form: {formula for elements: restrictions} or
{formula for elements| restrictions}

Examples: {x: x ≠ 3} the set of all real numbers except 3
  {x | x < 5} the set of all real numbers less than 5
  {x2 | x is a real number} the set of all real numbers greater than or equal to 0
  {2n + 1: n is an integer} the set of all odd integers (e.g. ..., -3, -1, 1, 3, 5,...).

 

See also

Interval notation, real numbers, integers, cardinality

Key Formula

{xcondition on x}\{\, x \mid \text{condition on } x \,\}
Where:
  • {}\{ \} = Curly braces that enclose the set
  • xx = A variable representing a typical element of the set
  •  or :\mid \text{ or } : = Read as "such that"; separates the variable from the condition
  • condition\text{condition} = A rule or property that every element of the set must satisfy

Worked Example

Problem: Write the set of all real numbers between −2 and 6 (not including −2 and 6) in set-builder notation, then list five elements that belong to this set.
Step 1: Identify the variable and the condition. We need all real numbers xx that are strictly greater than 2-2 and strictly less than 66.
2<x<6-2 < x < 6
Step 2: Place the variable to the left of the vertical bar and the condition to the right, all inside curly braces.
{x2<x<6}\{\, x \mid -2 < x < 6 \,\}
Step 3: Read the notation aloud: "the set of all xx such that xx is greater than 2-2 and less than 66."
Step 4: Verify with sample elements. Numbers like 1,0,3,4.5,5-1, 0, 3, 4.5, 5 satisfy 2<x<6-2 < x < 6, so they belong to the set. Numbers like 2,6,10-2, 6, 10 do not satisfy the condition, so they are excluded.
Answer: {x2<x<6}\{\, x \mid -2 < x < 6 \,\}. Sample elements include 1,0,3,4.5,-1, 0, 3, 4.5, and 55.

Another Example

This example differs because it uses a formula (2n) to generate the elements rather than a simple inequality condition on x. It shows how set-builder notation can define a set by transforming a variable.

Problem: Write the set of all even integers in set-builder notation using a formula for the elements.
Step 1: Recognize that every even integer can be written as 2n2n where nn is an integer. For example, n=0n = 0 gives 00; n=3n = 3 gives 66; n=2n = -2 gives 4-4.
Step 2: Use the "formula | restriction" form. The formula for elements goes on the left of the bar, and the restriction on the variable goes on the right.
{2nnZ}\{\, 2n \mid n \in \mathbb{Z} \,\}
Step 3: Read this as: "the set of all 2n2n such that nn is an integer." The resulting set is {,4,2,0,2,4,6,}\{\ldots, -4, -2, 0, 2, 4, 6, \ldots\}.
Answer: {2nnZ}\{\, 2n \mid n \in \mathbb{Z} \,\}, which represents {,4,2,0,2,4,}\{\ldots, -4, -2, 0, 2, 4, \ldots\}.

Frequently Asked Questions

What is the difference between set-builder notation and roster notation?
Roster notation (also called list notation) explicitly lists every element inside curly braces, like {2,4,6,8}\{2, 4, 6, 8\}. Set-builder notation instead states a rule the elements must follow, like {2n1n4,nZ}\{\, 2n \mid 1 \le n \le 4,\, n \in \mathbb{Z}\,\}. Roster notation works well for small, finite sets, while set-builder notation is essential for infinite sets or sets whose elements are easier to describe by a rule.
What does the vertical bar (|) or colon (:) mean in set-builder notation?
Both the vertical bar | and the colon :: mean exactly the same thing: "such that." They separate the variable (or formula) on the left from the condition on the right. You may use either symbol; the choice is a matter of style, and both are widely accepted in textbooks.
When do you use set-builder notation instead of interval notation?
Interval notation like (2,6)(-2, 6) works only for continuous subsets of the real number line — intervals with no gaps. Set-builder notation is more flexible: it can describe sets of integers, sets defined by formulas, sets with specific values removed (like {xx3}\{x \mid x \neq 3\}), or any set whose membership is governed by a condition. If your set is a simple interval on the real line, either notation works, but set-builder notation handles more complex situations.

Set-Builder Notation vs. Interval Notation

Set-Builder NotationInterval Notation
Form{xcondition}\{\, x \mid \text{condition} \,\}(a,b)(a, b), [a,b][a, b], [a,b)[a, b), etc.
What it describesAny set defined by a rule or propertyA continuous interval of real numbers
Handles gaps / discrete setsYes — e.g., {xx3}\{x \mid x \neq 3\} or {2nnZ}\{2n \mid n \in \mathbb{Z}\}No — only unbroken intervals (unions needed for gaps)
Typical useAlgebra, discrete math, proofs, defining domainsPrecalculus, calculus, describing domains on the real line
Example: all reals > 0{xx>0}\{\, x \mid x > 0 \,\}(0,)(0, \infty)

Why It Matters

Set-builder notation appears constantly in algebra and precalculus when you state the domain or range of a function — for instance, writing {xx0}\{x \mid x \neq 0\} for the domain of f(x)=1/xf(x) = 1/x. It is also the standard language in discrete mathematics and proofs, where you define sets of integers, solutions, or other objects by their properties. Mastering this notation makes it far easier to read and communicate mathematical ideas precisely.

Common Mistakes

Mistake: Forgetting to specify the type of number the variable represents.
Correction: Writing {xx>0}\{x \mid x > 0\} usually assumes xx is a real number, but if you intend only positive integers you must say so: {xZx>0}\{x \in \mathbb{Z} \mid x > 0\}. Always make the domain of the variable clear when it is not obvious from context.
Mistake: Confusing the formula side with the condition side.
Correction: In {2n+1nZ}\{2n + 1 \mid n \in \mathbb{Z}\}, the expression 2n+12n + 1 is the formula that generates elements, and nZn \in \mathbb{Z} is the restriction. Swapping these — writing {nZ2n+1}\{n \in \mathbb{Z} \mid 2n + 1\} — is meaningless because 2n+12n + 1 is not a true-or-false condition.

Related Terms

  • SetThe broader concept set-builder notation describes
  • Interval NotationAn alternative notation for real-number intervals
  • Element of a SetIndividual objects that satisfy the set condition
  • InfiniteSet-builder notation often defines infinite sets
  • Real NumbersThe most common number set used as the domain
  • IntegersFrequently used to restrict the variable type
  • CardinalityDescribes the size of the set being defined