Suppose $A_1,...,A_n$ are events, then
$$ P( \bigcup A_i ) = \sum_{i=1}^nP(A_i) - \sum_{i <j}P(A_i \cap A_j) + \sum_{i < j < k}P(A_i\cap A_j \cap A_k) - ... + (-1)^{n+1} P( \bigcap_i A_i) $$
I have shown that this works for the case $n=2$, but I am having difficulty to show that general case. Can we show this by induction? or there is a better way to solve it? thanks
We can write the result more concisely as $$P\left(\bigcup_{i = 1}^n A_i\right) = \sum_{i = 1}^n (-1)^{i-1}\sum_{\underset{|S| = i}{S\subseteq \{1,2,\ldots, n\}}} P(A_S),$$
where $P(A_S) := P(A_{j_1} \cap \cdots \cap A_{j_k})$ if $S = \{j_1,\ldots, j_k\}$. For the inductive step, assume $n > 1$ and the result is true for $n$. Let $A_1,\ldots, A_{n+1}$ be a sequence of $n+1$ events. Let $B_n := A_1 \cup \cdots A_n$. Then
\begin{align} &P\left(\bigcup_{i = 1}^{n+1} A_n\right)\\ &= P(B_n \cup A_{n+1})\\ &= P(B_n) + P(A_{n+1}) - P(B_n\cap A_{n+1})\\ &= \sum_{i = 1}^n (-1)^{i-1}\sum_{\underset{|S| = i}{S\subseteq \{1,2,\ldots, n\}}} P(A_S) + P(A_{n+1}) - P\left(\bigcup_{i = 1}^n (A_i \cap A_{n+1}) \right) & (*)\\ &= \sum_{i = 1}^n (-1)^{i-1}\sum_{\underset{|S| = i}{S\subseteq \{1,2,\ldots, n\}}} P(A_S) + P(A_{n+1}) - \sum_{i = 1}^n (-1)^{i-1} \sum_{\underset{|S| = i}{S\subseteq \{1,2,\ldots, n\}}} P(A_S \cap A_{n+1}) & (**)\\ &= \sum_{i = 1}^n (-1)^{i-1} \sum_{\underset{|S| = i,\, n+1\notin S}{S\subseteq \{1,2,\ldots,n+1\}}} P(A_S) + P(A_{n+1}) + \sum_{i = 2}^{n+1} (-1)^{i-1} \sum_{\underset{|S| = i,\, n+1\in S}{S\subseteq \{1,2,\ldots, n+1\}}} P(A_S)\\ &= \sum_{i = 1}^{n+1} (-1)^{i-1} \sum_{\underset{|S| = i}{S\subseteq \{1,2,\ldots, n+1\}}} P(A_S), \end{align}
as desired. (Note: The induction hypothesis was used in (*) and (**).)