PYQ Vault

NDA Maths · Sets & Relations

Counting, Subsets and Inclusion-Exclusion

An n-element set has 2ⁿ subsets; the inclusion-exclusion principle counts a union by adding the parts and subtracting the overlaps — the engine behind every Venn 'survey' word problem.

Why this matters

27 PYQs — the largest subtopic, and the home of the chapter's highest-yield HARD genre: the survey word problem (so many like cricket, so many like both, how many like exactly two). Master two things — counting subsets with 2ⁿ, and the exactly-one / exactly-two / all-three accounting — and you cover most of these marks.

Test yourself — a quick 14-question Sets & Relations recall quiz, instant score.

Concept 1 of 4: Power set and counting subsets

The power set of A is the set whose members are ALL the subsets of A. Each element of A is either in or out of a subset, so an n-element set has 2n2^n subsets. From that one fact flow proper-subset counts, superset counts, and a slick symmetry trick for 'at most half' the elements.

Definition

The power set P(A)P(A) is the set of all subsets of A, and it always contains the empty set ∅\varnothing and A itself. For A={a,b}A = \{a, b\} the subsets are ∅\varnothing, {a}\{a\}, {b}\{b\} and {a,b}\{a, b\}, so P(A)={∅,{a},{b},{a,b}}P(A) = \{\varnothing, \{a\}, \{b\}, \{a, b\}\}: its members are sets, and there are 4=224 = 2^2 of them. Each element gives two choices (in or out), and 2×2=42 \times 2 = 4. The counting rules:

  • A set with nn elements has 2n2^n subsets, so ∣P(A)∣=2n|P(A)| = 2^n. Of these, 2n−12^n - 1 are proper subsets (all except the set itself).
  • Supersets of a fixed set {x}\{x\}: fix x as 'in', let the other n−1n-1 elements vary ⇒2n−1\Rightarrow 2^{n-1} subsets contain x.
  • Count carefully when elements are themselves sets: A={{1,2,3}}A=\{\{1,2,3\}\} has ONE element, so ∣P(A)∣=2|P(A)|=2.
  • Symmetry trick: in a (2n+1)(2n+1)-element set, the subsets of size ≤n\le n are exactly half of all subsets =12⋅22n+1=22n= \tfrac{1}{2}\cdot 2^{2n+1} = 2^{2n}.
  • Subsets of a given SIZE: an nn-set has (nr)\binom nr subsets with exactly rr elements (they sum to 2n2^n over rr); e.g. a 6-set has (62)=15\binom62=15 two-element subsets and (63)=20\binom63=20 three-element ones. Subsets with at least rr elements: ∑k≥r(nk)\sum_{k\ge r}\binom nk.

Counting subsets

∣P(A)∣=2nproper subsets=2n−1subsets containing a fixed element=2n−1|P(A)| = 2^n \qquad \text{proper subsets} = 2^n - 1 \qquad \text{subsets containing a fixed element} = 2^{n-1}

Worked example

A set S has 2n+12n+1 elements. The number of subsets of S with at most n elements is 256. Find n.
Practice this conceptself-check · 4 quick reps

The same idea in a real exam question:

NDA · Apr 2026 · Q7Moderate

Example 1 · Sets & Relations · Counting Sets, Subsets, and Inclusion-Exclusion

A set S contains (2n+1)(2n+1) elements. If the number of subsets of S which contain at most nn elements is 1024, then what is the value of nn?

Count the elements before raising 2 to a power

A={λ,{λ,μ}}A=\{\lambda, \{\lambda,\mu\}\} has TWO elements (an element λ\lambda and a SET {λ,μ}\{\lambda,\mu\}), so ∣P(A)∣=4|P(A)|=4. The brace-inside-brace is one element, not two — miscounting elements is the usual error.

Concept 2 of 4: Inclusion-exclusion for two sets

If you add the sizes of two overlapping sets you count the overlap twice, so subtract it once: ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣|A\cup B| = |A|+|B|-|A\cap B|. The same idea bounds how small or large an overlap can be in 'at least / at most' survey questions.

Definition

