Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Operations on Sets






Combining and Manipulating Sets


Set operations combine sets to form new sets. These operations — union, intersection, complement, difference, and symmetric difference — provide the tools for manipulating collections and form the basis for the algebraic rules that govern set theory. Visualizing these operations through Venn diagrams makes their behavior immediately clear.

Key Terms

Union— elements in at least one of the sets
Intersection— elements common to both sets
Complement— elements in the universal set but not in the given set
Set Difference— elements in one set but not the other
Symmetric Difference— elements in exactly one of two sets
Universal Set— reference set for the complement operation
Empty Set— identity element for union, annihilator for intersection

See All Set Theory Definitions →


Union

A school wants one list of everyone in the chess club or the music club.
The obvious move is to put the two club lists together.
Joining the two lists end to end gives 6 names for 5 people.
listnamescount
chess clubAna, Ben, Cara3
music clubCara, Dan, Eve3
both lists joined end to endAna, Ben, Cara, Cara, Dan, Eve6
everyone in either club, once eachAna, Ben, Cara, Dan, Eve5
Cara is in both clubs. A list of everyone in either club names her once.
Pooling two collections means taking each member once, whether it is in one collection or in both.
The word "or" here is inclusive — elements belonging to both sets are included. If A={1,2,3}A = \{1, 2, 3\} and B={3,4,5}B = \{3, 4, 5\}, then:
Union
A∪B={1,2,3,4,5}A \cup B = \{1, 2, 3, 4, 5\}
The element 33 appears in both sets but is listed only once in the union.
The definition
The union of sets AA and BB is the set A∪BA \cup B of elements that belong to AA, to BB, or to both.
The union of two sets AA and BB is the set of elements that belong to AA or BB or both:
Union
A∪B={x:x∈A or x∈B}A \cup B = \{x : x \in A \text{ or } x \in B\}
So the union of the two clubs is the set of 55 people: Ana, Ben, Cara, Dan and Eve.
Union behaves like addition: order and grouping do not matter, and it extends to any number of sets.
Union is commutative and associative:
Commutative Law - Union
A∪B=B∪AA \cup B = B \cup A
Learn more about this formula: Commutative Law - Union →
Associative Law - Union
(A∪B)∪C=A∪(B∪C)(A \cup B) \cup C = A \cup (B \cup C)
Learn more about this formula: Associative Law - Union →
For multiple sets, the union extends naturally:
Union
⋃i=1nAi=A1∪A2∪⋯∪An\bigcup_{i=1}^{n} A_i = A_1 \cup A_2 \cup \cdots \cup A_n
This contains every element that appears in at least one of the sets A1,A2,…,AnA_1, A_2, \ldots, A_n.
UAB
A ∪ B, frozen

Both circles shaded as one region: every element of A, of B, or of both — the inclusive “or” made visible. Watch the union highlight for sets you configure yourself on the two-set Venn explorer.

Everything that follows in set algebra — distributive laws, De Morgan's laws, inclusion–exclusion — begins with this simplest act of pooling two collections into one.
When sets overlap, the size of the union is not the sum of the sizes.
∣A∪B∣=∣A∣+∣B∣−∣A∩B∣|A \cup B| = |A| + |B| - |A \cap B|, here 3+3−1=53 + 3 - 1 = 5. The overlap is itself the next operation, intersection.
The rest of the page covers intersection, complement, set difference, symmetric difference and a summary of all five operations.

Intersection


The intersection of two sets AA and BB is the set of elements that belong to both AA and BB:

Intersection
A∩B={x:x∈A and x∈B}A \cap B = \{x : x \in A \text{ and } x \in B\}

If A={1,2,3}A = \{1, 2, 3\} and B={3,4,5}B = \{3, 4, 5\}, then:

Intersection
A∩B={3}A \cap B = \{3\}

When two sets have no elements in common, their intersection is the empty set, and the sets are called disjoint:

Intersection
A∩B=∅A \cap B = \emptyset

