2 years ago

# Probability and Statistics

### Inclusion-Exclusion

Question: How many numbers between between $1...100$ that are divisible by $3$ or $4$
let $A$=all numbers from $1...100$ that are divisible by $3$ then $|A|=\left \lfloor \frac{100}{3} \right \rfloor=33$
let $B$=all numbers from $1...100$ that are divisible by $4$ then $|B|=\left \lfloor \frac{100}{4} \right \rfloor=25$
and $A\cup B$ will contains all numbers between $1...100$ that are divisible by $3$ or $4$, so can we apply Sum rule? no, because $A\cap B\ne\emptyset$
$|A\cup B|=|A|+|B|$ would be wrong, and count more because some numbers got over counted, but we can fix it. Because we can see what exactly getting over counted, numbers in $A\cap B$ counted once in $|A|$ and once in $|B|$ means they got counted twice but they supposed to be counted only once, so the fix is the following.
$|A \cup B|=|A|+|B|-|A\cap B|$ (this is the idea, include and exclude in controlled way)
$\therefore ~ |A \cup B|= 33+25-8=50$ ($\because |A\cap B|=\left \lfloor \frac{100}{12} \right \rfloor =8$ )

Similarly if we have three finite sets $A,B,C$ then $|A \cup B \cup C|=|A|+|B|+|C|-|A\cap B|-|B \cap C|-|A\cap C|+|A\cap B\cap C|$

Thoerem(Principle of Inclusion and Exclusion): Let $A_1,A_2,...,A_n$ be finite sets. Then
$|A_1\cup A_2\cup ...\cup A_n|=\sum_{1\le i\le n}|A_i|-\sum_{1\le i
proof: by induction on n(you try using base case for n=2)