Using the distributive law,
(x1+x2+⋯+xn)2=(x1+x2+⋯+xn)(x1+x2+⋯+xn). When the expression is expanded, each square
x12, x22, …, xn2 appears once.
Every product of two different terms appears twice. For example, x1x2 appears once when x1 is selected from the first factor and x2 from the second, and once again as x2x1.
Therefore,
(x1+x2+⋯+xn)2=x12+x22+⋯+xn2+2x1x2+2x1x3+⋯+2x1xn+2x2x3+⋯+2x2xn+⋯+2xn−1xn.□