On this page
Three-set counting questions all use one formula. Marks are lost on the wording: "exactly two" and "at least two" are different numbers, and "neither" needs the total. This post explains why the formula works, then works through four problem types that come up in JEE practice papers.
Where is this in the syllabus?
The JEE (Main) 2026 syllabus lists union, intersection and complement of sets and their algebraic properties. The JEE (Advanced) 2026 brochure goes further, with De Morgan's laws "and practical problems based on them".
For school, the current NCERT Class 11 chapter on Sets (Reprint 2026-27) covers Venn diagrams, union, intersection, difference and complement, but has no section on counting with n(A ∪ B ∪ C). The CBSE 2026-27 mathematics curriculum says "practical problems on union and intersection of two sets" will be assessed only formatively in Class 11. So the three-set version is mainly JEE material. Check your exam year's documents.
Why does the formula work?
n(A ∪ B ∪ C) = n(A) + n(B) + n(C) − n(A ∩ B) − n(B ∩ C) − n(A ∩ C) + n(A ∩ B ∩ C)
Follow one element in the centre, in all three sets. Adding n(A), n(B) and n(C) counts it 3 times. Subtracting the three pairwise overlaps removes it 3 times, leaving 0. Adding n(A ∩ B ∩ C) puts it back once. An element in exactly two sets is counted 2 − 1 = 1 time, and an element in one set is counted once. Every region counts exactly once.
For the two-set version and a first filled-in diagram, see our post on sets and relations in Class 11. The problems below use different shapes.
Worked example 1: divisibility up to 1000
How many integers from 1 to 1000 are divisible by 2, 3 or 5?
Let A, B and C be the multiples of 2, 3 and 5. Divide and round down:
n(A) = 500, n(B) = 333, n(C) = 200
Divisible by both 2 and 3 means divisible by 6: n(A ∩ B) = 166
By 2 and 5, so by 10: n(A ∩ C) = 100
By 3 and 5, so by 15: n(B ∩ C) = 66
By 30: n(A ∩ B ∩ C) = 33
n(A ∪ B ∪ C) = 500 + 333 + 200 − 166 − 100 − 66 + 33 = 734.
So 1000 − 734 = 266 numbers are divisible by none of 2, 3 and 5.
Worked example 2: exactly one, exactly two, at least two
Sample numbers. Of 150 students, 80 are in the maths club (M), 70 in the science club (S) and 50 in the quiz club (Q). 30 are in M and S, 20 in S and Q, 25 in M and Q, and 10 in all three.
At least one club: 80 + 70 + 50 − 30 − 20 − 25 + 10 = 135. None: 150 − 135 = 15.
Exactly two: each pairwise number includes the 10 in all three, so subtract it: (30 − 10) + (20 − 10) + (25 − 10) = 20 + 10 + 15 = 45.
At least two: exactly two plus all three = 45 + 10 = 55.
Exactly one: 135 − 45 − 10 = 80. Check by regions: only M = 80 − 20 − 15 − 10 = 35, only S = 70 − 20 − 10 − 10 = 30, only Q = 50 − 10 − 15 − 10 = 15. And 35 + 30 + 15 = 80.
Worked example 3: running the formula backwards
Sample numbers. Three sets each have 40 elements, each pair shares 15, and the union has 85. How many are in all three?
85 = 40 + 40 + 40 − 15 − 15 − 15 + x, so 85 = 75 + x and x = 10.
Now check that the data make sense. Each "exactly two" region is 15 − 10 = 5, and each "only one" region is 40 − 5 − 5 − 10 = 20. All regions are non-negative, so the data are consistent. If any region came out negative, the data would be impossible, and some JEE questions test exactly that.
Worked example 4: the smallest possible overlap
In a group of 100, 70 like tea and 60 like coffee. What is the least number who like both?
n(T ∩ C) = n(T) + n(C) − n(T ∪ C), and n(T ∪ C) is at most 100. So n(T ∩ C) is at least 70 + 60 − 100 = 30. The most is 60, when every coffee drinker also likes tea. Range questions like this use the formula as an inequality.
Which mistakes cost marks?
Subtracting the triple overlap instead of adding it. Follow a centre element through the formula to check.
Using pairwise numbers as "exactly two". They include the centre.
Forgetting "none". The formula gives "at least one"; "none" needs the total.
Rounding up in divisibility questions. 1000/3 = 333.3, so use 333.
Using 2 × 3 × 5 for any three divisors. For 4 and 6, the overlap is multiples of 12, the LCM, not 24.
The same formula gives P(A ∪ B ∪ C) in probability. Our post on common probability mistakes covers where it is misused.
A practice routine
Derive the formula by following one element from each type of region, without notes.
Count the integers up to 500 divisible by 3, 5 or 7. Check that you get 271.
Make up a club problem, fill in all eight regions, and confirm they add to the total.
Do one backwards problem and one range problem each day for a week.
If you are stuck on how to set up the regions in a wordy question, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer, so you can check your diagram against its reasoning.
Today, solve Worked example 2 again with 12 students in all three clubs instead of 10, and find "exactly two".



