Set Theory Calculator

List up to three sets and a universal set, then write an expression such as (A | B) & ~C with ordinary keyboard symbols. The Venn diagram shades the regions in the answer, places every element in its region, and prints the counting work underneath.

How many sets

Separate elements with commas. Braces are optional, repeats get dropped, and a blank field is the empty set.

Load a sample
In the expression resultRow you point at belowCircles are the same size whatever the counts.

Every region, element by element

Point at a row to outline the matching region on the diagram.

RegionNotationElementsCount

Standard operations

Press a row to load its expression and shade the result.

    Counting and relations

    How the diagram splits the numbers 1 to 10

    The default sample puts the even numbers in A, the multiples of 3 in B, and the primes in C. Three circles cut the rectangle into eight regions. Each number from 1 to 10 lands in exactly one.

    • Only A 4, 8, 10
    • Only B 9
    • Only C 5, 7
    • A ∩ B, outside C 6
    • A ∩ C, outside B 2
    • B ∩ C, outside A 3
    • All three none, since no prime is both even and a multiple of 3
    • Outside every circle 1, which is neither even, prime, nor a multiple of 3

    The starting expression, (A ∪ B) ∩ C′, asks for numbers which are even or a multiple of 3 but not prime. The answer is {4, 6, 8, 9, 10}. Three regions light up: only A, only B, and the A ∩ B sliver outside C.

    Expression syntax

    Set names are A, B, C, and U, in upper or lower case. Every operator has a keyboard stand-in, so you never need the symbol keys.

    OperationSymbolAlso acceptedKeeps elements
    UnionA ∪ B|+in either set
    IntersectionA ∩ B&*in both sets
    DifferenceA − B-\in A, missing from B
    Symmetric differenceA △ B^in exactly one of the two
    ComplementA′' after, ~ beforein U, outside A
    Empty set∅nonenothing

    Order of operations. Complement binds tightest, then ∩. Union, difference, and symmetric difference share one level and run left to right, so A − B ∪ C reads as (A − B) ∪ C. Textbooks disagree on these rules. Add brackets whenever a reader might stumble. A missing bracket or a stray symbol gets reported with its position.

    Counting a course survey with inclusion-exclusion

    The Course sign-ups sample tracks ten students across three short courses. A is Python, B is SQL, C is Excel. The question on most worksheets: how many students took at least one course?

    |A ∪ B ∪ C| = |A| + |B| + |C| − |A ∩ B| − |A ∩ C| − |B ∩ C| + |A ∩ B ∩ C|
    = 5 + 4 + 4 − 2 − 2 − 2 + 1
    = 8

    Omar sits in all three circles. The single-set terms count Omar three times, the pair terms remove Omar three times, and the triple term adds Omar back once. Dmitri and Nia signed up for nothing, so (A ∪ B ∪ C)′ returns {Dmitri, Nia}. The counting panel prints the same sum with your own numbers, ready to copy into a written answer.

    Checking De Morgan's laws

    The two laws say (A ∪ B)′ = A′ ∩ B′ and (A ∩ B)′ = A′ ∪ B′. Type the left side, read the result and the shaded regions, then type the right side. Both sides return the same set for any input. Run the check on your homework sets before writing the formal proof, and you will see which regions the proof has to cover.

    Where this calculator stops

    • Elements are text. 1, 01, and 1.0 are three different elements. Apple and apple differ too.
    • A comma always splits. An ordered pair such as (1,2) gets cut in two, which also rules out nested sets.
    • Three sets maximum. A four-set Venn diagram needs ellipses, and the regions turn too thin to label. For overlaps across four or more lists, the list intersection tool fits better.
    • Finite sets only. Set-builder notation like {x | x > 3} and infinite sets such as ℕ are not parsed.
    • Areas mean nothing. Every circle has the same radius. Read sizes from the Count column, not from the picture.
    • Crowded regions truncate. The diagram shows a few elements per region plus a +n marker. The region table lists all of them.
    • Complement depends on U. Leave U blank and every complement returns ∅. Elements in A, B, or C but missing from U get flagged under the inputs.

    Set theory questions from the worksheet

    Why does the complement of A come back empty?

    The complement of A is everything in U outside A. With U blank, or with U holding the same elements as A, nothing is left over. Fill U with the full range of the problem, such as 1 to 20 for a counting question.

    Is A - B the same as B - A?

    No. A - B keeps elements of A missing from B, and B - A keeps elements of B missing from A. With A = {2, 4, 6, 8, 10} and B = {3, 6, 9}, A - B is {2, 4, 8, 10} while B - A is {3, 9}. Only the symmetric difference treats both sides alike.

    How do I enter the empty set?

    Leave the field blank or type {}. Inside an expression, press the empty set key. A union with the empty set returns A, and an intersection with the empty set returns nothing.

    Does the order of elements matter?

    No. {3, 1, 2} and {1, 2, 3} are the same set. Results list numbers in numeric order and text in alphabetical order, and repeats are dropped as you type, with a note beside the field saying how many.

    How do I send a problem to a classmate?

    Press Copy link. The link stores all four sets, the two or three set mode, and the current expression, so the other person opens the same diagram with the same shading.

    Why does the power set list stop at six elements?

    A set with n elements has 2 to the power n subsets. Six elements give 64 subsets, a readable list. Ten elements give 1,024, so above six the counting panel reports the number of subsets without listing them.