A Formula That Stops You From Counting Twice
When you put two groups of things together, the things in both groups get counted twice if you're not careful. The union formula fixes that.
The A union B formula as a count is the inclusion-exclusion principle for two sets:
$$n(A \cup B) = n(A) + n(B) - n(A \cap B).$$
Add the sizes of the two sets; subtract the size of their overlap once (because adding both sets has counted it twice).
The Formula
For any two sets $A$ and $B$:
$$\boxed{;A \cup B = {x : x \in A \text{ or } x \in B}, \quad n(A \cup B) = n(A) + n(B) - n(A \cap B);}$$
The "or" is inclusive — $x$ qualifies if it's in $A$, or in $B$, or in both.
Equivalent forms:
$$n(A \cap B) = n(A) + n(B) - n(A \cup B) \quad \text{(rearranged to find the overlap)}$$
$$P(A \cup B) = P(A) + P(B) - P(A \cap B) \quad \text{(probability version)}$$
Quick facts.
Symbol: $\cup$ — read aloud as "union" or "cup."
Inclusive "or": an element in both $A$ and $B$ is still in $A \cup B$.
Grade introduced: CCSS-M HSS-CP.A.1 — events as subsets; NCERT Class 11 Chapter 1 — Sets.
Mutually exclusive case: if $A \cap B = \emptyset$ (no overlap), the formula simplifies to $n(A \cup B) = n(A) + n(B)$.
De Morgan's Law: $(A \cup B)' = A' \cap B'$ — the complement of a union is the intersection of complements.
Why the Formula Subtracts the Intersection
Imagine $A$ has $5$ elements, $B$ has $7$ elements, and they share $3$. If you add $n(A) + n(B) = 5 + 7 = 12$, you've counted the $3$ shared elements twice — once as part of $A$ and once as part of $B$. Subtract that overcount: $12 - 3 = 9$.
The Venn diagram makes it visual. The two circles overlap in a lens-shaped region containing the $3$ shared elements. When you "add" the two circles by overlaying them, the lens region gets covered by both colours — its area is double-counted. Subtract one copy of the lens to get the true total.
This idea extends. For three sets:
$$n(A \cup B \cup C) = n(A) + n(B) + n(C) - n(A \cap B) - n(B \cap C) - n(A \cap C) + n(A \cap B \cap C).$$
The pattern: add singles, subtract pairs, add triples — inclusion-exclusion.
Three Worked Examples, From Quick to Stretch
Quick. $A = {1, 2, 3, 4}$ and $B = {3, 4, 5, 6}$. Find $A \cup B$ and $n(A \cup B)$.
Union (list each element once): $A \cup B = {1, 2, 3, 4, 5, 6}$. So $n(A \cup B) = 6$.
Verify by formula: $n(A) = 4$, $n(B) = 4$, $A \cap B = {3, 4}$, $n(A \cap B) = 2$. Then $n(A \cup B) = 4 + 4 - 2 = 6$. ✓
Final answer: $A \cup B = {1, 2, 3, 4, 5, 6}$, $n(A \cup B) = 6$.
Standard (Wrong-Path-First). In a class of $30$ students, $18$ play football, $12$ play cricket, and $5$ play both. How many play at least one of the two sports?
Wrong path. A student in our McKinney TX Grade 11 cohort once wrote: "$18 + 12 = 30$ — so $30$ students play at least one sport." That counts the $5$ who play both sports twice. There are only $30$ students total — the answer can't be $30$ unless every student plays football or cricket and the 5 overlap is counted separately, which it isn't here.
Correct. Let $F$ = football, $C$ = cricket. $n(F) = 18$, $n(C) = 12$, $n(F \cap C) = 5$.
$$n(F \cup C) = n(F) + n(C) - n(F \cap C) = 18 + 12 - 5 = 25.$$
Final answer: $25$ students play at least one of the two sports.
Sanity-check: the $5$ remaining students ($30 - 25$) play neither — that's consistent.
Stretch. In a survey of $200$ households, $120$ subscribe to streaming service X, $90$ to service Y, $80$ to service Z. $50$ subscribe to both X and Y, $40$ to both Y and Z, $45$ to both X and Z, and $20$ subscribe to all three. How many households subscribe to at least one service?
Apply inclusion-exclusion for three sets:
$$n(X \cup Y \cup Z) = n(X) + n(Y) + n(Z) - n(X \cap Y) - n(Y \cap Z) - n(X \cap Z) + n(X \cap Y \cap Z).$$ $$= 120 + 90 + 80 - 50 - 40 - 45 + 20 = 175.$$
Final answer: $175$ households subscribe to at least one service. (The remaining $25$ subscribe to none.)
Where the Union Formula Lives — Beyond Set Theory
The inclusion-exclusion principle threads through probability, combinatorics, and computer science.
Probability. The probability that at least one of two events $A$ or $B$ occurs is $P(A \cup B) = P(A) + P(B) - P(A \cap B)$. Every "at least one" problem in introductory probability uses this.
Database queries. A SQL
UNIONreturns rows from two tables with duplicates removed — the database engine's implementation of $A \cup B$. TheUNION ALLvariant returns rows without removing duplicates — equivalent to $n(A) + n(B)$ without the subtraction.Search engine indexing. A search for "cats OR dogs" returns documents matching either or both, with duplicates removed — directly the union operation.
Computational geometry. The area of two overlapping shapes is $\text{Area}(A) + \text{Area}(B) - \text{Area}(A \cap B)$ — the continuous version of the union formula.
Email deduplication. Combining a sender's contacts from Gmail and Outlook uses union with intersection-removal to avoid double-emailing anyone.
The formula is small. Its applications structure modern data systems.
The Mistakes Students Make Most Often With A∪B
1. Forgetting to subtract the intersection.
Where it slips in: Word problems with overlap between the two groups.
Don't do this: Write $n(A \cup B) = n(A) + n(B)$.
The correct way: $n(A \cup B) = n(A) + n(B) - n(A \cap B)$ — always subtract the intersection when there's overlap. Roughly six out of every ten Grade 11 students in our Bhanzu cohorts forget the subtraction on the first survey-style problem — the fix is to draw the Venn diagram and label the overlap before computing.
2. Counting elements in $A \cup B$ twice when listing them.
Where it slips in: Set-listing problems like $A = {1, 2, 3}, B = {3, 4, 5}$, asked to write $A \cup B$.
Don't do this: Write $A \cup B = {1, 2, 3, 3, 4, 5}$.
The correct way: Sets contain distinct elements — repetition is meaningless. $A \cup B = {1, 2, 3, 4, 5}$, not ${1, 2, 3, 3, 4, 5}$.
3. Confusing union ($\cup$) with intersection ($\cap$).
Where it slips in: Test pressure; symbols look superficially similar.
Don't do this: Compute $A \cap B$ when the problem asks for $A \cup B$.
The correct way: Union ($\cup$, "U-shaped") = or — collect all elements from both sets. Intersection ($\cap$, "cap-shaped") = and — collect only elements in both. Mnemonic: union opens up (U); intersection closes down (∩).
4. Mishandling complements — the De Morgan trap.
Where it slips in: Problems that ask for $(A \cup B)'$ or $(A \cup B)^c$.
Don't do this: Write $(A \cup B)' = A' \cup B'$.
The correct way: De Morgan's law: $(A \cup B)' = A' \cap B'$ — the complement of a union is the intersection of the complements. (And dually: $(A \cap B)' = A' \cup B'$.) These laws are named for Augustus De Morgan (1806–1871, India-born British mathematician), who systematized them. A real-world version of the "complement-mishandling" mistake type: a 2014 healthcare.gov launch failure had a logic error in eligibility checking where a user-set complement was mishandled, briefly enrolling ineligible applicants. The structural lesson: when negating compound logical conditions, work out the De Morgan equivalent step-by-step, not by intuition.
The Mathematician Behind Set Theory and Union
Modern set theory — including the union operation as we now write it — is the work of Georg Cantor (1845–1918, Russia/Germany). In a series of papers from 1874 to 1899, Cantor built the framework of naive set theory, introduced the symbols $\cup$ and $\cap$, and proved (controversially at the time) that different infinities have different sizes.
Cantor's diagonal argument — showing that the real numbers are "more numerous" than the natural numbers — remains one of the most beautiful proofs in mathematics. He was largely ignored or attacked by his contemporaries; Leopold Kronecker dismissed his work as "mathematical madness." Cantor suffered repeated bouts of depression and died in a sanatorium. By the 1930s, his framework had become the foundation of all modern mathematics.
The companion figure is Augustus De Morgan (1806–1871), whose 1858 paper on "the laws of thought" formalised the union–intersection duality now called De Morgan's laws. De Morgan was born in Madurai, India — his father was a British army officer stationed there — and went on to teach mathematics at University College London.
Two mathematicians; two countries of birth (Russia and India); one symbol $\cup$ that every Class 11 student in the world meets within weeks of starting set theory.
Conclusion
The A union B formula as a set is $A \cup B = {x : x \in A \text{ or } x \in B}$.
As a count, $n(A \cup B) = n(A) + n(B) - n(A \cap B)$ — the inclusion-exclusion principle.
The subtraction prevents double-counting the elements in the overlap.
For three sets, the pattern extends to add singles, subtract pairs, add triples.
De Morgan's law: $(A \cup B)' = A' \cap B'$ — complement of a union is the intersection of complements.
Your Next Move
Try these three before moving on. If you slip on the subtraction, come back to Mistake 1.
$A = {2, 4, 6, 8}$ and $B = {3, 6, 9}$. Find $A \cup B$ and $n(A \cup B)$.
In a class of $40$, $25$ like math, $20$ like science, and $10$ like both. How many like at least one?
Use De Morgan's law to write $(P \cup Q \cup R)'$ in terms of $P', Q', R'$ and intersections.
Want a live Bhanzu trainer to walk through more A union B formula problems with your child? Book a free demo class — online globally.
Was this article helpful?
Your feedback helps us write better content
