Symmetric matrix (completing the square/diagonal form) Let $A=\begin{pmatrix} 0 & -2 & 1 \\ -2 & 1 & 2 \\ 1 & 2 & 0 \end{pmatrix} \in M_3(\mathbb{R})$.
I want to find an invertible matrix $C$ such that $C^TAC=\begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & -1 \end{pmatrix}$, since there are three eigenvalues, two of them are positive, one is negative.
I want to use completing the square with the bilinear form $s(v,v)=\langle v,Av \rangle$:
$s(v,v)= \langle v,Av \rangle=(v_1,v_2,v_3)\begin{pmatrix} 0 & -2 & 1 \\ -2 & 1 & 2 \\ 1 & 2 & 0 \end{pmatrix}\begin{pmatrix} v_1\\v_2\\v_3 \end{pmatrix}=-4v_1v_2+2v_1v_3+v_2^2+4v_2v_3$
Now I tried to use the formula $ax^2+bx=a(x+\frac{b}{2a})^2-\frac{b^2}{2a}$, but there is no $v_1^2$.
So I started with $v_2^2$:
$s(v,v)=(v_2+2v_3)^2-4v_1v_2+2v_1v_3-4v_3^2$
Here I don't see how to use completing the square again with $-4v_1v_2+2v_1v_3$, since $v_1^2$ is not available. Is there a method how to continue?
 A: Perhaps not what you're looking for but we can diagonalize the symmetric matrix $A$ as
$$P^TAP =\begin{pmatrix}
 -\frac{1}{\sqrt{3}} & -\frac{1}{\sqrt{6}} & \frac{1}{\sqrt{2}} \\
 -\frac{1}{\sqrt{3}} & \frac{2}{\sqrt{6}} & 0 \\
 \frac{1}{\sqrt{3}} & \frac{1}{\sqrt{6}} & \frac{1}{\sqrt{2}} \\
\end{pmatrix} \begin{pmatrix} 0 & -2 & 1 \\ -2 & 1 & 2 \\ 1 & 2 & 0 \end{pmatrix}\begin{pmatrix}
 -\frac{1}{\sqrt{3}} & -\frac{1}{\sqrt{3}} & \frac{1}{\sqrt{3}} \\
 -\frac{1}{\sqrt{6}} & \frac{2}{\sqrt{6}} & \frac{1}{\sqrt{6}} \\
 \frac{1}{\sqrt{2}} & 0 & \frac{1}{\sqrt{2}} \\
\end{pmatrix}= \begin{pmatrix} -3 & 0 & 0 \\ 0 & 3 & 0 \\ 0 & 0 & 1 \end{pmatrix}$$
so for $u = P^Tv$ we have
$$\langle Av,v\rangle = \langle A(Pu),(Pu)\rangle = \langle P^TAPu,u\rangle = -3u_1^2+3u_2^2+u_3^2$$
This turns out to be 
\begin{align}
\langle Av,v\rangle &= -3 \left(-\frac{v_1}{\sqrt{3}} - \frac{v_2}{\sqrt{3}} + \frac{v_3}{\sqrt{3}}\right)^2 + 
 3 \left(-\frac{v_1}{\sqrt{6}} + \sqrt{\frac23}v_2 + \frac{v_3}{\sqrt{6}}\right)^2 +\left(\frac{v_1}{\sqrt{2}} + \frac{v_3}{\sqrt{2}}\right)^2\\
&= \left(-\frac{v_1}{\sqrt{2}} + \sqrt{2}v_2 + \frac{v_3}{\sqrt{2}}\right)^2+ \left(\frac{v_1}{\sqrt{2}} + \frac{v_3}{\sqrt{2}}\right)^2-(-v_1-v_2+v_3)^2\\
\end{align}
A: A useful technique in situations like this is to make the change of coordinates $x_1\to y_1+y_2, x_2\to y_1-y_2$ or some variation thereof. (This derives from a polarization identity for bilinear forms.) In this case, the quadratic form becomes $$-3y_1^2-2y_1y_2+6y_1x_3+5y_2^2-2y_2x_3.$$ You can now proceed to complete squares in the way that you’re used to. One possible result is $$-3\left(y_1+\frac13y_2-x_3\right)^2+\frac{16}3\left(y_2-\frac38x_3\right)^2+\frac94x_3^2.$$ Substituting for $y_1$ and $y_2$ then produces $$-3\left(\frac23x_1+\frac13x_2-x_3\right)^2 + \frac{16}3\left(\frac12x_1-\frac12x_2-\frac38x_3\right)^2 + \frac94x_3^2.$$
