Summation formula proof For $k$ and $l$ $\in n$  how can I prove the following :
$$(\sum_{k=1}^{k=n}\pi_{k}Y_{k}-\sum_{k=1}^{k=n}Y_{k})^2=\sum_{k=1}^{k=n}\sum_{l=1}^{l=n}Y_{k}Y_{l}(\pi_{k}-1)(\pi_{l}-1)$$ . 
I have really tried to prove it but I could not .In fact all what I know about sums rules is that 
$$ (\sum_{k=1}^{k=n}a_{k})^2=\sum_{k=1}^{k=n}a_{k}a_{k}+\sum\sum_{k\neq l}a_{k}a_{l}$$ 
I have tried to use this rule to prove it , but can't solve it by myself, can somebody help me please .
Thanks in advance
 A: Well:
\begin{align}(\sum_{k=1}^{k=n}\pi_{k}Y_{k}-\sum_{k=1}^{k=n}Y_{k})^2& = (\sum_{k=1}^{k=n}\pi_{k}Y_{k}-\sum_{k=1}^{k=n}Y_{k})(\sum_{l=1}^{l=n}\pi_{l}Y_{l}-\sum_{l=1}^{k=l}Y_{l})\\
& =\sum_{k=1}^{k=n}\pi_{k}Y_{k}\sum_{l=1}^{l=n}\pi_{l}Y_{l}-\sum_{k=1}^{k=n}Y_{k}\sum_{l=1}^{l=n}\pi_{l}Y_{l}+\\ & \quad -\sum_{k=1}^{k=n}\pi_{k}Y_{k}\sum_{l=1}^{k=l}Y_{l}+\sum_{k=1}^{k=n}Y_{k}\sum_{l=1}^{k=l}Y_{l}
\end{align}
The second and the third term are the same up to renaming, hence we obtain, using the distributive law
\begin{align}(\sum_{k=1}^{k=n}\pi_{k}Y_{k}-\sum_{k=1}^{k=n}Y_{k})^2
& =\sum_{k=1}^{k=n}\pi_{k}Y_{k}\sum_{l=1}^{l=n}\pi_{l}Y_{l}-2\sum_{k=1}^{k=n}Y_{k}\sum_{l=1}^{l=n}\pi_{l}Y_{l}+\\ & \quad +\sum_{k=1}^{k=n}Y_{k}\sum_{l=1}^{k=l}Y_{l}\\
& =\sum_{k=1}^{k=n}\sum_{l=1}^{l=n}\pi_{k}Y_{k}\pi_{l}Y_{l}-2\sum_{k=1}^{k=n}\sum_{l=1}^{l=n}Y_{k}\pi_{l}Y_{l}+\\ & \quad +\sum_{k=1}^{k=n}\sum_{l=1}^{k=l}Y_{k}Y_{l}\\
& = \sum_{k=1}^{k=n}\sum_{l=1}^{l=n}\left(\pi_{k}Y_{k}\pi_{l}Y_{l}-2Y_{k}\pi_{l}Y_{l}+Y_{k}Y_{l}\right)\\
& = \sum_{k=1}^{k=n}\sum_{l=1}^{l=n}Y_{k}Y_{l}\left(\pi_{k}\pi_{l}-2\pi_{l}+1\right)\\
& = \sum_{k=1}^{k=n}\sum_{l=1}^{l=n}Y_{k}Y_{l}(\pi_{k}-1)(\pi_{l}-1)
\end{align}
A: $$\begin{align}
\left(\sum_{k=1}^n\pi_k Y_k-\sum_{k=1}^nY_{k}\right)^2
&=\left(\sum_{k=1}^n(\pi_k -1)Y_k\right)^2\\
&=\left(\sum_{k=1}^n(\pi_k -1)Y_k\right)\left(\sum_{\ell=1}^n(\pi_\ell -1)Y_\ell\right)\\
&=\sum_{k=1}^n\sum_{\ell=1}^n Y_k Y_\ell(\pi_k -1)(\pi_\ell -1)\\
\end{align}$$