Pitfall: Writing the empty set in braces
Writing A∩B={∅}A \cap B = \{\emptyset\} for A={1,2}A = \{1, 2\} and B={3,4}B = \{3, 4\} names a set with one element, the empty set itself, so ∣{∅}∣=1|\{\emptyset\}| = 1. The intersection is ∅\emptyset, also written {}\{\}, with 00 elements.

Disjointness is read off the intersection directly.

Example
For A={1,2}A = \{1, 2\} and B={3,4}B = \{3, 4\}, no element of AA is also an element of BB, so the membership condition "x∈Ax \in A and x∈Bx \in B" is never met. The intersection is then the set with no elements at all, and its cardinality is 00.

Intersection is commutative and associative:

Commutative Law - Intersection
A∩B=B∩AA \cap B = B \cap A
Learn more about this formula: Commutative Law - Intersection →

Associative Law - Intersection
(A∩B)∩C=A∩(B∩C)(A \cap B) \cap C = A \cap (B \cap C)
Learn more about this formula: Associative Law - Intersection →


For multiple sets:

Intersection
⋂i=1nAi=A1∩A2∩⋯∩An\bigcap_{i=1}^{n} A_i = A_1 \cap A_2 \cap \cdots \cap A_n

This contains only elements that appear in every one of the sets A1,A2,…,AnA_1, A_2, \ldots, A_n.

Did you know: Nested, infinite, yet nothing shared
The intervals (0,1)(0, 1), (0,12)(0, \frac{1}{2}), (0,13)(0, \frac{1}{3}), …\ldots each hold infinitely many numbers and each lies inside the one before, yet their intersection is ∅\emptyset: any x>0x > 0 drops out once 1n≤x\frac{1}{n} \le x. With [0,1n][0, \frac{1}{n}] instead, the point 00 survives.

The definition does not stop at finitely many sets. A family A1,A2,A3,…A_1, A_2, A_3, \ldots with one set for every natural number nn has an intersection too: the elements that belong to AnA_n for every nn, with no exception. When each set lies inside the one before it, the family shrinks step by step. Each new set can only remove elements from the intersection, never add any, so the intersection is contained in every member of the family.
UAB
A ∩ B, frozen

Only the lens where the circles overlap is shaded — the elements A and B share. Switch to disjoint sets and watch this region empty out on the two-set Venn explorer.

Intersection is union's natural counterpart, and the interplay between the two — each distributing over the other — drives most of the algebra ahead.

Complement


The complement of a set AA consists of all elements not in AA. This operation requires a universal set UU that contains all elements under consideration:

Complement
Ac={x∈U:x∉A}A^c = \{x \in U : x \notin A\}

Alternative notations include A′A' and A‾\overline{A}.

If the universal set is U={1,2,3,4,5}U = \{1, 2, 3, 4, 5\} and A={1,2}A = \{1, 2\}, then:

Complement
Ac={3,4,5}A^c = \{3, 4, 5\}

The complement depends entirely on the choice of universal set. The same set AA has different complements relative to different universal sets.

Taking the complement twice returns the original set:

Double Complement Law
(Ac)c=A(A^c)^c = A
Learn more about this formula: Double Complement Law →


Two additional facts hold for any set AA:

Complement Law - Union
A∪Ac=UA \cup A^c = U
Learn more about this formula: Complement Law - Union →

Complement Law - Intersection
A∩Ac=∅A \cap A^c = \emptyset
Learn more about this formula: Complement Law - Intersection →


Every element either belongs to AA or to its complement, but not to both.
UAB
A′, frozen

Everything inside the universe U except circle A is shaded — the complement drawn against its reference set. Flip between A′, B′, and the De Morgan combinations on the two-set Venn explorer.

Complementation is the only unary operation of the five, and the bridge between set algebra and logic: it is negation, drawn as a region.

Set Difference


The set difference A∖BA \setminus B (also written A−BA - B) contains all elements that belong to AA but not to BB:

Set Difference
A∖B={x:x∈A and x∉B}A \setminus B = \{x : x \in A \text{ and } x \notin B\}

