# Put quadratic form into sum of squares

Is there a method or process that doesn't require a matrix to put quadratic forms into a sum of squares ?

Two examples that I find extremely challenging.

i)

$q(x, y, z) = (x − y) ^2 + (y − z) ^2 − (z − x) ^2$

ii) Finding the linear forms that constitute the orthogonal matrix that diagonalizes the symmetric matrix:

$M= \begin{bmatrix}3&1&-3/2\\1&1&0\\-3/2&0&0 \end{bmatrix}$

the quadratic form should look something like this:

$q(x,y,z) =3x^2 + 2xy -3xz+y^2$

Not looking for the solution, but for a method I can apply in most cases.

• Isn’t (i) already a sum of squares? – amd Sep 4 '17 at 3:20

Let's tackle your second quadratic form. Start by choosing one of the variables which appears as a square (if there isn't such a variable, you can always make a change of variables to get one). Let's start with $y$. This variable appears only with $x,y$ so we should try and complete the square to get all the terms that occur. In our case,

$$3x^2 + 2xy - 3xz + y^2 = (y + x)^2 + 2x^2 - 3xz.$$

This way, we have eliminated $y$ from the problem and now we handle only $2x^2 - 3xz$ in which $y$ doesn't appear and repeat the process. Then

$$2x^2 - 3xz = \left( \sqrt{2}x - \frac{3}{2\sqrt{2}}z \right)^2 - \frac{9}{8}z^2$$

so the final answer can be

$$q(x,y,z) = (y + x)^2 + \left( \sqrt{2}x - \frac{3}{2\sqrt{2}}z \right)^2 - \frac{9}{8}z^2.$$

If we would have started with $x$, the process would look like this:

$$q(x,y,z) = 3x^2 + 2xy - 3xz + y^2 = \left( \sqrt{3}x + \frac{1}{\sqrt{3}}y - \frac{\sqrt{3}}{2}z \right)^2 + \frac{2}{3}y^2 - \frac{3}{4}z^2.$$