Expansion of the square of the sum of $N$ numbers
Solution 1:
I think this is well-known, but whether this can be used without proof depends on in which level of mathematics you are studying in. In fact there is an easy proof by induction on $N$.
When $N = 1$, then L.H.S. $ = a_1^2 = $ R.H.S.
Assume $$\left(\sum_{n=1}^N a_n\right)^2 = \sum_{n=1}^N a_n^2 + 2 \sum_{j=1}^N \sum_{i=1}^{j-1} a_ia_j$$
Then \begin{align} \left(\sum_{n=1}^{N+1} a_n\right)^2 & = a_{N+1}^2 + 2a_{N+1}\sum_{n=1}^N a_n + \left(\sum_{n=1}^N a_n\right)^2\\ & = a_{N+1}^2 + 2a_{N+1}\sum_{i=1}^N a_i + \left(\sum_{n=1}^N a_n^2 + 2 \sum_{j=1}^N \sum_{i=1}^{j-1} a_ia_j\right)\\ & = \left(\sum_{n=1}^N a_n^2 + a_{N+1}^2\right) + 2\left(\sum_{j=1}^N \sum_{i=1}^{j-1} a_ia_j + \sum_{i=1}^{(N+1)-1} a_ia_{N+1}\right)\\ & = \sum_{n=1}^{N+1} a_n^2 + 2\sum_{j=1}^{N+1} \sum_{i=1}^{j-1} a_ia_j \end{align}
Solution 2:
There is a simple direct proof.
$$ \left(\sum_{n=1}^N a_n \right)^2 = \left(\sum_{n=1}^N a_n \right)\left(\sum_{m=1}^N a_m \right) = \sum_{n=1}^N \sum_{m=1}^N a_na_m = \sum_{n=1}^N a_n^2 + \sum_{n=1}^N \sum_{m=1\atop m\ne n}^N a_na_m, $$
and for the last sum we have $$ \sum_{n=1}^N \sum_{m=1\atop m\ne n}^N a_na_m = 2 \sum_{n=1}^N \sum_{m=1\atop m < n}^N a_na_m = 2 \sum_{n=1}^N \sum_{m=1}^{n-1} a_na_m. $$