# From $xz+yz+xy$ to $\frac{1}{2}(x+y+z)^2 - \frac{1}{2}(x^2 + y^2 + z^2)$

Self learning linear algebra I came to a proof for inner product. Problem doesn't matter, the thing is that within the proof the author makes an step that I honestly don't understand:

....

$xz+yz+xy$

=

$\frac{1}{2}(x+y+z)^2 - \frac{1}{2}(x^2 + y^2 + z^2)$

.... and then the proof continues. Since I want to really learn I can't simply assume it's true, I want to know what am I missing. I get out of high school some time ago and maybe it's obvious for anyone but me, but if you can help me it'll be nice.

-
Multiply $x+y+z$ by $x+y+z$. –  André Nicolas Apr 17 '13 at 20:14

I recall

$$(x+y)^2=x^2+y^2+2xy$$ and $$(x+y+z)^2=x^2+y^2+z^2+2(xy+yz+zx)$$ hence note that in the both above cases the result is the sum of the square of every term plus twice the product of terms taken two by two, hence we generalize this result $$(x_1+x_2+\cdots+x_n)^2=x_1^2+x_2^2+\cdots+x_n^2+2\sum_{i< j}x_i x_j$$

-
Careful, it is $(x_1 + \ldots + x_n)^2 - x_1^2 + \ldots + x_n^2 = \sum_{i \ne j} x_i x_ j = 2 \sum_{i < j} x_ i x_ j$ –  vonbrand Apr 17 '13 at 20:39
@vonbrand you're absolutely right. Thanks –  Sami Ben Romdhane Apr 17 '13 at 21:06
$$(x+y+z)^2 = x^2 + y^2 + z^2 + 2 x z + 2 y z + 2 x y.$$ As you are out of practice, you should carefully confirm this yourself.