Set Builder Notation — Rules and Worked Examples

#Algebra
TL;DR
Set builder notation describes a set by stating the rule its elements obey — written as ${x \mid \text{condition on } x}$. This article covers the syntax, three worked examples, a side-by-side comparison with roster notation, and the small list of symbols you need to read it fluently.
BT
Bhanzu TeamLast updated on May 27, 20268 min read

Describing a Set Without Listing Its Members

Some sets are short enough to list — ${1, 3, 5, 7, 9}$. Others contain millions of elements, or infinitely many. "All positive even integers" is one such set, and writing it out would never finish. Set builder notation solves that — instead of listing members, you describe the property they share.

Set builder notation uses three pieces: a variable (typically $x$), a vertical bar $|$ (read as "such that"), and a condition the variable must satisfy. The whole thing sits inside set braces ${ \dots }$.

The Syntax — In One Reading

$${x \mid x \text{ is a positive even integer}}$$

Read it left to right: "the set of all $x$ such that $x$ is a positive even integer."

The vertical bar $|$ can also be written as a colon (some textbooks prefer ${x : x > 0}$ to ${x \mid x > 0}$). Both are correct. Indian and UK textbooks favour the colon; US textbooks more often use the bar.

The variable on the left is a placeholder — "the kind of thing this set contains." The condition on the right is the membership test.

The symbols you'll see

Symbol

Reads as

Use

$\mid$ or $:$

"such that"

Separates variable from condition

$\in$

"is an element of"

$x \in \mathbb{N}$ means $x$ is a natural number

$\notin$

"is not an element of"

$0 \notin \mathbb{N}$ in the convention where $\mathbb{N} = {1, 2, 3, \dots}$

$\mathbb{N}, \mathbb{Z}, \mathbb{Q}, \mathbb{R}$

Natural / integer / rational / real

Sets of numbers

$\wedge$

"and"

Combine two conditions: $x > 0 \wedge x < 10$

$\vee$

"or"

$x < -1 \vee x > 1$

Set Builder vs Roster — Which Notation, When

The two notations are interchangeable in principle but very different in practice.

Feature

Roster notation

Set builder notation

Shape

${1, 2, 3}$ — list the elements

${x \mid \text{rule}}$ — describe the rule

Best for

Small finite sets where listing is short

Large finite sets, infinite sets, or sets defined by a property

Limit

Becomes unreadable past ~10 elements

Always one line, regardless of set size

Example — even numbers under 12

${2, 4, 6, 8, 10}$ — clear

${x \mid x \in \mathbb{N}, x < 12, x \text{ even}}$ — overkill

Example — all positive even integers

${2, 4, 6, 8, \dots}$ — ambiguous (the dots assume the reader knows the rule)

${x \mid x \in \mathbb{N}, x \text{ even}}$ — unambiguous

Example — all real $x$ with $-1 < x < 5$

Impossible (uncountable)

${x \in \mathbb{R} \mid -1 < x < 5}$ — natural fit

The rule of thumb: use roster when you can write the whole list comfortably; use builder when you can't. Most Grade 9 and 10 textbook questions ask students to convert between the two precisely because the choice depends on the set's size.

Three Worked Examples — Quick, Standard, Stretch

Quick. Write "the set of vowels in the English alphabet" in set builder notation.

$$V = {x \mid x \text{ is a vowel in the English alphabet}}.$$

The same set in roster: $V = {a, e, i, o, u}$. Both are correct; roster is shorter for this case.

Standard (Walking Through the Wrong Answer). Convert ${2, 3, 5, 7, 11, 13, 17, 19}$ to set builder notation.

The wrong path. A student notices the list is all odd except for 2, and writes ${x \mid x \text{ is odd and } 1 < x < 20}$. Check: that would include 9 and 15, which are odd but not in the set. The condition is wrong.

A second attempt: "all integers between 1 and 20 that are odd or equal to 2" — close, but cluttered. A reader has to think twice to recognise it.

The rescue. The defining property of the list is prime numbers less than 20. Set builder form:

$$P = {x \mid x \text{ is a prime number}, x < 20}.$$

Final answer: $P = {x \mid x \text{ is prime}, x < 20}$.

The lesson — when converting to set builder, find the single defining property the elements share. If you need two clauses joined by or, you've probably missed a simpler description.

Stretch. Write the domain of $f(x) = \tfrac{1}{x - 3}$ in set builder notation.

The function is defined for every real number except where the denominator is zero — that is, every real number except $x = 3$.

$$\text{Domain}(f) = {x \in \mathbb{R} \mid x \neq 3}.$$

Equivalently, in interval notation: $(-\infty, 3) \cup (3, \infty)$. Set builder is often clearer when the excluded set is a single point or short list; interval notation wins when the domain is a clean range with one or two endpoints.

Final answer: ${x \in \mathbb{R} \mid x \neq 3}$.

Why Set Builder Notation Matters

Set builder notation is the bridge between Grade 9 set theory and almost everything that comes after.

  • Function domains and ranges. In calculus, the domain of $f(x) = \sqrt{x - 2}$ is ${x \in \mathbb{R} \mid x \geq 2}$. You can't write that as a roster — it has uncountably many elements.

  • Probability and statistics. Events are sets of outcomes; the event "roll an even number on a six-sided die" is naturally ${x \mid x \in {1, \dots, 6}, x \text{ even}}$.

  • Computer science. A set comprehension in Python — {x for x in range(20) if is_prime(x)} — is set builder notation translated word-for-word into code.

  • Linear algebra. A vector space's null space is ${\mathbf{x} \in \mathbb{R}^n \mid A\mathbf{x} = \mathbf{0}}$. The notation scales to the abstract case without loss.

