How Set-Builder Notation Works
Set-builder notation describes a set by stating a rule its members must satisfy, instead of listing every element by hand. The general form is { x ∈ U | P(x) }, read as "the set of all x in the universe U such that the condition P(x) is true." This calculator lets you define U (integers, whole numbers, or natural numbers), a numeric range for x, and a condition P(x) — then it enumerates every value that satisfies the rule and converts it into roster notation, the plain listed-out form of the same set.
The general form and how this calculator applies it
Choose a domain (ℤ for all integers, W for whole numbers x ≥ 0, or ℕ for natural numbers x ≥ 1), then set a lower and upper bound so the set is finite and can be listed. Pick a condition — even, odd, a multiple of k, not a multiple of k, a perfect square, or prime — and the calculator tests every integer in your range against it. Each x that passes the test is added to the roster; the count of surviving elements is the cardinality, written |S|. For example, { x ∈ ℤ | 1 ≤ x ≤ 20, x is a multiple of 3 } evaluates to the roster { 3, 6, 9, 12, 15, 18 }, so |S| = 6.
Common mistakes
- Ignoring the domain: natural numbers (ℕ) start at 1 and whole numbers (W) start at 0 — a lower bound below that floor is invalid for those domains.
- Off-by-one on inclusive bounds: both the lower and upper bound are included in the set, so { x ∈ ℤ | 1 ≤ x ≤ 5 } has 5 elements, not 4.
- Confusing ∈ (element of) with ⊆ (subset of): "x ∈ U" restricts what x can be; it does not describe a relationship between two sets.
- Treating an infinite set as if it were finite: { x ∈ ℤ | x is even } has no bounds and is infinite — roster notation only works once you add a finite range, which is what this calculator's bounds are for.
Real-world applications
- Database and spreadsheet filters (SQL's
WHEREclause, spreadsheetFILTERfunctions) are set-builder notation in disguise: rows are the domain, the filter condition is P(x). - Programming language "comprehensions" (Python's
[x for x in range(a,b) if condition]) directly mirror { x ∈ U | condition }. - Defining the domain of a function, such as { x ∈ ℝ | x ≠ 0 } for f(x) = 1/x, uses the same notation to exclude invalid inputs.
- Probability defines events as sets of outcomes satisfying a condition, e.g. the event "rolling an even number" is { x ∈ {1,...,6} | x is even }.