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.
What is $X_0$?
But finish steeping through all the values of $j$ before incrementing $i.$
$m_1m_2 + m_1m_3 + m_1m_4 + m_2m_3 + m_2m_4 + m_3m_4$