I am trying to evaluate the sum here , $$\sum_{i=1}^n \sum_{j=i+1}^n({(x_i-x_j)}^2+{(y_i-y_j)}^2)$$
How do this sum can be simplified to $$n\sum_{i=1}^n({x_i}^2+{y_i}^2) - {(\sum_{i=1}^n{x_i})}^2-{(\sum_{i=1}^n{y_i})}^2$$ .
I need to understand the intermediate steps here.Thanks in advance