AdvancedQuantitative Aptitude · Lesson 24 of 25 · Updated ·
Sets and Venn Diagrams — Counting "Both", "Only", "Neither" and "Exactly Two"
A set is a collection of things, for example "students who play cricket". Two sets overlap when some things belong to both, like students who play cricket and football.
Survey questions — "35 like tea, 30 like coffee, 15 like both, how many like neither?" — appear in TCS, Capgemini, Accenture and many campus tests. A Venn diagram (overlapping circles) makes them easy.
1. Words and symbols
| Word in the question | Symbol | Meaning |
|---|---|---|
| A or B, either, at least one | A ∪ B (union) | in A, in B, or in both |
| A and B, both | A ∩ B (intersection) | in A and also in B |
| only A | A − B | in A but not in B |
| neither | outside both circles | in none |
n(A) means "the number of elements in A".
2. Two sets
n(A ∪ B) = n(A) + n(B) − n(A ∩ B)
Why subtract? When you add n(A) and n(B), the people in both are counted twice — once in each. Subtracting n(A ∩ B) once leaves everyone counted exactly once. This idea is called inclusion–exclusion.
Example 1
In a class of 60, 35 play cricket, 30 play football and 15 play both. How many play neither?
At least one = 35 + 30 − 15 = 50. Neither = 60 − 50 = 10.
Also: only cricket = 35 − 15 = 20, only football = 30 − 15 = 15.
Example 2 (find the overlap)
In a survey of 80 people, 50 speak Hindi and 45 speak English. Everyone speaks at least one of them. How many speak both?
80 = 50 + 45 − both → both = 15.
Example 3 (percentages work the same way)
65% of students like tea, 55% like coffee and 20% like neither. What percentage like both?
At least one = 100 − 20 = 80%. 80 = 65 + 55 − both → both = 40%.
3. Three sets
n(A ∪ B ∪ C) = n(A) + n(B) + n(C) − n(A∩B) − n(B∩C) − n(A∩C) + n(A∩B∩C)
Why add the last term back? A person in all three is added 3 times (in A, B and C), then subtracted 3 times (in each pair). That leaves them counted 0 times, so you add them back once.
The centre-out method
To find "only" and "exactly two" counts, fill the diagram from the middle outwards:
- Write the "all three" number in the centre.
- For each pair, write (pair total − centre) in the part of that overlap outside the third circle.
- For each set, write (set total − its three inner regions) in its "only" part.
Example 4 (TCS / Accenture style)
Out of 100 students, 50 study Maths, 45 Physics and 40 Chemistry. 20 study Maths and Physics, 15 Physics and Chemistry, 10 Maths and Chemistry, and 5 study all three. Find (a) how many study none, (b) only Maths, (c) exactly two subjects.
- Centre (all three) = 5.
- Maths and Physics only = 20 − 5 = 15; Physics and Chemistry only = 15 − 5 = 10; Maths and Chemistry only = 10 − 5 = 5.
- Only Maths = 50 − 15 − 5 − 5 = 25. Only Physics = 45 − 15 − 10 − 5 = 15. Only Chemistry = 40 − 5 − 10 − 5 = 20.
(a) At least one = 50 + 45 + 40 − 20 − 15 − 10 + 5 = 95. None = 100 − 95 = 5. (b) Only Maths = 25. (c) Exactly two = 15 + 10 + 5 = 30.
Check: 25 + 15 + 20 + 15 + 10 + 5 + 5 = 95. ✓ Always add the seven regions as a check.
"Exactly two" versus "both"
"20 study Maths and Physics" usually includes those who also study Chemistry. "Exactly 20 study two subjects" excludes them. Read carefully. If the question gives "exactly two" (call it E) and "all three" (call it T):
At least one = (sum of single totals) − E − 2T
Example: singles 40 + 35 + 30 = 105, exactly two = 20, all three = 5 → at least one = 105 − 20 − 10 = 75.
Why? In the sum of singles, a person in exactly two sets is counted twice (one extra) and a person in all three is counted three times (two extra). Remove the extras.
4. Maximum and minimum overlap
Of 100 people, 70 drink tea and 60 drink coffee. What are the least and the most who drink both?
- Least: 70 + 60 = 130 is 30 more than 100, so at least 30 must be in both.
- Most: the overlap cannot be bigger than the smaller group: 60 (when every coffee drinker also drinks tea).
Minimum both = n(A) + n(B) − total (or 0 if negative). Maximum both = the smaller of n(A), n(B).
5. Counting multiples (sets of numbers)
Example 5
How many numbers from 1 to 100 are divisible by 2 or 3?
Multiples of 2: 50. Multiples of 3: 33. Multiples of both (that is, of 6): 16. Answer = 50 + 33 − 16 = 67.
Example 6
How many numbers from 1 to 300 are divisible by neither 3 nor 5?
Multiples of 3: 100. Of 5: 60. Of 15: 20. Divisible by 3 or 5 = 100 + 60 − 20 = 140. Neither = 300 − 140 = 160.
Common mistakes
- Adding the two groups without subtracting "both" — people in both get counted twice.
- Using the pair totals as "exactly two". Subtract the centre first.
- Forgetting the "neither" people outside all circles when the total is given.
- For "divisible by 2 or 3", subtracting multiples of 2 × 3 = 6 is right, but for 4 and 6 you must subtract multiples of their LCM, 12, not 24.
Quick recap
- n(A ∪ B) = n(A) + n(B) − n(A ∩ B). Neither = total − at least one.
- Three sets: add singles, subtract pairs, add back all three.
- Fill a Venn diagram from the centre out; check that the seven regions add up.
- At least one = singles − (exactly two) − 2 × (all three).
- Minimum overlap = n(A) + n(B) − total; maximum = the smaller set.