The two-set rule and its uses:

  • ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣|A\cup B| = |A| + |B| - |A\cap B|.
  • For sets of multiples, A∩BA\cap B uses the LCM: multiples of 3 ∩\cap multiples of 2 are multiples of 6.
  • Least overlap: ∣A∩B∣≥∣A∣+∣B∣−∣U∣|A\cap B| \ge |A|+|B|-|U| (when the union can't exceed the universe). Most overlap: ∣A∩B∣≤min⁡(∣A∣,∣B∣)|A\cap B| \le \min(|A|,|B|).
  • The mirror bounds on the union: max⁡(∣A∣,∣B∣)≤∣A∪B∣≤min⁡(∣A∣+∣B∣, ∣U∣)\max(|A|,|B|)\le|A\cup B|\le\min(|A|+|B|,\,|U|) — the minimum is attained when one set contains the other, the maximum when they are disjoint.
  • Counting multiples: the number of multiples of dd in {1,…,N}\{1,\dots,N\} is ⌊N/d⌋\lfloor N/d\rfloor; so among 1..1001..100 there are 50 multiples of 2, 20 of 5, 10 of 10 (the LCM), and 50+20−10=6050+20-10=60 of 2 or 5.

Inclusion–exclusion (two sets)

∣A∪B∣=∣A∣+∣B∣−∣A∩B∣∣A∩B∣≥∣A∣+∣B∣−∣U∣|A \cup B| = |A| + |B| - |A \cap B| \qquad |A \cap B| \ge |A| + |B| - |U|
UABA − BA ∩ BB − A(A ∪ B)′ — outside both

Worked example

In a group of 100 people, 70 like tea and 80 like coffee, and everyone likes at least one. How many like both?
Practice this conceptself-check · 3 quick reps

The same idea in a real exam question:

NDA · Sep 2021 · Q43Moderate

Example 2 · Sets & Relations · Counting Sets, Subsets, and Inclusion-Exclusion

Suppose set AA consists of first 250 natural numbers that are multiples of 3 and set BB consists of first 200 even natural numbers. How many elements does A∪BA\cup B have?

Overlap of multiples uses LCM, not product

Multiples of 4 and 6 in common are multiples of lcm(4,6)=12\mathrm{lcm}(4,6)=12, NOT 4×6=244\times 6 = 24. Use the LCM whenever 'divisible by both' appears.

Concept 3 of 4: Inclusion-exclusion for three sets

Three overlapping sets need alternating signs: add the three singles, subtract the three pairwise overlaps, add back the triple overlap. With three sets, max/min questions hinge on how large the triple overlap can be.

Definition

The three-set rule:

  • ∣A∪B∪C∣=∣A∣+∣B∣+∣C∣−∣A∩B∣−∣B∩C∣−∣A∩C∣+∣A∩B∩C∣|A\cup B\cup C| = |A|+|B|+|C| - |A\cap B| - |B\cap C| - |A\cap C| + |A\cap B\cap C|.
  • This equals the sum of the seven disjoint Venn regions.
  • Maximising/minimising the union: the only free quantity is the triple overlap x=∣A∩B∩C∣x = |A\cap B\cap C|. The union grows with x; x is bounded by 0≤x≤min⁡0 \le x \le \min of the pairwise intersections.

Inclusion–exclusion (three sets)

∣A∪B∪C∣=∣A∣+∣B∣+∣C∣−∣A∩B∣−∣B∩C∣−∣A∩C∣+∣A∩B∩C∣|A \cup B \cup C| = |A| + |B| + |C| - |A \cap B| - |B \cap C| - |A \cap C| + |A \cap B \cap C|
ABConly Aonly Bonly CA∩B onlyA∩CB∩Call 3

Worked example

Three sets satisfy ∣A∪B∪C∣=90+x|A\cup B\cup C| = 90 + x where x=∣A∩B∩C∣x=|A\cap B\cap C|, and the pairwise intersections are 20, 15, 12. What is the maximum possible ∣A∪B∪C∣|A\cup B\cup C|?
Practice this conceptself-check · 3 quick reps

The same idea in a real exam question:

NDA · Apr 2019 · Q17Moderate

Example 3 · Sets & Relations · Counting Sets, Subsets, and Inclusion-Exclusion

Consider the following for the next 02 (two) items that follow: In a school, all the students play at least one of three indoor games – chess, carrom and table tennis. 60 play chess, 50 play table tennis, 48 play carrom, 12 play chess and carrom, 15 play carrom and table tennis, 20 play table tennis and chess.
What can be the maximum number of students in the school?

Mind the alternating signs

Pairwise intersections are SUBTRACTED, the triple intersection is ADDED. Dropping the +∣A∩B∩C∣+|A\cap B\cap C| term is the most common slip — it under-counts the union.

Concept 4 of 4: Survey problems — exactly one, exactly two, all three

The hardest sets questions are surveys: so many play each game, so many play exactly two, how many play all three. The trick is to keep 'exactly k' and 'at least k' strictly separate, and to remember the two bridging identities. Most of these are pure region bookkeeping on a 3-circle Venn diagram.

Definition

The accounting identities (let one/two/three = people in exactly one / exactly two / all three regions):

  • Total in the union =(exactly one)+(exactly two)+(exactly three)= (\text{exactly one}) + (\text{exactly two}) + (\text{exactly three}). This is the 'exactly' decomposition — NOT the raw inclusion-exclusion sum.
  • Sum of pairwise intersections =(exactly two)+3⋅(all three)= (\text{exactly two}) + 3\cdot(\text{all three}), so exactly two =∑pairwise−3⋅(all three)= \sum\text{pairwise} - 3\cdot(\text{all three}).
  • At least two =(exactly two)+(all three)= (\text{exactly two}) + (\text{all three}).
  • Exactly one =total−(at least two)= \text{total} - (\text{at least two}).

Survey accounting identities

exactly two=∑pairwise−3 (all three)at least two=exactly two+(all three)\text{exactly two} = \textstyle\sum\text{pairwise} - 3\,(\text{all three}) \qquad \text{at least two} = \text{exactly two} + (\text{all three})
ABConly Aonly Bonly CA∩B onlyA∩CB∩Call 3

Worked example

In a class everyone plays at least one of three sports. 25 play exactly two sports and 5 play all three. The pairwise totals ∣A∩B∣+∣B∩C∣+∣A∩C∣|A\cap B|+|B\cap C|+|A\cap C| sum to S. Find S.
Practice this conceptself-check · 4 quick reps

The same idea in a real exam question:

NDA · Sep 2024 · Q40Hard

Example 4 · Sets & Relations · Counting Sets, Subsets, and Inclusion-Exclusion

In a class of 240 students, 180 passed in English, 130 passed in Hindi and 150 passed in Sanskrit. Further, 60 passed in only one subject, 110 passed in only two subjects and 10 passed in none of the subjects. How many passed in all three subjects?

'Exactly two' is not the sum of pairwise intersections

Each all-three person is counted in all three pairwise intersections, so ∑pairwise\sum\text{pairwise} over-counts them by a factor of 3. Subtract: exactly two =∑pairwise−3⋅(all three)= \sum\text{pairwise} - 3\cdot(\text{all three}). Mixing up 'exactly' and 'at least' is the single biggest source of wrong answers here.

Summary — formulas & gotchas at a glance

A revision cheat-sheet for the formulas and gotchas above. Click any concept name to jump back to its full explanation.

Formulas (4)

  • Power set and counting subsets

    Counting subsets

    ∣P(A)∣=2nproper subsets=2n−1subsets containing a fixed element=2n−1|P(A)| = 2^n \qquad \text{proper subsets} = 2^n - 1 \qquad \text{subsets containing a fixed element} = 2^{n-1}
  • Inclusion-exclusion for two sets

    Inclusion–exclusion (two sets)

    ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣∣A∩B∣≥∣A∣+∣B∣−∣U∣|A \cup B| = |A| + |B| - |A \cap B| \qquad |A \cap B| \ge |A| + |B| - |U|
  • Inclusion-exclusion for three sets

    Inclusion–exclusion (three sets)

    ∣A∪B∪C∣=∣A∣+∣B∣+∣C∣−∣A∩B∣−∣B∩C∣−∣A∩C∣+∣A∩B∩C∣|A \cup B \cup C| = |A| + |B| + |C| - |A \cap B| - |B \cap C| - |A \cap C| + |A \cap B \cap C|
  • Survey problems — exactly one, exactly two, all three

    Survey accounting identities

    exactly two=∑pairwise−3 (all three)at least two=exactly two+(all three)\text{exactly two} = \textstyle\sum\text{pairwise} - 3\,(\text{all three}) \qquad \text{at least two} = \text{exactly two} + (\text{all three})

Watch out for (4)

Test yourself on Sets & Relations

20 past NDA questions from this chapter, timed at 25 minutes and marked the way the exam marks it. You see your score and every answer the moment you finish. Free to start.