<s>[INST] Method of completing squares with 3 variables I want to use the method "completing squares" for this term:
$x^2-2xy +y^2+z^2*a+2xz-2yz$
The result should be $(x-y+z)^2 +(a-1)*z^3$
Is there a "recipe" behind how to do this? Hope someone could help
 [/INST] Aras' answer is really good.  But you might be wondering how one develops intuition and what happens if one doesn't immediately see $x^2 - 2xy + y^2$ is a square. (Part of developing intuition is that this does become obvious.)
This'll get messy. But 
So you have:
$\color {blue}{x^2}-2xy +y^2+z^2*a+2xz-2yz$
And you have an $x^2$ so we'll "complete" x first so take all the x terms and put them nearby.
$\color {blue}{x^2}\color {purple}{-2xy +2xz}+y^2+z^2*a-2yz$
We know that completing the square, the expression will need to start something like this: $x^2 \pm 2*x*something + ....$ so we factor out the $2x$
$\color {blue}{x^2 + 2x}\color {purple}{(z - y)}+y^2+z^2*a-2yz$
Now we know to "complete the square" we must do $x^2 \pm 2x*something \color{green}{+ something^2} \color {red}{- something^2} +...$
So 
$\color {blue}{x^2 + 2x(z - y)} \color{green}{ + (z -y)^2} \color{red}{- (z -y)^2}+y^2+z^2*a-2yz=$
$\color {blue}{(x + (y -z))^2} \color{red}{- (z^2 - 2zy + y^2) }+y^2+z^2*a-2yz$
So let's clean up a little.
$\color {blue}{(x + y -z)^2} \color{red}{- z^2 + 2zy - y^2 }+y^2+z^2*a-2yz$
$\color {blue}{(x + y -z)^2} -z^2  +z^2*a$
So now we need to deal with just the $ ... - z^2 + z^2*a$.  Well we factor out common terms.
$\color {blue}{(x + y -z)^2} +z^2(-1  +a)$
$\color {blue}{(x + y -z)^2} +z^2(a-1)$
</s>