inclusionexclusion
The inclusion-exclusion principle is a fundamental counting principle that determines the size of a union of overlapping sets by compensating for overcounting. It is widely used in combinatorics, probability, and various counting problems to avoid double counting elements that appear in multiple sets.
For two finite sets A and B, the size of their union is |A ∪ B| = |A| + |B|
In probability, for events E1,...,En, P(∪ Ei) = sum P(Ei) − sum P(Ei ∩ Ej) + sum P(Ei ∩ Ej ∩ Ek)
Example: If among 100 people, 60 like A, 50 like B, and 30 like both, then the
The principle helps avoid double counting and undercounting in counting problems, probability calculations, survey sampling, and