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

Unionelements in at least one of the sets
Intersectionelements common to both sets
Complementelements in the universal set but not in the given set
Set Differenceelements in one set but not the other
Symmetric Differenceelements in exactly one of two sets
Universal Setreference set for the complement operation
Empty Setidentity element for union, annihilator for intersection

See All Set Theory Definitions


Union


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

AB={x:xA or xB}A \cup B = \{x : x \in A \text{ or } x \in B\}


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:

AB={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.

Union is commutative and associative:

AB=BAA \cup B = B \cup A


(AB)C=A(BC)(A \cup B) \cup C = A \cup (B \cup C)


For multiple sets, the union extends naturally:

i=1nAi=A1A2An\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.

Intersection


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

AB={x:xA and xB}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:

AB={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:

AB=A \cap B = \emptyset


Intersection is commutative and associative:

AB=BAA \cap B = B \cap A


(AB)C=A(BC)(A \cap B) \cap C = A \cap (B \cap C)


For multiple sets:

i=1nAi=A1A2An\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.
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:

Ac={xU:xA}A^c = \{x \in U : x \notin A\}


Alternative notations include AA' 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:

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:

(Ac)c=A(A^c)^c = A


Two additional facts hold for any set AA:

AAc=UA \cup A^c = U


AAc=A \cap A^c = \emptyset


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 ABA \setminus B (also written ABA - B) contains all elements that belong to AA but not to BB:

AB={x:xA and xB}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:

AB={1,2}A \setminus B = \{1, 2\}


BA={5}B \setminus A = \{5\}


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

Set difference relates to complement: when BUB \subseteq U, the complement BcB^c equals UBU \setminus B. More generally:

Difference as Intersection with Complement
AB=ABcA \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.
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 AB=ABcA \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:

AB=(AB)(BA)A \triangle B = (A \setminus B) \cup (B \setminus A)


An equivalent definition uses union and intersection:

Symmetric Difference - Union Minus Intersection
AB=(AB)(AB)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:

AB={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:

AB=BAA \triangle B = B \triangle A


(AB)C=A(BC)(A \triangle B) \triangle C = A \triangle (B \triangle C)


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: AA=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: ABA \cup B holds members of either set, ABA \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 · AA' · 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 AA' — 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; AA' with the derivative prime — the object under the mark (a set) is the only tell.
ABA \setminus B
A minus B; the difference of A and B
Subtraction for sets: everything in AA that is not in BBSet Difference above. The backslash is the set-specific spelling; ABA - B borrows the arithmetic minus for the same job.
CasesOrder matters — ABBAA \setminus B \neq B \setminus A in general; against a universal set the difference becomes complement, UB=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.
ABA \triangle B
the symmetric difference of A and B
The either-but-not-both operation: ABA \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: (AB)(BA)(A \setminus B) \cup (B \setminus A) and (AB)(AB)(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.

Summary: All Five Operations at a Glance


The five operations introduced above share a uniform structure: each consumes one or two sets and returns a new set, defined by a precise membership condition. The capstone table below collects them all in one place — every operation with its notation, its membership rule, the result on a single worked example (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\}), and its key algebraic properties.
Operation Notation Elements that... Result on A = {1, 2, 3},  B = {3, 4, 5},  U = {1, ..., 5} Key properties
Union A ∪ B belong to A or B  (inclusive or) {1, 2, 3, 4, 5} commutative, associative;  identity = ∅
Intersection A ∩ B belong to both A and B {3} commutative, associative;  identity = U;  empty if A, B disjoint
Complement Ac  (also A',  A,  or U \ A) are in U but not in A  (unary operation) Ac = {4, 5} (Ac)c = A;  A ∪ Ac = U;  A ∩ Ac = ∅
Set difference A \ B  (also A − B) are in A but not in B A \ B = {1, 2};  B \ A = {4, 5} NOT commutative;  A \ B = A ∩ Bc
Symmetric difference A △ B are in exactly one of A or B {1, 2, 4, 5} commutative, associative;  identity = ∅;  A △ A = ∅

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 →