If A={1,2,3,4}A = \{1, 2, 3, 4\} and B={3,4,5}B = \{3, 4, 5\}, then:

Set Difference
A∖B={1,2}A \setminus B = \{1, 2\}

Set Difference
B∖A={5}B \setminus A = \{5\}

RULE
Unlike union and intersection, set difference is not commutative — the order of AA and BB matters.

Pitfall: Subtracting the sizes
Taking ∣A∖B∣=∣A∣−∣B∣=4−3=1|A \setminus B| = |A| - |B| = 4 - 3 = 1 also removes the 55, which is not in AA. Only the shared elements 33 and 44 go: ∣A∖B∣=∣A∣−∣A∩B∣=4−2=2|A \setminus B| = |A| - |A \cap B| = 4 - 2 = 2.

The difference is built one element of AA at a time. In the example, 11 and 22 are not in BB and stay, while 33 and 44 are in BB and are removed. The elements of BB serve only as a list of what to take out of AA, and the result is always a subset of AA.

Set difference relates to complement: when B⊆UB \subseteq U, the complement BcB^c equals U∖BU \setminus B. More generally:

Difference as Intersection with Complement
A∖B=A∩BcA \setminus B = A \cap B^c
Learn more about this formula: Difference as Intersection with Complement →


This expresses difference as an intersection with a complement.

Did you know: Difference builds intersection, not union
The {3,4}\{3, 4\} left over is exactly A∩BA \cap B: in general A∖(A∖B)=A∩BA \setminus (A \setminus B) = A \cap B. Union is out of reach, though: a formula built only from differences stays inside its first set, and A∪BA \cup B usually does not.

Differences can also be stacked, with one difference taken out of a set. In the example, A∖B={1,2}A \setminus B = \{1, 2\}, and removing these two elements from AA in turn leaves A∖(A∖B)={3,4}A \setminus (A \setminus B) = \{3, 4\}. Each stacked difference is still worked out one element at a time, by asking at every step whether the element lies in the set being removed, and no complement or universal set is needed along the way.
UAB
A ∖ B, frozen

Only the crescent of A lying outside B is shaded: the elements of A that are not in B. Compare it with B ∖ A — the opposite crescent — on the two-set Venn explorer.

The identity A∖B=A∩BcA \setminus B = A \cap B^c is worth internalizing — it turns every difference into an intersection, whose algebra you already know.

Symmetric Difference


The symmetric difference of AA and BB contains elements that belong to exactly one of the two sets:

Symmetric Difference
A△B=(A∖B)∪(B∖A)A \triangle B = (A \setminus B) \cup (B \setminus A)

An equivalent definition uses union and intersection:

Symmetric Difference - Union Minus Intersection
A△B=(A∪B)∖(A∩B)A \triangle B = (A \cup B) \setminus (A \cap B)


If A={1,2,3}A = \{1, 2, 3\} and B={3,4,5}B = \{3, 4, 5\}, then:

Symmetric Difference
A△B={1,2,4,5}A \triangle B = \{1, 2, 4, 5\}

The element 33 belongs to both sets, so it is excluded from the symmetric difference.

Symmetric difference is commutative and associative:

Symmetric Difference
A△B=B△AA \triangle B = B \triangle A

Symmetric Difference
(A△B)△C=A△(B△C)(A \triangle B) \triangle C = A \triangle (B \triangle C)

Pitfall: Keeping only elements in exactly one set
Reading A△B△CA \triangle B \triangle C as the elements in exactly one of the three sets gives {1,2,4,6}\{1, 2, 4, 6\} and drops the 33, which is in all three. Step by step, {1,2,4,5}△{3,5,6}={1,2,3,4,6}\{1, 2, 4, 5\} \triangle \{3, 5, 6\} = \{1, 2, 3, 4, 6\}: the elements in an odd number of the sets.

