Toolkit 24

Square of a sum (n terms)

(x1+x2++xn)2=x12++xn2+2x1x2++2xn1xn(x_1+x_2+\cdots+x_n)^2=x_1^2+\cdots+x_n^2+2x_1x_2+\cdots+2x_{n-1}x_n

Proof

Using the distributive law,

(x1+x2++xn)2=(x1+x2++xn)(x1+x2++xn).\begin{aligned} (x_1+x_2+\cdots+x_n)^2 &= (x_1+x_2+\cdots+x_n)(x_1+x_2+\cdots+x_n). \end{aligned}

When the expression is expanded, each square

x12, x22, , xn2x_1^2,\ x_2^2,\ \ldots,\ x_n^2

appears once.

Every product of two different terms appears twice. For example, x1x2x_1x_2 appears once when x1x_1 is selected from the first factor and x2x_2 from the second, and once again as x2x1x_2x_1.

Therefore,

(x1+x2++xn)2=x12+x22++xn2+2x1x2+2x1x3++2x1xn+2x2x3++2x2xn++2xn1xn.\begin{aligned} (x_1+x_2+\cdots+x_n)^2 &= x_1^2+x_2^2+\cdots+x_n^2 \\ &\quad + 2x_1x_2+2x_1x_3+\cdots+2x_1x_n \\ &\quad + 2x_2x_3+\cdots+2x_2x_n \\ &\quad + \cdots \\ &\quad + 2x_{n-1}x_n. \quad\square \end{aligned}