Audited ·Last updated 31 Jul 2026·2 citations·Tier 3·0 uses

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

Condition on x
Used only by 'multiple of', 'divisor of' and 'greater than'. The other conditions ignore it. Must be a whole number, and cannot be 0 for the two divisibility conditions.
The smallest integer considered. Included in the set if it satisfies the condition. Negative bounds are fine.
The largest integer considered, also inclusive. The range may span at most 10,000 integers.
Roster form
{3, 6, 9, 12, 15, 18}
The actual elements, listed inside braces. Listing stops after 40 elements and says how many remain; the counts below stay exact. An empty result is named as ∅ rather than shown as empty braces.
Set-builder form
{ x ∈ ℤ | 1 ≤ x ≤ 20 and 3 | x }
Number of elements
6
Smallest element
3
Largest element
18
Sum of the elements
63

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.

  1. Pick the condition x must satisfy from the dropdown. Choose 'no extra condition' if you just want every integer in a range.
  2. Enter the condition value if your choice needs one — the multiple, the number being divided, or the threshold. The other conditions ignore this field.
  3. Set the lower and upper bounds. Both are inclusive, so a bound that satisfies the condition is itself a member.
  4. Read the roster form: those are the actual elements. Check the set-builder line underneath to confirm the calculator understood your condition.
  5. 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.

{ x ∈ ℤ | a ≤ x ≤ b and P(x) } → roster form

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.

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}.

rule Value3
upper Bound20
rulemultiple-of
lower Bound1

Frequently asked questions.

How do you read set-builder notation?
{ x ∈ ℤ | 1 ≤ x ≤ 20 and 3 | x } reads as "the set of all integers x such that x is between 1 and 20 inclusive, and 3 divides x". The part before the vertical bar names the variable and the domain it ranges over; the bar means "such that"; the part after it is the condition every member must satisfy. Some textbooks write a colon instead of the bar, with exactly the same meaning.
What is the difference between set-builder form and roster form?
Roster form lists the members explicitly — {3, 6, 9, 12, 15, 18}. Set-builder form states a rule they satisfy — { x ∈ ℤ | 1 ≤ x ≤ 20 and 3 | x }. They describe the same set, and any finite set can be written either way. Set-builder notation is essential for sets that are infinite or simply too large to list, which is why it is introduced early and then used everywhere.
What does 3 | x mean, and how is it different from x | 3?
The vertical bar in this context means "divides". 3 | x says 3 divides x, so x is a multiple of 3: 3, 6, 9 and so on. x | 3 says x divides 3, so x is a divisor of 3: just 1 and 3 among the positive integers. The two are easy to swap by accident, which is why this calculator prints the notation back with the bar oriented the way your chosen condition actually works.
Why does my set come back empty?
Because no integer in the range you gave satisfies the condition — for example, multiples of 7 between 1 and 6. That is a legitimate answer, and the set is written ∅. Its cardinality and element sum are 0. The smallest and largest element fields also read 0, but that is a display convention: the empty set genuinely has no least or greatest element, and the roster line says as much in words.
Can I type my own condition instead of choosing one?
No, and that is deliberate. Accepting free-text predicates would mean building a general predicate-logic parser, and a tool that silently mis-reads a condition gives you a confidently wrong list with no warning. The conditions in the dropdown — multiples, divisors, parity, primality, perfect squares and a simple inequality — cover most textbook exercises, and every one of them is printed back in correct notation so you can verify the translation before trusting the answer.

In this category

Embed

Quanta Pro

Paid features are coming later.

  • All 977 calculators remain free
  • No billing is enabled
Coming soon