Squared dobule sum expression? Is there a way to get expression for squared double sum?
$$\left(\sum\limits_{i=1}^n \sum\limits_{j=1}^n a_i a_j\right)^2 = \left(\sum\limits_{i=1}^n \sum\limits_{j=1}^n a_i a_j\right)\left(\sum\limits_{k=1}^n \sum\limits_{l=1}^n a_k a_l\right) = ?$$
Something like expression for single squared sum, given here What is the square of summation?.
Thanks in advance.
Edit:
I managed to get next formula by guessing (looking expression for $n=2$):
\begin{align}
\left(\sum\limits_{i=1}^n \sum\limits_{j=1}^n a_i a_j\right)^2 &= \sum\limits_{i=1}^n \sum\limits_{j=1}^n a_i^2 a_j^2 + \sum\limits_{i=1}^n \sum\limits_{j \neq l}^n a_i^2 a_j a_l + \sum\limits_{i \neq k}^n \sum\limits_{j=1}^n a_i a_k a_j^2 + \sum\limits_{i \neq k}^n \sum\limits_{j \neq l}^n a_i a_k a_j a_l \\
&= \sum\limits_{i=1}^n \sum\limits_{j=1}^n a_i^2 a_j^2 + 2\sum\limits_{i \neq k}^n \sum\limits_{j=1}^n a_i a_k a_j^2 + \sum\limits_{i \neq k}^n \sum\limits_{j \neq l}^n a_i a_k a_j a_l
\end{align}
but I don't know is it correct or how to prove it.
 A: The formula is correct.
To derive it, we could start with
\begin{align}
\left(\sum_{i=1}^n \sum_{j=1}^n a_i a_j\right)^2 
&= \left(\sum\limits_{i=1}^n \sum\limits_{j=1}^n a_i a_j\right)\left(\sum\limits_{k=1}^n \sum\limits_{l=1}^n a_k a_l\right) \\
&= \sum_{i=1}^n \sum_{k=1}^n \sum_{j=1}^n \sum_{l=1}^n a_i a_k a_j a_l.
\end{align}
Note that in addition to distributing the $a_i a_j$ terms over the last
two summation symbols, we change the order of summation 
(or more simply we can just swap the symbols $j$ and $k$).
Now let's add up the terms for which $i=k$ separately from the other terms
(that is, the terms for which $i\neq k$):
$$
\sum_{i=1}^n \sum_{k=1}^n \sum_{j=1}^n \sum_{l=1}^n a_i a_k a_j a_l
= \sum_{i=1}^n \sum_{j=1}^n \sum_{l=1}^n a_i^2 a_j a_l
  + \sum_{\substack{i\neq k \\ 1\leq i\leq n \\ 1\leq k\leq n}}
       \sum_{j=1}^n \sum_{l=1}^n a_i a_k a_j a_l.
$$
Next, within each of the two summations on the right-hand side of the
equation above, add up the terms for which $j = l$ separately from
the terms for which $j \neq l$:
\begin{align}
\sum_{i=1}^n \sum_{j=1}^n \sum_{l=1}^n a_i^2 a_j a_l
&= \sum_{i=1}^n \sum_{j=1}^n a_i^2 a_j^2
  + \sum_{i=1}^n \sum_{\substack{j\neq l \\ 1\leq j\leq n \\ 1\leq l\leq n}}
        a_i^2 a_j a_l.
\\
\sum_{\substack{i\neq k \\ 1\leq i\leq n \\ 1\leq k\leq n}}
       \sum_{j=1}^n \sum_{l=1}^n a_i a_k a_j a_l
&= \sum_{\substack{i\neq k \\ 1\leq i\leq n \\ 1\leq k\leq n}}
       \sum_{j=1}^n  a_i a_k a_j^2
   + \sum_{\substack{i\neq k \\ 1\leq i\leq n \\ 1\leq k\leq n}}
     \sum_{\substack{j\neq l \\ 1\leq j\leq n \\ 1\leq l\leq n}}
         a_i a_k a_j a_l.
\end{align}
Add these four parts of the sum all together, accounting for the
fact that
$$
\sum_{i=1}^n \sum_{\substack{j\neq l \\ 1\leq j\leq n \\ 1\leq l\leq n}}
        a_i^2 a_j a_l
= \sum_{\substack{i\neq k \\ 1\leq i\leq n \\ 1\leq k\leq n}}
       \sum_{j=1}^n  a_i a_k a_j^2,
$$
and you have your formula.