Where Students Lose the Mark

Mistake 1: Confusing the variable with a specific value.

Where it slips in: A student reads ${x \mid x > 5}$ and asks "what is $x$?" — as if $x$ stands for a single number waiting to be found.

Don't do this: Treat the $x$ inside the braces as an unknown to solve for.

The correct way: The $x$ is a dummy variable. It stands for every element of the set. The notation says "all values that satisfy the condition" — not "find the value." The same set could be written ${y \mid y > 5}$ or ${n \mid n > 5}$; the letter doesn't matter.

Mistake 2: Forgetting to declare the universe.

Where it slips in: A student writes ${x \mid x < 5}$ without saying whether $x$ is an integer, a real number, or a natural number.

Don't do this: Leave ${x \mid x < 5}$ unqualified. It's ambiguous — does it include $\tfrac{1}{2}$? $-1000$?

The correct way: Always specify the universe. Write ${x \in \mathbb{N} \mid x < 5}$ if you mean ${1, 2, 3, 4}$, or ${x \in \mathbb{R} \mid x < 5}$ if you mean the entire ray below 5. The Grade 10 Bhanzu cohort sees one mark deducted per question for this slip — and almost every student loses it at least once.

Mistake 3: Inconsistent bar notation.

Where it slips in: Switching between $\mid$ and $:$ within the same problem, or writing the condition before the bar.

Don't do this: ${x > 5 \mid x}$ — the condition belongs on the right of the bar, not the left.

The correct way: Variable first (left of the bar), condition second (right of the bar). Pick one of $\mid$ or $:$ and stay with it throughout a problem.

Conclusion

  • Set builder notation describes a set by its defining property — ${x \mid \text{condition}}$ — instead of listing every member.

  • Use roster notation when the set is small and listable; use set builder when the set is large, infinite, or defined by a property.

  • Always declare the universe ($x \in \mathbb{N}$, $x \in \mathbb{R}$) — without it the notation is ambiguous.

  • The variable inside the braces is a placeholder, not an unknown to solve for.

  • Set builder is the notation that scales — from Grade 9 set theory to calculus domains and code comprehensions.

Your Next Move — Three Practice Problems

  1. Write ${1, 4, 9, 16, 25}$ in set builder notation.

  2. Express the domain of $g(x) = \sqrt{x + 1}$ in set builder notation.

  3. Convert ${x \in \mathbb{Z} \mid -2 \leq x \leq 3}$ to roster notation.

If Problem 1 takes you more than two attempts, look at the squares — the defining property is sitting in plain sight.

Want a live Bhanzu trainer to walk your child through set notation and the rest of the Grade 9 set-theory chapter? Book a free demo class — online globally.

Book a Free Demo

Was this article helpful?

Your feedback helps us write better content

Frequently Asked Questions

What is set builder notation in simple words?
It's a way to describe a set by writing the rule its members follow, instead of listing every member. Read ${x \mid x \text{ is odd}}$ as "the set of all $x$ such that $x$ is odd."
What does the vertical bar $|$ mean in set builder notation?
"Such that." Some books use a colon instead; both mean the same thing.
Can set builder notation describe infinite sets?
Yes — that's one of its main uses. ${x \in \mathbb{Z} \mid x > 0}$ describes the infinite set of positive integers in one line.
How is set builder notation different from roster notation?
Roster lists every element: ${2, 4, 6, 8}$. Set builder describes the rule: ${x \mid x \text{ is even}, 0 < x < 10}$. Roster is shorter for tiny finite sets; builder is the only choice for infinite sets.
What's the universe in set builder notation?
The universe is the set the variable is drawn from — usually $\mathbb{N}$, $\mathbb{Z}$, $\mathbb{Q}$, or $\mathbb{R}$. Always declare it: ${x \in \mathbb{R} \mid x^2 < 4}$ is unambiguous; ${x \mid x^2 < 4}$ is not.
How do I write the domain of a function in set builder notation?
Identify the values of $x$ that make $f(x)$ defined. For $f(x) = \tfrac{1}{x}$, that's every real number except 0: ${x \in \mathbb{R} \mid x \neq 0}$.
Is set builder notation used outside math?
Yes — Python, Haskell, and many other programming languages use set or list comprehensions modeled directly on it. Database query languages (SQL WHERE clauses) carry the same idea: filter a universe by a condition.
✍️ Written By
BT
Bhanzu Team
Content Creator and Editor
Bhanzu’s editorial team, known as Team Bhanzu, is made up of experienced educators, curriculum experts, content strategists, and fact-checkers dedicated to making math simple and engaging for learners worldwide. Every article and resource is carefully researched, thoughtfully structured, and rigorously reviewed to ensure accuracy, clarity, and real-world relevance. We understand that building strong math foundations can raise questions for students and parents alike. That’s why Team Bhanzu focuses on delivering practical insights, concept-driven explanations, and trustworthy guidance-empowering learners to develop confidence, speed, and a lifelong love for mathematics.
Related Articles
Book a FREE Demo ClassBook Now →