Euler Hall — free maths guides

The size of a union: add, then subtract the overlap

Compute the size of a union from the two sizes and the overlap. The idea in plain words, a worked example, and a check with the answers shown — part of the free Quantitative Reasoning guides.

Inclusion-exclusion for two sets

For two finite sets,

n(A∪B)=n(A)+n(B)−n(A∩B).n(A \cup B) = n(A) + n(B) - n(A \cap B).

The subtraction removes the double count. Adding the two sizes counts each shared element once in each set, so the shared elements appear twice and must come out once — subtract them.

Example:A={1,5,7}A = \{1, 5, 7\},B={1,5,7,8}B = \{1, 5, 7, 8\}. Thenn(A)=3n(A) = 3,n(B)=4n(B) = 4, andA∩B={1,5,7}A \cap B = \{1,5,7\} so the overlap is 3. The union is{1,5,7,8}\{1,5,7,8\}, which has 4 members, and indeed3+4−3=43 + 4 - 3 = 4.

The formula also constrains answers before you compute anything: the union is at least as large as either set, and no larger than the sum. An answer outside those bounds is wrong.

Rearranged, it answers the other two questions: the overlap isn(A)+n(B)−n(A∪B)n(A) + n(B) - n(A \cup B), and a group size isn(A∪B)−n(B)+n(A∩B)n(A \cup B) - n(B) + n(A \cap B).

Why the formula cannot be short-circuited

Each element of the union falls into exactly one of three groups: only inAA, only inBB, or in both. Addingn(A)+n(B)n(A) + n(B) counts the first group once, the second once, and the third twice.

Son(A)+n(B)=(only A)+(only B)+2(both)n(A) + n(B) = (\text{only } A) + (\text{only } B) + 2(\text{both}), and the union is the same without the extra copy of "both". Subtractingn(A∩B)n(A \cap B) — which is exactly "both" — fixes it.

That is a proof, not a rule of thumb, and it is why the formula is exact rather than approximate. It also shows why a three-set version needs more terms: with three sets an element can be in one, two or three of them, and the alternating signs of full inclusion-exclusion come from correcting each of those over-counts in turn.

The bounds follow:n(A∪B)n(A \cup B) is at leastmax⁡(n(A),n(B))\max(n(A), n(B)) and at mostn(A)+n(B)n(A) + n(B).

Worked example: from counts to the overlap

A survey of 200 people finds 120 read fiction, 90 read history, and 150 read at least one of the two. How many read both?

Step one — name the numbers.n(A)=120n(A) = 120,n(B)=90n(B) = 90,n(A∪B)=150n(A \cup B) = 150.

Step two — rearrange the formula.n(A∩B)=n(A)+n(B)−n(A∪B)n(A \cap B) = n(A) + n(B) - n(A \cup B).

Step three — substitute.120+90−150=60120 + 90 - 150 = 60.

Step four — check consistency. With 60 reading both, the fiction-only group is120−60=60120 - 60 = 60, and the history-only group is90−60=3090 - 60 = 30. Total reading at least one:60+30+60=15060 + 30 + 60 = 150. Agrees.

Step five — check the bounds. 60 is at mostmin⁡(120,90)=90\min(120, 90) = 90, so it is a possible overlap. An overlap larger than the smaller set would have been impossible, and that check alone catches most slips.

By the end you can
  • Compute the size of a union from the two sizes and the overlap
  • Recover the overlap from the union's size
  • Check a union's size against its bounds
Check yourself
  1. 1.n(A)=7n(A) = 7,n(B)=5n(B) = 5,n(A∩B)=2n(A \cap B) = 2. Findn(A∪B)n(A \cup B).
  2. 2.n(A)=7n(A) = 7,n(B)=5n(B) = 5, disjoint. Find the union's size.
  3. 3. Ifn(A∪B)=20n(A \cup B) = 20 andn(A)=n(B)=12n(A) = n(B) = 12, what is the overlap?
Answers
  1. 1. 10.
  2. 2. 12 — no overlap to subtract.
  3. 3.12+12−20=412 + 12 - 20 = 4.
Work out where to start — free, no accountAnswer six real questions — free, no account