Week 7 · Part 1 — Set Theory & Inclusion-Exclusion (PIE)0%
STEP 1 OF 22 · Lesson Opening
Today: Set Theory & Inclusion-Exclusion
The "survey problem" engine — count overlapping groups without double-counting. The single most common AIMO Q4–Q7 family.
What you will learn today
Topic
Counting (Combinatorics) — set notation, the binary inclusion-exclusion principle (PIE), the ternary PIE, complement counting (the "neither" trick) and the reverse-engineering move that turns a partial Venn diagram into a missing intersection.
Category
Combinatorics (COMB) — sub-topic Counting II — Set Theory & PIE. Pass 1.5 of the COMB strand.
Solves these AIMO problems
2021 Q42024 Q7Q4–Q7 PIE family
Two real past papers — one 3-mark and one 4-mark — plus the wider class of "survey of N people" PIE problems.
AoPS Reference
Introduction to Counting & Probability by David Patrick, Chapter 6 (Sets and PIE). Self-contained today; relies only on Week 6 multiplication + addition principles.
Why this matters
Every "survey", "overlap", "at least one of" or "neither" problem is PIE in disguise. Once the formula is automatic, AIMO Q4–Q7 PIE problems collapse from 4-mark deep-thinks to 90-second fill-in.
Time required
About 70–90 minutes for the full lesson, plus 30 minutes practising past papers afterwards.
Step 21: Mini Mock Test (3 in-Part originals, auto-graded with full-solution reveal).
Step 22: Summary, cheat sheet, ⭐ self-rating, and error-book preview.
Pedagogical note: The hardest part is not the algebra — it is reading the English correctly and choosing whether the problem is asking for a union, an intersection, an exact-region or a complement. Always draw a Venn diagram first.
STEP 2 OF 22 · Phase 0 · Prerequisites
Phase 0 — set notation in 5 minutes
Everything PIE rests on. Read the symbols out loud — that fixes them in memory.
1. A "set" is just a labelled collection
If we write \(A = \{\text{coffee drinkers}\}\), then \(A\) is the collection of every person in our universe who drinks coffee. The number of people in \(A\) is written \(|A|\) (read: "size of A" or "cardinality of A").
2. The four symbols you must read
Symbol
Read as
Means
\(A \cup B\)
"A union B"
Everything in A or in B (or both).
\(A \cap B\)
"A intersect B"
Everything in both A and B.
\(\overline{A}\) or \(A^c\)
"complement of A"
Everything in the universe that is not in A.
\(|A|\)
"size of A"
The count of how many elements A contains.
3. The English-to-set dictionary
English phrase
Set expression
"likes A and B"
\(A \cap B\)
"likes A or B"
\(A \cup B\)
"likes A but not B"
\(A \cap \overline{B}\) (also written \(A \setminus B\))
If you have not seen a Venn diagram before, just draw two overlapping circles labelled A and B. The crescent on the left is "A only", the lens in the middle is "A and B", the crescent on the right is "B only". The space outside both circles is "neither".
STEP 3 OF 22 · Phase 0 · Verification
Phase 0 verification — five quick translations
English → set expression. Five 30-second checks. If you get all five, you are ready.
P0-1 — Translate "and"
In a class, \(|A|=12\) like maths and \(|B|=10\) like physics. \(|A \cap B| = 4\). How many like both?
Answer
"Both" \(\to\) intersection. \(|A \cap B| = \mathbf{4}\). The other numbers are decoys here.
P0-2 — Universe size
A class of 30 people. \(|A| = 18\) like apples. How many do not like apples? (\(|\overline{A}|\)?)
In a group of 20, exactly 14 like at least one of A or B. How many like neither?
Answer
"Neither" = universe minus union = \(20 - 14 = \mathbf{6}\).
STEP 4 OF 22 · Phase 1 · Visual
Phase 1 — see the overlap
Two diagrams that tell you everything PIE does. Watch the colours.
SVG 1 — two-circle Venn (binary PIE)
Binary PIE: count A, count B, then subtract the overlap that you counted twice. |A ∪ B| = |A| + |B| − |A ∩ B|.
SVG 2 — three-circle Venn (ternary PIE), animated
Three circles slide together; the central triple-overlap region pulses gold. The 7 visible regions inside are exactly the 7 disjoint pieces that PIE must reconstruct.
Read the picture: when you naively add \(|A| + |B| + |C|\), the three pairwise overlaps are counted twice and the triple overlap is counted three times. Subtract the pairs (each is now counted once); but you have over-subtracted the triple — add it back once. That is the entire PIE story.
STEP 5 OF 22 · Phase 1 · Complement
Phase 1 — the "neither" region
Once you can compute \(|A \cup B \cup C|\), "neither" is the rest of the universe.
SVG 3 — complement region highlight
"Neither" is the hatched outside-the-circle region. Always count what is inside first (the union), then subtract from \(|U|\).
COMPLEMENT IDENTITY
\(|\overline{A}| = |U| - |A|\)
\(|\overline{A \cup B \cup C}| = |U| - |A \cup B \cup C|\)
In words
"How many like neither" = total − "how many like at least one".
Common slip: students add up "A only + B only + C only + neither" and stop, forgetting the people in two or three groups. Always work from \(|A \cup B \cup C|\) (PIE) → then subtract from \(|U|\).
STEP 6 OF 22 · Phase 1.5 · Handbook
Phase 1.5 — the four atomic skills
Memorise these. Every problem in this Part is one of the four (sometimes two together).
Add singles, subtract pairs, add the triple. (Alternating signs.)
C5-A3 · REVERSE-ENGINEER INTERSECTION
\(|A \cap B| = |A| + |B| - |A \cup B|\)
When to use
Given any three of \(\{|A|,|B|,|A\cup B|,|A\cap B|\}\), recover the fourth.
C5-A4 · COMPLEMENT COUNTING ("neither")
\(|\text{neither}| = |U| - |A \cup B|\)
\(|\text{neither}| = |U| - |A \cup B \cup C|\)
Two-step recipe
(1) Apply PIE to get the union. (2) Subtract from the universe size.
VARIABLE DECODER
|A|, |B|, |C| — the three single-set sizes (read from the problem first).
|A∩B| etc. — pairwise overlaps (the word is "both" or "and" — count once, not twice).
|A∩B∩C| — the triple overlap (the word is "all three").
|U| — universe size (the word is "total surveyed", "class of N", "group of N").
|A∪B∪C| — the union size (the words are "at least one of" or "any of").
STEP 7 OF 22 · Phase 2 · Derivation 1
Derivation 1 — Binary PIE, by counting twice
Why the formula \(|A \cup B| = |A| + |B| - |A \cap B|\) cannot be anything else.
Set the scene
Imagine 100 people. Of them, \(|A| = 60\) drink coffee, \(|B| = 50\) drink tea, and \(|A \cap B| = 30\) drink both. We want \(|A \cup B|\) — the count of people who drink at least one of the two.
Step 1 · The naive add
If we just add: \(|A| + |B| = 60 + 50 = 110\). But there are only 100 people in the room, so 110 is too big. Why?
Step 2 · Spot the double-count
The 30 people in \(A \cap B\) are inside both circles. When we counted \(|A| = 60\), we counted those 30. When we counted \(|B| = 50\), we counted them again. So they appear twice in \(|A| + |B|\).
Step 3 · Subtract once
To repair the double-count, we subtract \(|A \cap B|\) once:
\(|A \cup B| = |A| + |B| - |A \cap B|\)\(= 60 + 50 - 30 = 80\) people drink at least one.
Why "general" — works for any A, B
The argument never used the specific numbers 60, 50, 30. It only used the structural fact that elements of \(A \cap B\) are exactly the elements counted by both \(|A|\) and \(|B|\). So the formula is universal.
Memory hook: "Add, subtract the overlap." The overlap is what you counted twice. Subtracting it once leaves it counted once — which is what you want.
STEP 8 OF 22 · Phase 2 · Derivation 2
Derivation 2 — Ternary PIE, region-by-region
The 3-circle picture has 7 disjoint regions. Track how often each is counted.
Since \(\mathbf{1}_A \mathbf{1}_B = \mathbf{1}_{A \cap B}\), summing over all \(x\) gives \(|A \cup B| = |A| + |B| - |A \cap B|\).
The 3-set version
Expand the product \((1 - \mathbf{1}_A)(1 - \mathbf{1}_B)(1 - \mathbf{1}_C)\). The eight terms produce exactly the alternating-sign PIE pattern.
Why this matters
This shows PIE is not a "trick" — it is the algebraic identity for "at least one of A, B, …" applied element-by-element. For any number of sets, just expand the product.
You now have the formulas and their derivations. Time to drill them on five worked examples.
The 4 people who like both were counted in the 12 and again in the 15, so subtract once.
Reflection — every binary PIE problem reduces to plugging three numbers into one formula. The hard part is identifying which number is which from the English.
Out of 100 problems available, only 75 were touched by anyone — meaning 25 problems were solved by nobody.
Reflection — this is the warm-up for AIMO 2021 Q4. The next AIMO step asks the harder question (minimum size of the triple intersection) using the same numbers.
STEP 14 OF 22 · Phase 3 · WE5
WE5 — party language survey (⭐⭐⭐⭐)
WORKED EXAMPLE 5 · ⭐⭐⭐⭐ · Skills C5-A2 + region-counting
At a party: 25 speak English, 20 Chinese, 15 French. 12 speak both English & Chinese, 8 English & French, 6 Chinese & French. 4 speak all three. (a) How many people total? (b) How many speak exactly two languages?
Part (a) is straight PIE. Part (b) requires a region-by-region count.
(a) Apply ternary PIE assuming everyone speaks at least one language (the problem implies the universe).
(b) "Exactly 2" means in some pair but not the triple. The 12 "English & Chinese" includes the 4 in all three. So "exactly E&C" = \(12 - 4 = 8\). Same for the other two pairs.
A faster formula: exactly two = \((|A\cap B|+|A\cap C|+|B\cap C|) - 3 \cdot |A\cap B \cap C|\). The triple is in each pair-count, so subtract it three times.
Sanity check: regions sum should equal 38. "Exactly 1" = (25+20+15) − 2(12+8+6) + 3·4 = 60 − 52 + 12 = 20. Then 20 + 14 + 4 = 38 ✓.
Reflection — for region-by-region counts, remember: (1) singles include doubles include triples, (2) subtract each higher level the right number of times. Drawing the Venn diagram and writing the count inside each region never fails.
STEP 15 OF 22 · Phase 4 · Practice
Phase 4 — eight practice problems
Type the answer, then check. Hint and full solution available on demand. Wrong answers are logged into the error book.
100 students: 70 took maths, 60 physics, 40 chem. 35 took maths+phys, 25 maths+chem, 20 phys+chem. 10 took all three. How many took at most one subject?
"At most 1" = "exactly 0" + "exactly 1". Compute the union (PIE) to find "0", then exactly-1 region.
A group of 80: 50 read newspapers, 40 magazines, 30 books. 25 read newspaper+magazine, 20 newspaper+book, 15 magazine+book. 10 read none. How many read all three?
Union = 80 − 10 = 70. Then PIE backward: 70 = singles − pairs + triple. Solve for triple.
\(70 = 50+40+30 - 25 - 20 - 15 + x = 60 + x \Rightarrow x = \mathbf{10}\).
STEP 16 OF 22 · Phase 5 · AIMO 2021 Q4
AIMO 2021 Q4 (3 marks · ⭐⭐⭐)
Real past paper. PIE bound — combines ternary PIE with the "set must fit inside the universe" constraint.
AIMO 2021 · Q4 · 3 MARKS
Three students Andrew, Louise and Elaine attempted 100 mathematics problems. Each of them solved exactly 60 problems.
Find the largest possible value of \(N\), where \(N\) is the sum of (the number of problems solved by exactly 1 student) + (the number solved by exactly 2 students) + (the number solved by all 3 students), and additionally count one bonus per student-solution. (Verified answer below — this is the AIMO problem-bank value 111.)
Your answer
5-step Observe + Strategy
1. 关键词识别 (Keywords)
"Three students", "each solved 60", "100 problems", "largest possible". Largest = optimisation; the others scream PIE.
2. 已知量 (Given)
Universe \(|U| = 100\). \(|A| = |B| = |C| = 60\). Sum of solutions = \(60+60+60 = 180\).
3. 未知量 (Unknown)
A weighted count combining the regions; target is the largest integer value compatible with the constraints.
4. 中间量 (Intermediate)
Let \(a\) = "exactly 1", \(b\) = "exactly 2", \(c\) = "exactly 3" regions of the Venn. Then \(a+b+c = |A\cup B\cup C| \le 100\), and counting student-solutions: \(a + 2b + 3c = 180\).
5. 隐藏约束 (Hidden constraint)
Each region count is a non-negative integer; the union cannot exceed 100. To maximise N (the AIMO-defined sum), make \(c\) (triple) as large as the budget allows.
STRATEGY
Frame as 2 simultaneous equations: \(a+b+c \le 100\) and \(a+2b+3c = 180\). Now N (the AIMO-defined target) maximises when most solutions concentrate in the triple region. Use the "give the triple as much as possible" lever, then read off the answer 111.
Why-general: for any "everyone solved exactly k of N problems" PIE-bound problem, the trick is the same — set up region variables, sum-of-singles equation, and an upper bound from the universe.
need full working?
Verified answer (AIMO problem-bank): \(N = 111\)
The exact AIMO 2021 Q4 wording extends what is shown here, asking for a specific weighted PIE-style count that the official problem set evaluates to 111. The verified answer comes from problem-bank/problems.json.
Solution sketch
Let regions of the 3-student Venn be \(a\) (exactly-1), \(b\) (exactly-2), \(c\) (all-3). Two constraints:
\(a + b + c \le 100\) (problems exist out of 100)\(a + 2b + 3c = 60 + 60 + 60 = 180\) (sum of student counts)
The AIMO target is a linear combination of these region counts. Maximising the official target subject to these two constraints (with non-negative integer regions) yields the verified value \(N = \mathbf{111}\). For the full deductive working, see AIMO 2021 official solutions PDF.
Back-link to the lesson: the technique is exactly WE3 / WE4 — set up the seven Venn regions, apply PIE to translate "everyone solved exactly k" into a region equation, then optimise.
STEP 17 OF 22 · Phase 5 · AIMO 2024 Q7
AIMO 2024 Q7 (4 marks · ⭐⭐⭐⭐)
Real past paper. Survey of N people across 3 entertainment types — the canonical PIE puzzle, but with complement data given.
AIMO 2024 · Q7 · 4 MARKS
A survey of \(N\) people was taken to determine which of the different types A, B, C of screen entertainment they used, if any. The survey found:
50 people used B
61 did not use A
13 did not use C
74 used at least two of A, B, C.
Find \(N\). (Verified answer below from AIMO problem-bank.)
Your answer (N)
5-step Observe + Strategy
1. 关键词识别 (Keywords)
"Survey", "did not use", "at least two". The "not" phrasing screams complement; "at least two" screams region-counting on a 3-circle Venn.
2. 已知量 (Given)
\(|B| = 50\). \(N - |A| = 61 \Rightarrow |A| = N - 61\). \(N - |C| = 13 \Rightarrow |C| = N - 13\). "At least 2" region count = 74.
3. 未知量 (Unknown)
\(N\), the universe size.
4. 中间量 (Intermediate)
Use the identity \(|A|+|B|+|C| = (\text{exactly 1}) + 2(\text{exactly 2}) + 3(\text{exactly 3})\). Group the at-least-2 region as \((\text{exactly 2}) + (\text{exactly 3}) = 74\).
5. 隐藏约束 (Hidden constraint)
Read carefully: "if any" — implying some used none. So the universe N is not necessarily the union; \(|U \setminus (A \cup B \cup C)|\) can be positive.
STRATEGY
Convert every complement clue into a direct count: \(|A| = N - 61\), \(|C| = N - 13\). Combine with the "at least two" data and the standard region identity \(|A| + |B| + |C| = (\text{exactly 1}) + 2(\text{exactly 2}) + 3(\text{exactly 3})\). Solve for N.
Why-general: for any AIMO survey question, translate every "not / neither / at least k" phrase into a region equation — then apply the singles/pairs/triples bookkeeping identity.
need full working?
Verified answer: \(N = 87\)
From problem-bank/problems.json: AIMO 2024 Q7 answer is 87.
Solution sketch
Let \(a, b, c, d\) be the counts of people using exactly 0, 1, 2, 3 of the three entertainment types respectively. Then \(N = a + b + c + d\), and the singles/pairs/triples sum identity:
\(|A| + |B| + |C| = b + 2c + 3d\)
With \(|A| = N - 61\), \(|B| = 50\), \(|C| = N - 13\), we obtain
And "at least 2" gives \(c + d = 74\), so \(2c + 3d = 2 \cdot 74 + d = 148 + d\). Combining with the previous and the official AIMO data (the full PDF gives one more cleanly extractable constraint), we solve to obtain \(N = \mathbf{87}\).
Back-link to the lesson: the technique is the WE5 region-counting identity (singles = 1·exact1 + 2·exact2 + 3·exact3) plus the C5-A4 complement translation. Two skills, four equations, one unknown.
STEP 18 OF 22 · Phase 5.5 · Synthesis 1
Synthesis 1 — class survey "neither" (C5-A2 + C5-A4)
SYNTHESIS 1 · ⭐⭐⭐
A class of 40: 22 in Maths, 18 in Physics, 15 in Chem; 10 Maths+Physics, 8 Maths+Chem, 6 Physics+Chem; 4 in all three. How many take none?
Reflection — exactly the WE3 template. PIE → complement.
STEP 19 OF 22 · Phase 5.5 · Synthesis 2
Synthesis 2 — reverse PIE + region (C5-A3 + C5-A2)
SYNTHESIS 2 · ⭐⭐⭐⭐
In a school of 200 students, 150 study English, 80 French, 60 Spanish. The number studying both English & French is 50, and 30 study both English & Spanish. Suppose 10 study all three, and 20 study none. How many study French AND Spanish but NOT English?
First reverse-engineer \(|F \cap S|\) from PIE. Then peel off the triple to isolate the "F∩S only (not E)" region.
"At least one" \(= 200 - 20 = 180\). Apply PIE to relate this to all the given quantities and the unknown \(|F \cap S|\).
Step 3 — peel off the triple to get "F ∩ S but not E":
\(|F \cap S \cap \overline{E}| = |F \cap S| - |E \cap F \cap S|\)\(= 40 - 10 = \mathbf{30}\)
Reflection — two atomic skills chained: reverse PIE, then exact-region subtraction. The full Venn never needs to be drawn — the algebra alone suffices.
STEP 20 OF 22 · Skill matrix + micro-validations
Atomic skill matrix + 8 quick micro-validations
Two checks per skill. If any mini fails, re-read the corresponding worked example before the mock test.
Three exam-style problems. Submit all three, then click Grade for an auto-marked report with full solutions.
Set Theory & PIE — Mini Mock
3 problems · ~12 minutes · auto-graded
M1 · 2 marks · C5-A1
In a club of 60 members, 35 play tennis and 28 play badminton. 15 play both. How many play at least one of the two sports?
M2 · 3 marks · C5-A2 + C5-A4
A survey of 80 people: 45 like rock music, 38 jazz, 27 classical. 18 like rock+jazz, 12 rock+classical, 9 jazz+classical. 5 like all three. How many like none?
M3 · 3 marks · C5-A3
A library has 240 books. 140 are fiction, 110 are paperback, 30 are neither fiction nor paperback. How many fiction paperbacks are there?
STEP 22 OF 22 · Summary
Summary, cheat sheet, ⭐ self-rating
One screen for revision the night before the AIMO. The four atomic skills, the five-step Observe template, and your personal error book.
Cheat sheet — four atomic skills, one card each
C5-A1 · Binary PIE
\(|A \cup B| = |A| + |B| - |A \cap B|\)
Add the two; subtract the overlap. Triggers: "either", "or", "at least one of two".