Double summation problem (please help) I have to calculate this double summation but I am not sure I am doing it the correct way. Could you please help me with it?
The equation is: $$\sum_{i=1}^{n-1} \sum_{j=i+1}^n X_i X_j. $$
So, for example, if I have $\boldsymbol{n=4}$, with $$m_1:=X_1; \quad m_2:=X_2; \quad m_3:=X_3; \quad m_4:=X_4;$$ the equation then becomes $$\sum_{i=1}^{3}  \sum_{j=i+1}^4 X_i X_j = (m_1*m_2)+(m_2*m_3)+(m_3*m_4)+(m_2*m_1)\\{}+(m_2*m_2)+(m_2*m_3)+(m_3*m_1)+(m_3*m_2)+(m_3*m_3) $$
Please correct me if I am wrong and thanks in advance for your help.

$\def\rj{\color{red}}$
$\def\az{\color{blue}}$
$\def\nr{\color{red}}$
$\def\pp{\color{blue}}$
\begin{align} 
   \sum_{\az{i=1}}^{\az{n-1}} \rj{f(\az{i})} 
&= \rj{f(\az{1})} +\rj{f(\az{2})} +\ldots +\rj{f(\az{n-2})} +\rj{f(\az{n-1})}.\\
   \sum_{\az{i=1}}^{\az{3}} \rj{\sum_{j=\az{i}+1}^{4} X_{\az{i}} X_j}
&= \left(\rj{\sum_{j=\az{1}+1}^{4} X_{\az{1}} X_j}\right) 
  +\left(\rj{\sum_{j=\az{2}+1}^{4} X_{\az{2}} X_j}\right)
  +\left(\rj{\sum_{j=\az{3}+1}^{4} X_{\az{3}} X_j}\right)\\[0.5em]
&= \left(\sum_{\pp{j=2}}^{\pp{4}} \nr{X_1 X_{\pp{j}}}\right) 
  +\left(\sum_{\pp{j=3}}^{\pp{4}} \nr{X_2 X_{\pp{j}}}\right)
  +\left(\sum_{\pp{j=4}}^{\pp{4}} \nr{X_3 X_{\pp{j}}}\right)\\ 
&= (\nr{X_{1} X_{\pp{2}}} +\nr{X_{1} X_{\pp{3}}} +\nr{X_{1} X_{\pp{4}}})
  +(\nr{X_{2} X_{\pp{3}}} +\nr{X_{2} X_{\pp{4}}})
  +(\nr{X_{3} X_{\pp{4}}}).
\end{align}
