Skip to main content
AMC 12 focus

Inclusion-Exclusion

Counting the union of overlapping sets by adding, then subtracting, then adding again — the principle that fixes the addition rule when cases aren't disjoint.

Two sets

AB=A+BAB|A \cup B| = |A| + |B| - |A \cap B|

You add both sets, then subtract the overlap once, since it was counted twice.

Three sets

ABC=A+B+CABACBC+ABC|A\cup B\cup C| = |A|+|B|+|C| - |A\cap B|-|A\cap C|-|B\cap C| + |A\cap B\cap C|

The pattern continues for more sets: alternately add all single sets, subtract all pairwise intersections, add all triple intersections, subtract all quadruple intersections, and so on.

Common trap: “at least” vs. “exactly”

Inclusion-exclusion directly computes “in at least one of the sets.” If a problem asks for “exactly one” or “exactly two,” you need a modified formula (or careful casework) — don't reach for the standard inclusion-exclusion sum without checking which phrasing you actually have.

Worked example

Problem: How many integers from 1 to 100 are divisible by 2 or by 5?

Solution: Let AA = multiples of 2, BB = multiples of 5.A=50|A|=50, B=20|B|=20, and AB|A\cap B| = multiples of 10 = 1010.

AB=50+2010=60|A \cup B| = 50+20-10 = 60

Practice problems

1.Of 50 students, 30 take French and 25 take Spanish, with 12 taking both. How many take at least one of the two languages?

2.How many integers from 1 to 60 are divisible by 3 or 4?

3.In a class of 40, 18 like math, 15 like science, 10 like both. How many like neither?

4.How many integers from 1 to 100 are divisible by 2, 3, or 5?