Probability & Combinatorics
Advanced

Inclusion-Exclusion (3 sets)

Counts the union of overlapping sets without double counting.

Formula

∣A∪B∪C∣=∣A∣+∣B∣+∣C∣−∣A∩B∣−∣A∩C∣−∣B∩C∣+∣A∩B∩C∣|A\cup B\cup C| = |A|+|B|+|C|-|A\cap B|-|A\cap C|-|B\cap C|+|A\cap B\cap C|

Variables

A,B,CSets

Example

Corrects for all overlaps systematically

How it works

When you add |A|, |B|, and |C|, any element that lies in more than one set gets counted more than once. Subtracting the pairwise intersections removes those extra counts, but elements in all three sets were subtracted too many times, so |A\cap B\cap C| must be added back once to restore the correct total. This is the three-set version of inclusion-exclusion: count everything once, correct the overcounting, then fix the overcorrection.

When to use it

Use this when you need the size of a combined group made from three overlapping categories, such as students taking multiple classes, survey respondents with overlapping traits, or items satisfying several conditions. It is especially useful in probability and counting problems where direct counting would double count overlaps.

Worked example, step by step

Suppose a club has three event lists: A has 18 members, B has 22 members, and C has 15 members. Also, |A∩B| = 6, |A∩C| = 5, |B∩C| = 4, and |A∩B∩C| = 2. Use inclusion-exclusion: |A∪B∪C| = |A| + |B| + |C| - |A∩B| - |A∩C| - |B∩C| + |A∩B∩C| |A∪B∪C| = 18 + 22 + 15 - 6 - 5 - 4 + 2 |A∪B∪C| = 55 - 15 + 2 |A∪B∪C| = 42 So, 42 members are on at least one of the three event lists.

Common mistakes to avoid

  • Forgetting to add back the triple intersection after subtracting pairwise overlaps
  • Using the formula for probabilities without converting counts to probabilities or vice versa
  • Treating the pairwise intersections as disjoint and subtracting them in the wrong way

Did You Know?

Generalizes to any number of sets with alternating signs.

Share this formula

Reviewed & maintained by the FormulaWon editorial teamLast reviewed September 2026