I'm trying to understand a passage in the proof of Borel Cantelli Lemma 2.
Be $(\Omega, \mathcal{F}, P)$ a probability space and $(A_n)$ a sequence in $\mathcal{F}$ such that $(A_n)$ are pair independent. If $$\sum^{+\infty} P(A_n) = +\infty \qquad \quad \text{then} \qquad P(\text{lim sup}_n A_n) = 1$$
_ Part of Proof_
We start by denotng $S_n = \sum_{k}^n \mathbb{1}_{A_k}$; $\quad$ $S = \sum_{k}^{+\infty} \mathbb{1}_{A_k}$; $\quad$ $a_n = \int S_n \text{d}P = \sum^n P(A_n)$
Then from pair independence
\begin{equation*} \begin{split} \int (S_n - a_n)^2\ \text{d}P & = \sum_{i, k}^n \int \left(\mathbb{1}_{A_i}- P(A_i)\right)\left(\mathbb{1}_{A_k}- P(A_k)\right)\ \text{d}P \\\\ & = \color{red}{\sum_{i}^n \int\left(\mathbb{1}_{A_i}- P(A_i)\right)^2\ \text{d}P} \\\\ & = \color{blue}{\sum_i^n P(A_i)(1 - P(A_i))} \leq a_n \end{split} \end{equation*}
I think I got why in the end it's $\leq a_n$ but the not-understood passage is the red coloured one that turns into blue coloured one. How does one obtain that?
Thank you!
The proof is much simpler: by definition $\limsup A_n=\cap_n B_n$ where $B_n=\cup_{i=n}^\infty A_i$. By the continuity of probability, since $B_n^c$ is a decreasing sequence of events, $1-P(\limsup A_n)=P(\cap B_n^c)=P(A_n^c)P(A_{n+1}^c)P(A_{n+2}^c)\dots$ by independence. But this equals $(1-P(A_n))(1-P(A_{n+1}))(1-P(A_{n+2}))\dots=0$ since $\sum_{i=n}^\infty P(A_i)<\infty$.