Set-Builder Notation Calculator
Turn set-builder notation into roster form. Pick a range and a condition and see the actual elements, the notation written out, and the set's size.
Set-Builder Notation Calculator
Background.
Set-builder notation describes a set by stating a rule its members must satisfy rather than by listing them. The expression { x ∈ ℤ | 1 ≤ x ≤ 20 and 3 | x } is read as "the set of all integers x, such that x is between 1 and 20 inclusive and 3 divides x", and it names a set with six members: {3, 6, 9, 12, 15, 18}. That second, explicit form is called roster notation, and converting between the two is one of the first things a discrete mathematics or algebra course asks you to do.
This calculator makes the conversion in both directions at once. Choose a range and a condition and it produces the roster form, the number of elements, the smallest and largest members, and their sum — and it also prints your choices back as correct set-builder notation, so you can see whether the calculator read your condition the way you intended before you trust the list.
One scope limit is worth stating up front rather than burying it: this page handles bounded sets of integers described by a single condition drawn from the list in the dropdown. It is not a general parser for arbitrary set-builder expressions. Accepting a free-text predicate would mean building a full predicate-logic engine, and a tool that silently mis-reads { x | x² < 10 } is considerably worse than one that declines to accept it. The conditions on offer — multiples, divisors, parity, primality, perfect squares, and a simple inequality — cover the great majority of textbook exercises, and the notation is printed back for every one of them.
Both bounds are inclusive, negative ranges work, and the range may span up to 10,000 integers. When no integer in the range satisfies the condition, the answer is the empty set, which the page names as ∅ rather than showing as an ambiguous pair of empty braces.
What is set-builder notation calculator?
Set-builder notation writes a set as { x ∈ D | P(x) }, where D is the domain the variable ranges over — here always ℤ, the integers — and P(x) is a predicate every member must satisfy. The vertical bar is read "such that" and is sometimes written as a colon instead. Roster notation, by contrast, lists the members explicitly inside braces: {3, 6, 9, 12, 15, 18}. The two notations describe exactly the same object, and a set can always be written either way when it is finite. Set-builder becomes essential when a set is infinite or too large to list, which is why it is introduced early and used everywhere afterwards.
How to use this calculator.
- Pick the condition x must satisfy from the dropdown. Choose 'no extra condition' if you just want every integer in a range.
- Enter the condition value if your choice needs one — the multiple, the number being divided, or the threshold. The other conditions ignore this field.
- Set the lower and upper bounds. Both are inclusive, so a bound that satisfies the condition is itself a member.
- Read the roster form: those are the actual elements. Check the set-builder line underneath to confirm the calculator understood your condition.
- Use the cardinality when a question asks how many elements the set has — it stays exact even when the roster listing is truncated at 40 elements.
The formula.
The conversion is a filter. The calculator walks every integer from the lower bound to the upper bound inclusive, tests it against the chosen predicate, and keeps the ones that pass. What comes out is the roster form; the count of what came out is the cardinality; the first and last survivors are the smallest and largest elements, since the scan runs in increasing order.
The predicates are exactly what their names say. 'Multiple of k' keeps x when k divides x, written k | x. 'Divisor of k' is the reverse relation, keeping x when x divides k, written x | k — the two are frequently confused, which is why the notation is printed back with the bar the right way round. Parity uses the remainder on division by two, and it is careful with negatives: in most programming languages the remainder keeps the sign of the dividend, so −3 leaves a remainder of −1 rather than 1, and testing 'remainder equals 1' would wrongly exclude every negative odd number. This calculator tests 'remainder is not zero' instead, so −5, −3 and −1 are correctly odd. Primality requires x to be at least 2, so 1, 0 and every negative integer are excluded. Perfect squares require x to be non-negative, and 0 and 1 both qualify.
Two condition values are rejected rather than accepted with a strange result. 'Multiple of 0' is meaningless because 0 | x is undefined. 'Divisor of 0' is vacuous in the opposite way: every non-zero integer divides 0, so the condition would filter nothing. Both raise a specific error naming the reason.
An empty result is a legitimate answer, not a failure. If no integer in the range satisfies the condition — multiples of 7 between 1 and 6, for instance — the set is ∅. Its cardinality and its element sum are both 0. The smallest and largest elements are reported as 0 as well, which is a display convention rather than a mathematical claim: the empty set genuinely has no least or greatest element, and the roster line says so in words.
A worked example.
Take the set-builder expression { x ∈ ℤ | 1 ≤ x ≤ 20 and 3 | x }, which is the calculator's default. Walk the integers from 1 to 20 and keep the ones divisible by 3. That gives 3, 6, 9, 12, 15 and 18. The next multiple, 21, falls outside the upper bound and is excluded, and no multiple below 3 lies in the range. So the roster form is {3, 6, 9, 12, 15, 18} and the cardinality is 6. Because the scan runs upwards, the first survivor is the smallest element, 3, and the last is the largest, 18. The sum is 3 + 6 + 9 + 12 + 15 + 18 = 63, which you can check quickly as 3 × (1 + 2 + 3 + 4 + 5 + 6) = 3 × 21 = 63. The set-builder line comes back as { x ∈ ℤ | 1 ≤ x ≤ 20 and 3 | x }, confirming that the calculator read 'multiple of 3' with the divisibility bar pointing the right way — 3 divides x, not x divides 3. Had you chosen 'divisor of' with the same value, the notation would read x | 3 and the answer would have been the very different set {1, 3}.
Frequently asked questions.
How do you read set-builder notation?
What is the difference between set-builder form and roster form?
What does 3 | x mean, and how is it different from x | 3?
Why does my set come back empty?
Can I type my own condition instead of choosing one?
References& sources.
- [1]Levin, Oscar. Discrete Mathematics: An Open Introduction, 3rd edition, §0.3 "Sets" — set-builder and roster notation, the reading of the vertical bar as "such that", and the definitions of cardinality and the empty set. Open access; retrieved 2026-07-29.
- [2]Weisstein, Eric W. "Subset." MathWorld — Wolfram Research. Used here for the notational conventions ⊆ and ⊂ referenced alongside set-builder form. Retrieved 2026-07-29.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 977 calculators remain free
- No billing is enabled