Sub topic 5
The two-set formula: n(A∪B) = n(A) + n(B) − n(A∩B)
This chapter assumes you can read a two-set Venn diagram, know the symbols ∪, ∩ and complement, and can solve simple linear equations. If any of these feel shaky, revisit the earlier chapters on set operations and two-set Venn diagrams first.
Why the formula exists
Suppose 60 students study Maths and 50 study Physics. How many students study at least one of the two subjects? Adding 60 and 50 gives 110, but that count is too high if some students study both. Each of those students has been counted twice, once in each group.
The two-set formula corrects this double counting:
n(A∪B) = n(A) + n(B) − n(A∩B)
Here n(X) means the number of elements in set X. The formula says: add the two group sizes, then subtract the overlap once, so every element in the union is counted exactly one time.
This idea is called inclusion-exclusion. You include both sets in full, then exclude the part you counted twice.
Where the formula comes from
Split the union into three regions that do not overlap each other:
- Only A: elements in A but not in B.
- Both: elements in A and B.
- Only B: elements in B but not in A.
Then:
- n(A) = only A + both
- n(B) = only B + both
- n(A∪B) = only A + both + only B
Adding n(A) and n(B) counts "both" twice. Subtracting n(A∩B) once removes the extra copy. That gives the formula.
Reading the symbols correctly
The formula links four quantities. Any three of them determine the fourth.
| Quantity | Meaning in words |
|---|---|
| n(A) | Members of A, including those also in B |
| n(B) | Members of B, including those also in A |
| n(A∩B) | Members of both A and B |
| n(A∪B) | Members of A or B or both (at least one) |
In CAT wording, "or" in a set problem is inclusive. "Students who study Maths or Physics" includes those who study both.
Worked example 1: finding the union
In a class, 40 students like tea, 30 like coffee, and 12 like both. How many like tea or coffee?
n(T∪C) = 40 + 30 − 12 = 58.
Check by regions: only tea = 40 − 12 = 28, only coffee = 30 − 12 = 18, both = 12. The sum is 28 + 18 + 12 = 58, which matches.
Worked example 2: finding the overlap
Most CAT questions give you the union (directly or indirectly) and ask for the overlap. Rearrange the formula:
n(A∩B) = n(A) + n(B) − n(A∪B)
In a group of 100 students, 60 study Maths, 50 study Physics, and 15 study neither. Find how many study both, only Maths, and only Physics.
The students who study at least one subject number 100 − 15 = 85. So n(A∪B) = 85.
The code below follows these steps.
total = 100
n_a = 60 # study Maths
n_b = 50 # study Physics
neither = 15
union = total - neither # 85
both = n_a + n_b - union # 25
only_a = n_a - both # 35
only_b = n_b - both # 25
print(union, both, only_a, only_b) # 85 25 35 25The output is 85 25 35 25. Check: 35 + 25 + 25 + 15 = 100, so the four regions fill the whole group.
Worked example 3: finding a missing set size
In a survey of 120 people, 70 read newspaper P, 45 read newspaper Q, and 25 read both. Everyone reads at least one. How many people did the survey include who read only P or only Q? And is the total consistent?
n(P∪Q) = 70 + 45 − 25 = 90. But the survey has 120 people and everyone reads at least one paper, so the union should be 120. The data contradict each other.
This is a consistency check, and CAT problems sometimes rely on it. If the union you compute differs from the stated total (with "neither" equal to zero), the data are inconsistent or you misread a number. Always compare your union with the universal set.
Solving with an unknown: the algebra approach
Sometimes the overlap is described indirectly. Let x be the unknown and write each region in terms of x.
A school has 200 students. The number who play cricket is 80 more than the number who play football. 30 play both, and 20 play neither. How many play football?
Let football = f. Then cricket = f + 80. The union is 200 − 20 = 180.
f + (f + 80) − 30 = 180 2f + 50 = 180 f = 65
So 65 play football and 145 play cricket. Check: only cricket = 145 − 30 = 115, only football = 65 − 30 = 35, both = 30, neither = 20. The total is 115 + 35 + 30 + 20 = 200.
Percentages work the same way
The formula does not need actual counts. If the total is 100%, the formula works on percentages.
In a town, 55% of people read English newspapers, 40% read Hindi newspapers, and 20% read both. What percentage read neither?
Union = 55 + 40 − 20 = 75%. Neither = 100 − 75 = 25%.
Be careful when a problem gives percentages of different bases, such as "30% of those who read English also read Hindi". That percentage is of the English readers, not of the town. Convert it first: 30% of 55% = 16.5% of the town.
Common errors
- Forgetting to subtract the overlap. Writing n(A∪B) = n(A) + n(B) is only right when A and B share no elements.
- Treating "only A" as n(A). The value n(A) always includes the overlap.
- Ignoring the "neither" group. The formula gives the union, not the total. If some elements belong to neither set, subtract them from the total first, or add them afterwards.
- Reading "or" as exclusive. In these problems "A or B" includes both unless the question says "either A or B but not both".
- Mixing bases in percentage problems, as shown above.
Special cases and limits
The formula covers some simple cases directly.
| Situation | What happens to n(A∩B) | Union |
|---|---|---|
| A and B are disjoint (no common elements) | 0 | n(A) + n(B) |
| B is a subset of A | n(B) | n(A) |
| A and B are equal | n(A) | n(A) |
Two inequalities follow from the formula, because n(A∩B) can never be negative and can never exceed the smaller set:
- n(A∪B) ≤ n(A) + n(B)
- n(A∪B) ≥ max(n(A), n(B))
These bounds are useful as quick checks. If your computed union is larger than the sum of the two sets, or smaller than the larger set, you have made an error.
A quick method for exam conditions
- Identify the universal set and its size.
- Subtract "neither" to get the union.
- Apply n(A∩B) = n(A) + n(B) − n(A∪B).
- Find "only A" = n(A) − both and "only B" = n(B) − both.
- Check that only A + only B + both + neither equals the total.
Step 5 takes a few seconds and catches most arithmetic and reading mistakes.
Using the formula in code
Python's built-in sets let you test the formula on any data, which is a good way to build confidence.
A = {1, 2, 3, 4}
B = {3, 4, 5}
lhs = len(A | B)
rhs = len(A) + len(B) - len(A & B)
print(lhs, rhs, lhs == rhs) # 5 5 TrueTry other sets, including disjoint sets and sets where one contains the other. The equality holds each time.
Practice
Exercise
In a college of 150 students, 90 take Economics, 70 take Statistics, and 20 take neither. How many take both? How many take only Economics?
Show answer
The union is 150 − 20 = 130. Both = 90 + 70 − 130 = 30. Only Economics = 90 − 30 = 60. Check: 60 + 40 (only Statistics = 70 − 30) + 30 + 20 = 150.
Exercise
In a group, 45% like cricket, 35% like tennis, and 15% like neither. What percentage like both?
Show answer
The union is 100 − 15 = 85%. Both = 45 + 35 − 85 = −5%, which is impossible. The data are inconsistent, so no such group exists.
Exercise
In a class of 80, the number who passed Maths is 20 more than the number who passed English. 10 passed neither, and 25 passed both. How many passed English?
Show answer
Let English = e, so Maths = e + 20. The union is 80 − 10 = 70. Then e + (e + 20) − 25 = 70, so 2e = 75 and e = 37.5. This is not a whole number, so the data cannot describe real students. The setup is correct, but the numbers are inconsistent.