Inclusion-Exclusion for Counting
## Formula
For two sets $$a$$ and $$b$$:
$$n(A\cup B)=n(A)+n(B)-n(A\cap B)$$
For three sets:
$$n(A\cup B\cup C)=n(A)+n(B)+n(C)-n(A\cap B)-n(B\cap C)-n(C\cap A)+n(A\cap B\cap C)$$
## Usage
- Used when different counting cases overlap and direct addition would cause overcounting.
---