What is the square of summation? 
Consider the following, which one of the following is true ??

$$\left(  \sum^{n-1}_{j=0}Z_j\right)^2 = \sum^{n-1}_{j=0} Z_j^2 +  \sum^{n-1}_{j\neq i} Z_i Z_j$$
OR
$$\left(  \sum^{n-1}_{j=0}Z_j\right)^2 = \sum^{n-1}_{j=0} Z_j^2 +  \sum^{n-1}_{j< i} Z_i Z_j$$
There is a difference between $j \neq i $ and $j < i$ in the above expressions. But I dont know how to think through this.
 A: The following is correct, Using two sigmas instead of one as the following
$$\left(  \sum^{n-1}_{j=0}Z_j\right)^2 = \sum^{n-1}_{j=0} Z_j^2 +\sum^{n-1}_{j=0}\sum^{n-1}_{i\neq j} Z_jZ_i $$ 
A: The first one is correct. Remember that the summation would be applied on all $(i,j)$ pairs that satisfy the very condition. Actually we have $$\sum\limits_{j\neq i}Z_iZ_j=\sum\limits_{j<i}Z_iZ_j+\sum\limits_{j>i}Z_iZ_j=2\sum\limits_{j<i}Z_iZ_j$$
Thus
$$\left(\sum\limits_{j=0}^{n-1}Z_j\right)^2=\sum\limits_{j=0}^{n-1}Z_j^2+\sum\limits_{j\neq i}Z_iZ_j=\sum\limits_{j=0}^{n-1}Z_j^2+2\sum\limits_{j<i}Z_iZ_j$$
A detailed deduction may be
$$\begin{array}{ccl}
\left(\sum\limits_{j=0}^{n-1}Z_j\right)^2&=&\left(\sum\limits_{i=0}^{n-1}Z_i\right)\left(\sum\limits_{j=0}^{n-1}Z_j\right)\\
&=&\sum\limits_{j=0}^{n-1}Z_j\left(Z_j+\sum\limits_{j\neq i}Z_i\right)\\
&=&\sum\limits_{j=0}^{n-1}Z_j^2+\sum\limits_{j\neq i}Z_iZ_j\\
\end{array}$$
You can also think it in the following way. Let each $Z_j$ equal 1. Then $LHS$ would equal $n^2$, which implies that there would be $n^2$ terms totally. Check $RHS$ and you will find the number of such $(i,j)$ pairs that $i<j$ is $\frac{n^2-n}{2}$ while the number of such $(i,j)$ pairs that $i\neq j$ is $n^2-n$. Thus $i\neq j$ should be the correct answer.
