equality involving sums 
Let $n\in\mathbb{Z}^+.$ Prove that for $a_{i,j}\in\mathbb{R}$ for $i,j = 1,\cdots, n,$
$$\left(\sum_{i=1}^n \sum_{j=1}^n a_{i,j}\right)^2 + n^2\sum_{i=1}^n\sum_{j=1}^n a_{i,j}^2 - n\sum_{i=1}^n \left(\sum_{j=1}^n a_{i,j}\right)^2 - n\sum_{j=1}^n\left(\sum_{i=1}^n a_{i,j}\right)^2 \\= \frac{1}4\sum_{i,j,k,l=1}^n (a_{i,j} + a_{k,l} - a_{i,l} - a_{k,j})^2.$$

I tried some small cases (e.g. $n=2$ and $n=1$), but I'm not really sure how to generalize the result. Clearly, this is a problem involving summations and it might be useful to use various summation properties, but I'm not sure which properties to use. Expanding the squares and using the fact that different summation indices are "independent" (e.g. $\sum_{i,j,k=1}^n a_{i,j} = n\sum_{i,j=1}^n a_{i,j}$) gives that
\begin{align*}
&\left(\sum_{i,j=1}^n a_{i,j}\right)^2 + n^2\sum_{i, j=1}^n a_{i,j}^2 - n\sum_{i=1}^n\left(\sum_{j=1}^na_{i,j}\right)^2 - n\sum_{j=1}^n \left(\sum_{i=1}^n a_{i,j}\right)^2
\\
&=\sum_{i,j,k,l=1}^n a_{i,j}a_{k,l} + \sum_{i, j,k,l=1}^n a_{i,j}^2 - \sum_{i,k=1}^n\sum_{j,l=1}^na_{i,j}a_{i,l} - \sum_{j,l=1}^n \sum_{i,k=1}^n a_{i,j}a_{k,j}\\
&=\frac{1}4\sum_{i,j,k,l=1}^n[(2a_{i,j}a_{k,l} + 2a_{i,l}a_{k,j}) + (a_{i,j}^2+a_{k,l}^2 + a_{i,l}^2 + a_{k,j}^2)- (2a_{i,j}a_{i,l}+2a_{k,l}a_{k,j}) - (2a_{i,j}a_{k,j} + 2a_{k,l}a_{i,l})]\\
&=\frac{1}4\sum_{i,j,k,l=1}^n(a_{i,j}+a_{k,l}-a_{i,l}-a_{k,j})^2.
\end{align*}

Is this incorrect?

 A: Your approach is nice and correct, by conveniently using the identity $\sum_{i=1}^n 1 =n$ and renaming indices where appropriate.
Here is a cross-check the other way round with a few more intermediate steps.

We obtain
\begin{align*}
\color{blue}{\frac{1}4}&\color{blue}{\sum_{i,j,k,l=1}^n(a_{i,j}+a_{k,l}-a_{i,l}-a_{k,j})^2}\\
&=\frac{1}{4}\sum_{i,j,k,l=1}^n\left(a_{i,j}^2+a_{k,l}^2+a_{i,l}^2+a_{k,j}^2\right.\\
&\qquad\qquad\qquad+2a_{i,j}a_{k,l}-2a_{i,j}a_{i,l}-2a_{i,j}a_{k,j}\\
&\qquad\qquad\qquad\left.-2a_{k,l}a_{i,l}-2a_{k,l}a_{k,j}+2a_{i,l}a_{k,j}\right)\tag{1}\\
&=\frac{1}{4}\sum_{i,j,k,l=1}^n\left(a_{i,j}^2+a_{k,l}^2+a_{i,l}^2+a_{k,j}^2\right)
 +\frac{1}{4}\sum_{i,j,k,l=1}^n\left(2a_{i,j}a_{k,l}+2a_{i,l}a_{k,j}\right)\tag{2}\\
&\qquad-\frac{1}{4}\sum_{i,j,k,l=1}^n\left(2a_{i,j}a_{i,l}+2a_{k,l}a_{k,j}\right)
-\frac{1}{4}\sum_{i,j,k,l=1}^n\left(2a_{i,j}a_{k,j}+2a_{k,l}a_{i,l}\right)\tag{3}\\
&=\sum_{i,j,k,l=1}^n a_{i,j}^2+\sum_{i,j,k,l=1}^n a_{i,j}a_{k,l}
-\sum_{i,j,k,l=1}^na_{i,j}a_{i,l}-\sum_{i,j,k,l=1}^n a_{i,j}a_{k,j}\tag{4}\\
&\,\,\color{blue}{=n^2\sum_{i,j=1}^n a_{i,j}^2+\left(\sum_{i,j=1}^n a_{i,j}\right)^2}\\
&\,\,\qquad\color{blue}{-n\sum_{i=1}^n\left(\sum_{j=1}^na_{i,j}\right)^2
-n\sum_{j=1}^n\left(\sum_{i=1}^n a_{i,j}\right)^2}\tag{5}\\
\end{align*}
and the claim follows.

Comment:

*

*In (1) we multiply out according to the rule $(a+b+c+d)^2=a^2+b^2+c^2+d^2+2(ab+ac+ad+bc+bd+cd)$.


*In (2) we collect the sum of squares and the sum of products where all four indices occur in the terms.


*In (3) we collect the sum where three indices occur in the terms. One sum with equal inner index, the other sum with equal outer index.


*In (4) we simplify by using symmetries of indices.


*In (5) we simplify by using $\sum_{i=1}^n 1 =n$, renaming indices to collect equal sums and applying the distributive law.
