I was wondering what the general approach should be when it comes to completing the square with three terms (three terms within the braces being squared). eg.
Write the following function as a sum of multiples of squares of independent linear combinations of its variables:
$$ 2x^2 + 7y^2 + 2z^2 − 8xy + 4xz − 10yz$$
The sample solution given is $$2(x − 2y + z)^2 − (y + z)^2 + z^2$$
Let $E=(ax+by)^2+(cy+dz)^2+(ez+fx)^2$
Comparing coefficients:
$\left \{ \begin{align*} a^2+f^2 &= 2 \\ b^2+c^2 &= 7 \\ d^2+e^2 &= 2 \\ 2ab &= -8 \\ 2ef &= 4 \\ 2cd &= -10 \end{align*} \right.$
With an aid of Mathematica:
$$E= \left( 3x\sqrt{\frac{2}{11}}-\frac{2y\sqrt{22}}{3} \right)^{2}- \left( \frac{5y}{3}+3z \right)^{2}+ \left( \sqrt{11}z+\frac{2x}{\sqrt{11}} \right)^{2}$$
P.S.
Rewriting in quadratic form
$E=\begin{pmatrix} x & y & z \end{pmatrix} \begin{pmatrix} a & h & g \\ h & b & f \\ g & f & c \\ \end{pmatrix} \begin{pmatrix} x \\ y \\ z \end{pmatrix}$
$\displaystyle E= a\left( x+\frac{h}{a} y+\frac{g}{a} z \right)^{2}+ \frac{ab-h^2}{a} \left( y+\frac{af-gh}{ab-h^2}z \right)^{2}+ \frac{abc-af^2-bg^2-ch^2+2fgh}{ab-h^2} z^{2}$
The upper matrix decomposition fails when $ab=h^2$.