Because the operation is associative, A△B△CA \triangle B \triangle C can be written without parentheses and computed in either grouping. With A={1,2,3}A = \{1, 2, 3\}, B={3,4,5}B = \{3, 4, 5\} and C={3,5,6}C = \{3, 5, 6\}, the first step gives A△B={1,2,4,5}A \triangle B = \{1, 2, 4, 5\}, and the second step compares this set with CC element by element.

The symmetric difference with the empty set leaves a set unchanged: A△∅=AA \triangle \emptyset = A. The symmetric difference of a set with itself is empty: A△A=∅A \triangle A = \emptyset.
UAB
A △ B, frozen

Both crescents shaded with the shared lens carved out: the elements belonging to exactly one of the two sets. See how it equals (A ∖ B) ∪ (B ∖ A) on the two-set Venn explorer.

With symmetric difference the toolkit is complete: five operations, closed over sets, ready for the algebraic rules that organize them.

Set Operation Notation

Notation

Set Operation Notation

Five operations, six marks, and more glyph collisions than any other page in the section: the cup and cap, a complement with three spellings, two ways to subtract sets, and a triangle already working three other jobs elsewhere.
The braces, set-builder bar, ∈\in and ∅\varnothing inside every definition come from set theory basics; the containment marks from the subsets page.
∪\cup · ∩\cap
union; intersection
The cup collects, the cap filters: A∪BA \cup B holds members of either set, A∩BA \cap B only members of both — Union and Intersection above. The cup opens upward "to hold everything", the standard hook for keeping them apart.
CasesChains of sets grow the marks into big operators with index bounds — ⋃i=1nAi\bigcup_{i=1}^{n} A_i, the same enlarging habit Σ\Sigma has; the shapes deliberately mirror logic's or (∨\vee) and and (∧\wedge), catalogued with the logic symbols.
Do not confuseEach other, by rotation. A flipped glance swaps "either" for "both" — and a domain built with ∩\cap by reflex is usually empty, the error domain notation warns about from the other side.
AcA^c · A′A' · A‾\overline{A}
the complement of A
One operation, three spellings: the superscript cc (this site's choice), the prime, and the overbar — all meaning "everything in UU that is not in AA", as Complement above defines. The mark is meaningless until the universal set is fixed.
CasesThis site's interactive explorers use the prime form A′A' — expect both when moving between pages; the overbar dominates probability, where complements of events are everywhere.
Do not confuseThe other bars and primes. A‾\overline{A} shares its stroke with the complex conjugate and the sample mean; A′A' with the derivative prime — the object under the mark (a set) is the only tell.
A∖BA \setminus B
A minus B; the difference of A and B
Subtraction for sets: everything in AA that is not in BB — Set Difference above. The backslash is the set-specific spelling; A−BA - B borrows the arithmetic minus for the same job.
CasesOrder matters — A∖B≠B∖AA \setminus B \neq B \setminus A in general; against a universal set the difference becomes complement, U∖B=BcU \setminus B = B^c, and domain notation writes "all reals except 2" as R∖{2}\mathbb{R} \setminus \{2\} with exactly this mark.
Do not confuseThe division slash. ∖\setminus leans backward, // forward — and unlike numeric subtraction, removing elements never produces "negative" members: subtracting what is not there does nothing.
A△BA \triangle B
the symmetric difference of A and B
The either-but-not-both operation: A△BA \triangle B keeps elements of exactly one set — the shared members drop out, as Symmetric Difference above shows. Logic knows the pattern as exclusive or.
CasesTwo equivalent spellings mirror the two definitions: (A∖B)∪(B∖A)(A \setminus B) \cup (B \setminus A) and (A∪B)∖(A∩B)(A \cup B) \setminus (A \cap B) — one collects the private parts, the other removes the shared core.
Same glyph elsewhereThe triangle's fourth job: Δ\Delta already means increment in calculus, the discriminant in algebra, and the determinant in older linear-algebra texts — between two sets it is an operator, not a quantity.
DownloadPNG2×PDF
Notation · Cheat sheet
Set Notation at a Glance
The marks from the notation cards across the set-theory pages: how each is read and what it means. Every group links to the full card on its page.
Basics
{1,2,3}\{1, 2, 3\}
the set of one, two, three
Roster form: order and repeats carry no meaning.
{x∣x>0}\{x \mid x > 0\}
all x such that x is positive
Set-builder form: a variable, the bar, a condition.
∈,  ∉\in, \; \notin
is / is not an element of
Membership, and its denial with a slash.
∅\varnothing
the empty set
The set with no members; also written {}\{\}.
Subsets
⊆,  ⊂\subseteq, \; \subset
subset; proper subset
The underbar allows A=BA = B; without it, A≠BA \neq B.
⊇,  ⊃\supseteq, \; \supset
superset
The same facts read from the larger set.
P(A),  2A\mathcal{P}(A), \; 2^A
the power set of A
The set of all subsets of AA.
N⊂Z⊂Q⊂R\mathbb{N} \subset \mathbb{Z} \subset \mathbb{Q} \subset \mathbb{R}
the number systems
Naturals, integers, rationals, reals.
Set operationsThis page
∪,  ∩\cup, \; \cap
union; intersection
In either set; in both sets.
Ac,  A′,  A‾A^c, \; A', \; \overline{A}
the complement of A
Everything in the universal set UU outside AA.
A∖BA \setminus B
A minus B
In AA but not in BB; also written A−BA - B.
A△BA \triangle B
symmetric difference
In exactly one of the two sets.
Cardinality
∣A∣|A|
the cardinality of A
The number of members: ∣{1,2,3}∣=3|\{1, 2, 3\}| = 3.
ℵ0\aleph_0
aleph-null
The size of N\mathbb{N} and every countably infinite set.
c=2ℵ0\mathfrak{c} = 2^{\aleph_0}
the continuum
The size of R\mathbb{R}, larger than ℵ0\aleph_0.
Same marks, different job
∣A∣|A|A count for a set; an absolute value for a number; a determinant for a matrix.
⊂\subsetProper subset here; some books use it for any subset.
2A2^AThe power set when AA is a set, not a number raised to a power.
{x}\{x\}A one-element set here; the fractional part of xx in arithmetic.
Set Notation at a Glance·/set-theory/basicsLearn Math Class

Common Pitfalls

Three mistakes come up often when the operations are carried out by hand. Each is marked where it happens in the sections above; here each is worked through in full, with the wrong and the right working side by side.
DownloadPNG2×PDF
1Writing the empty set in braces
When two sets share no elements, their intersection is written as {∅}\{\emptyset\} instead of ∅\emptyset. The braces turn the empty set into an element, so the answer becomes a set with one element instead of a set with none.
Start
For A={1,2}A = \{1, 2\} and B={3,4}B = \{3, 4\},
Wrong turn
Error here
No element is shared, so A∩B={∅}A \cap B = \{\emptyset\}.
Right path
No xx satisfies both x∈Ax \in A and x∈Bx \in B, so the intersection has no elements: A∩B=∅A \cap B = \emptyset, also written {}\{\}. The set {∅}\{\emptyset\} is a different set: its one element is ∅\emptyset, so ∣{∅}∣=1|\{\emptyset\}| = 1 while ∣∅∣=0|\emptyset| = 0.
Why it happensAnswers are usually written inside braces, such as A∩B={3}A \cap B = \{3\}, and the empty answer gets braces by the same habit. The symbol ∅\emptyset already stands for a whole set.
How to checkA∩BA \cap B is always a subset of AA. Here ∅\emptyset is not an element of A={1,2}A = \{1, 2\}, so {∅}\{\emptyset\} is not a subset of AA and cannot be A∩BA \cap B.
2Subtracting the sizes
The size of A∖BA \setminus B is found as ∣A∣−∣B∣|A| - |B|, as if every element of BB were taken out of AA. Elements of BB that are not in AA have nothing to remove, so the count comes out too small.
Start
For A={1,2,3,4}A = \{1, 2, 3, 4\} and B={3,4,5}B = \{3, 4, 5\},
Wrong turn
Error here
The size is given as ∣A∖B∣=4−3=1|A \setminus B| = 4 - 3 = 1.
Right path
Only 33 and 44 are in both sets, so A∖B={1,2}A \setminus B = \{1, 2\} and ∣A∖B∣=∣A∣−∣A∩B∣=4−2=2|A \setminus B| = |A| - |A \cap B| = 4 - 2 = 2.
Why it happensThe alternative notation A−BA - B looks like subtraction of numbers, where every unit of the second amount is taken away.
How to checkList the elements of the result instead of computing its size. The size formula can even give a negative number: for {1}∖{2,3}\{1\} \setminus \{2, 3\} it gives 1−2=−11 - 2 = -1, while the difference is {1}\{1\}, with 11 element.
3Keeping only elements in exactly one set
The two-set description, "elements in exactly one of AA or BB", is carried over to three sets. For A△B△CA \triangle B \triangle C this drops the elements that belong to all three sets.
Start
With A={1,2,3}A = \{1, 2, 3\}, B={3,4,5}B = \{3, 4, 5\} and C={3,5,6}C = \{3, 5, 6\},
Wrong turn
Error here
The elements in exactly one set are 1,2,41, 2, 4 and 66, so A△B△CA \triangle B \triangle C is given as {1,2,4,6}\{1, 2, 4, 6\}.
Right path
A△B={1,2,4,5}A \triangle B = \{1, 2, 4, 5\}, and {1,2,4,5}△{3,5,6}={1,2,3,4,6}\{1, 2, 4, 5\} \triangle \{3, 5, 6\} = \{1, 2, 3, 4, 6\}. The element 33 is removed in the first step, because it is in both AA and BB, and comes back in the second, because it is in CC but no longer in A△BA \triangle B. The element 55 is in A△BA \triangle B and in CC, so it is removed.
Why it happensFor two sets, "in exactly one" and "in an odd number" of the sets mean the same thing, so the difference shows only with three or more sets.
How to checkCount for each element how many of the sets contain it; the element stays when that count is odd. Here 33 is in three sets and stays, 55 is in two and goes. The other grouping gives the same answer: B△C={4,6}B \triangle C = \{4, 6\} and {1,2,3}△{4,6}={1,2,3,4,6}\{1, 2, 3\} \triangle \{4, 6\} = \{1, 2, 3, 4, 6\}.
Common pitfalls with set operations·/set-theory/operationsLearn Math Class
All three slips work with sizes or labels instead of the elements themselves. An intersection with nothing in common is ∅\emptyset, not {∅}\{\emptyset\}; ∣A∖B∣|A \setminus B| subtracts only the shared elements; and a symmetric difference of three sets keeps the elements that lie in an odd number of them. Listing the elements of the result, and counting how many sets hold each one, catches every slip.

Summary: All Five Operations at a Glance

This summary sets out the five operations of the page, one family each; the buttons above the cards show one family at a time. A line under each name says which elements the operation keeps, gives other ways its notation is written, names any identity element and links to its section.

Each family opens with the definition beside its result on one shared example in a universal set of the numbers one to five. Union, intersection and symmetric difference show their commutative and associative laws. The complement adds the double complement and two complement laws, and set difference becomes an intersection with a complement.
DownloadPNG2×PDF
Union4 formulas
Keeps the elements that belong to AA or BB, the inclusive or; its identity element is ∅\emptyset. Union defines it and states its laws.
A∪B={x:x∈A or x∈B}A \cup B = \{x : x \in A \text{ or } x \in B\}
An element that lies in both sets is taken once.
A∪B={1,2,3,4,5}A \cup B = \{1, 2, 3, 4, 5\}
The result for A={1,2,3}A = \{1, 2, 3\} and B={3,4,5}B = \{3, 4, 5\}.
A∪B=B∪AA \cup B = B \cup A
Commutative: the order of the two sets does not matter.
(A∪B)∪C=A∪(B∪C)(A \cup B) \cup C = A \cup (B \cup C)
Associative: the brackets can move freely.
Intersection5 formulas
Keeps the elements that belong to both AA and BB; its identity element is UU. Intersection defines it and states its laws.
A∩B={x:x∈A and x∈B}A \cap B = \{x : x \in A \text{ and } x \in B\}
Only the shared elements survive.
A∩B={3}A \cap B = \{3\}
The result for A={1,2,3}A = \{1, 2, 3\} and B={3,4,5}B = \{3, 4, 5\}.
A∩B=B∩AA \cap B = B \cap A
Commutative: the order of the two sets does not matter.
(A∩B)∩C=A∩(B∩C)(A \cap B) \cap C = A \cap (B \cap C)
Associative: the brackets can move freely.
A∩B=∅A \cap B = \emptyset
The result when AA and BB are disjoint.
Complement5 formulas
Keeps the elements of UU that are not in AA, from one set only; also written A′A', A‾\overline{A} or U∖AU \setminus A. See complement.
Ac={x∈U:x∉A}A^c = \{x \in U : x \notin A\}
The complement depends on the universal set UU.
Ac={4,5}A^c = \{4, 5\}
The result for A={1,2,3}A = \{1, 2, 3\} in U={1,2,3,4,5}U = \{1, 2, 3, 4, 5\}.
(Ac)c=A(A^c)^c = A
Taking the complement twice returns the original set.
A∪Ac=UA \cup A^c = U
A set and its complement together fill the universal set.
A∩Ac=∅A \cap A^c = \emptyset
A set and its complement share no element.
Set difference3 formulas
Keeps the elements that are in AA but not in BB; also written A−BA - B. See set difference.
A∖B={x:x∈A and x∉B}A \setminus B = \{x : x \in A \text{ and } x \notin B\}
Elements are only ever taken away from AA.
A∖B={1,2},B∖A={4,5}A \setminus B = \{1, 2\}, \quad B \setminus A = \{4, 5\}
For A={1,2,3}A = \{1, 2, 3\} and B={3,4,5}B = \{3, 4, 5\} the two orders differ, so difference is not commutative.
A∖B=A∩BcA \setminus B = A \cap B^c
A difference is an intersection with a complement.
Symmetric difference6 formulas
Keeps the elements that are in exactly one of AA and BB; its identity element is ∅\emptyset. See symmetric difference.
A△B=(A∖B)∪(B∖A)A \triangle B = (A \setminus B) \cup (B \setminus A)
What each set has that the other lacks.
A△B=(A∪B)∖(A∩B)A \triangle B = (A \cup B) \setminus (A \cap B)
The same set: the union with the overlap removed.
A△B={1,2,4,5}A \triangle B = \{1, 2, 4, 5\}
The result for A={1,2,3}A = \{1, 2, 3\} and B={3,4,5}B = \{3, 4, 5\}.
A△A=∅A \triangle A = \emptyset
A set leaves nothing when compared with itself.
A△B=B△AA \triangle B = B \triangle A
Commutative: the order of the two sets does not matter.
(A△B)△C=A△(B△C)(A \triangle B) \triangle C = A \triangle (B \triangle C)
Associative: the brackets can move freely.
Set operations and their laws·All set theory formulasLearn Math Class
The definitions are the safest test of any law: pick one element, see where it sits, and follow it through both sides. Union, intersection and symmetric difference can be reordered and regrouped freely, while set difference cannot, so its order has to be kept as written.
The same shared example as a picture: pick an operation to shade the regions it keeps, or click regions to build a set of your own.
DownloadPNG2×PDF
ABU12453
UnionA∪BA \cup B
Elements thatbelong to AA or BB, the inclusive or
DefinitionA∪B={x:x∈A or x∈B}A \cup B = \{x : x \in A \text{ or } x \in B\}
ResultA∪B={1,2,3,4,5}A \cup B = \{1, 2, 3, 4, 5\}
Key propertiescommutative and associative; identity element ∅\emptyset
A={1,2,3}A = \{1, 2, 3\}, B={3,4,5}B = \{3, 4, 5\}, U={1,2,3,4,5}U = \{1, 2, 3, 4, 5\}Click a region of the diagram to add or remove it.
The five operations on one Venn diagram·/set-theory/operationsLearn Math Class

Skills You Should Learn

Each skill opens its step-by-step method page.
Set theory methods
  • Find the union of two setsSingle ruleThe question asks for the elements in one set or the other, or both: A∪BA \cup B, "in at least one of the sets", "everyone on either team".
  • Find the intersection of two setsSingle ruleThe question asks for the elements in both sets: A∩BA \cap B, "common to", "in AA and in BB". If nothing is shared, the answer is ∅\emptyset.
  • Find the difference of two setsSingle ruleThe question asks for the elements of one set that are not in another: A∖BA \setminus B (also written A−BA - B), "in AA but not in BB". Order matters.
  • Find the complement of a setSingle ruleThe question asks for everything not in a set, relative to a universal set UU: AcA^c, "not in AA", "outside the circle". Without a stated UU the complement is not defined.
  • Find the symmetric difference of two setsSingle ruleThe question asks for the elements in exactly one of two sets: A△BA \triangle B, "in AA or in BB but not in both".

Set Operations FAQ

What is the difference between union and intersection?

+
Union collects, intersection filters. A ∪ B holds every element belonging to A or B or both, so it is at least as large as either set. A ∩ B holds only the elements the two sets share, so it is no larger than either. Shade both regions on the two-set Venn explorer to compare them directly.Read more →

What are the different symbols for the complement of a set?

+
Three spellings mean the same thing: Aᶜ with a superscript c, A′ with a prime, and Ā with an overbar. All denote every element of the universal set U that is not in A. This site writes Aᶜ in prose and A′ in the interactive tools; probability texts prefer the overbar. See all set theory symbols.Read more →

Is set difference commutative?

+
No. A \ B keeps the elements of A that are not in B, while B \ A keeps the elements of B that are not in A — two different sets. With A = {1, 2, 3} and B = {3, 4, 5}, A \ B is {1, 2} and B \ A is {4, 5}. Union and intersection are commutative; difference is not.Read more →

How does set difference relate to complement?

+
Every difference is an intersection in disguise: A \ B = A ∩ Bᶜ. Removing the elements of B from A is the same as keeping the elements of A that lie in the complement of B. The identity matters because it turns difference, the one non-commutative operation, into intersection, whose algebra is already familiar.Read more →

Can an intersection of infinitely many infinite sets be empty?

+
Yes. The intervals (0,1)(0, 1), (0,12)(0, \frac{1}{2}), (0,13)(0, \frac{1}{3}), and so on each hold infinitely many numbers, and each lies inside the one before, yet no number is in all of them. Any x>0x > 0 drops out as soon as 1n≤x\frac{1}{n} \le x, and no x≤0x \le 0 was ever in. With the closed intervals [0,1n][0, \frac{1}{n}] instead, the point 00 survives and the intersection is {0}\{0\}.Read more →

Can union be written using only set difference?

+
No. Every difference X∖YX \setminus Y is a subset of XX, so any formula built only from differences stays inside its first set, while A∪BA \cup B usually reaches outside AA. Intersection, by contrast, can be built this way: A∖(A∖B)=A∩BA \setminus (A \setminus B) = A \cap B. With A={1,2,3,4}A = \{1, 2, 3, 4\} and B={3,4,5}B = \{3, 4, 5\}, removing A∖B={1,2}A \setminus B = \{1, 2\} from AA leaves {3,4}\{3, 4\}.Read more →

What does A△B△CA \triangle B \triangle C contain?

+
The elements that lie in an odd number of the three sets: exactly one of them, or all three. It is not just the elements in exactly one set. With A={1,2,3}A = \{1, 2, 3\}, B={3,4,5}B = \{3, 4, 5\} and C={3,5,6}C = \{3, 5, 6\}, the result is {1,2,3,4,6}\{1, 2, 3, 4, 6\}: the 33 is in all three sets and stays, while the 55 is in two and drops out. The grouping does not matter, since the operation is associative.Read more →