Set Builder Calculator

Enter a number domain, bounds, and a condition to convert set-builder notation { x | P(x) } into roster notation, list the elements, and get the set's cardinality.

Quick Facts

Set-builder form
{ x ∈ U | P(x) }
Read as "the set of all x in U such that P(x) is true".
Roster notation
{ a, b, c, … }
Lists every element explicitly; only practical for finite sets.
Cardinality
|S| = number of elements
Counts how many values satisfy the condition.
Common domains
ℤ, W, ℕ
Integers, whole numbers (≥0), and natural numbers (≥1).

Your Results

Calculated
Set-Builder Notation
-
{ x ∈ U | condition }
Roster Notation
-
Explicit list of elements
Cardinality |S|
-
Number of elements in the set
Sum of Elements
-
Total of all listed elements

Ready

Set the domain, bounds, and condition, then press Calculate.

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 WHERE clause, spreadsheet FILTER functions) 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 }.

Frequently Asked Questions

What is set-builder notation?
Set-builder notation describes a set by stating the properties its members must satisfy, in the form { x ∈ U | P(x) }, read as "the set of all x in U such that P(x) is true," rather than listing every element individually.
What is the difference between set-builder and roster notation?
Roster notation lists every element explicitly inside braces, such as {2, 4, 6, 8}, while set-builder notation states a rule the elements must satisfy, such as {x ∈ ℤ | 2 ≤ x ≤ 8, x is even}. Roster notation only works for sets small enough to enumerate; set-builder notation can also describe infinite sets.
How do you find the cardinality of a set from its set-builder definition?
For a finite set, the cardinality |S| is simply the number of elements that satisfy the condition. This calculator finds it by testing every integer in your chosen range against the condition and counting the matches.
Can set-builder notation describe infinite sets?
Yes — for example {x ∈ ℤ | x is even} describes all even integers, an infinite set, because it states a rule rather than enumerating elements. This calculator works with a finite range you specify so it can list the elements; the same condition without bounds still describes the infinite version.