The page built the principle from two sets to the general n-set formula, derived its complementary form, and applied that form to derangements and several other standard problems. The table below collects the formula variants alongside the situations each one solves.
| Form |
Formula |
When to use |
Example |
| Two sets |
|A ∪ B| = |A| + |B| − |A ∩ B| |
two overlapping groups; correct for the double-count once |
18 French + 15 Spanish − 7 both = 26 |
| Three sets |
singles − pairs + triple |
three overlapping conditions; one over-correction needs adding back |
multiples of 2, 3, or 5 in 1..100: 74 |
| n sets (union form) |
Σk=1n (−1)k+1 Σ |k-fold intersections|; 2n − 1 terms total |
general count of a union of n overlapping sets |
any union problem with explicit intersection sizes |
| n sets (complementary form) |
|U| − Σ |Ai| + Σ |Ai ∩ Aj| − … + (−1)n |A₁ ∩ … ∩ An| |
"satisfy NONE of the conditions" / "avoid all forbidden cases" |
integers in 1..100 coprime to 30: 26 |
| Derangement specialization |
!n = n! · Σk=0n (−1)k ⁄ k! ≈ n! ⁄ e |
no item lands in its own original position |
shuffled hats: probability no one gets own hat → 1⁄e |