Summation of the Matrix of a Squared Sum I find that:
$$\Big(\sum_{i = 1}^n y_i\Big)^2 = \sum_{i=1}^m y_i^2 + \sum^m_{i\neq j}y_iy_j$$
where $m=(n^2-n)=n(n-1)$, the first part of the right side is the sum of the main diagonal of the matrix, and the second part is the sum of the upper and lower part of the matrix.
Then it is write that the second part can be written as:
$$\sum^m_{i\neq j}y_iy_j = 2\sum_{i=1}^n\sum_{j>i}^ny_iy_j$$
I think that this last point is not correct, in fact if we have $y_jy_i=k$, where $k$ is a constant we obtain:
$$ n(n-1)k \neq2n^2 $$
Furthermore, I think that $j = i-1$ should be better than $j>1$.
So, where is my mistake in the second part of the summation? And what about the $j$ index?
 A: You have a good notion about diagonal and lower/upper part of matrix but your equations are wrong. Let $Y = [y_1, \dots, y_n]^T$, and
$$YY^T = 
 \begin{pmatrix}
  y_1^2 & y_1y_2 & \cdots & y_1y_n \\
  y_2y_1 & y_2^2 & \cdots & y_2y_n \\
  \vdots  & \vdots  & \ddots & \vdots  \\
  y_ny_1& y_ny_2 & \cdots & y_n^2 
 \end{pmatrix}$$
Now you already said $(\sum_{i=1}^ny_i)^2$ is equal to sum of all elements of matrix $YY^T$. So it should be
$$(\sum_{i=1}^ny_i)^2 = \sum_{i=1}^ny_i^2 + \sum_{i=1}^n\sum_{j=i+1}^n y_iy_j + \sum_{i=1}^n\sum_{j=1}^{i-1} y_iy_j$$
where the right side terms are in order: diagonal elements, upper triangle and lower triangle elements. Now it's clear that $YY^T$ is symmetrical, thus 
$$\sum_{i=1}^n\sum_{j=i+1}^n y_iy_j = \sum_{i=1}^n\sum_{j=1}^{i-1} y_iy_j$$
and note that we can also express it as
$$\sum_{i=1}^n\sum_{j=i+1}^n y_iy_j + \sum_{i=1}^n\sum_{j=1}^{i-1} y_iy_j = \sum_{\substack{
   1\le i \le n \\
   1\le j \le n \\
   i \neq j
  }}y_iy_j = \sum_{i \neq j} y_iy_j$$
where the last sum is valid only when we assume index ranges are known implicitly. And lastly, we do not write 
$$\sum_{i\neq j}^m y_iy_j$$
because the subsprict $i \neq j$ means we sum over a set 
$$\{(i,j)\ |\ 1\le i,j \le n, i \neq j\}$$
and the $m$ doesn't bring any new information.
A: J should go like this - $ j = (i+1) \rightarrow  n $
You don't have to use it like this, but this summation order insures the two values will multiply only once (think of it as the upper triangle of a matrix)
