Can't orthogonally diagonalise this symmetric matrix. So I have a symmetric matrix A = $\begin{bmatrix} 2 & 2 & -4 \\ 2 & -1 & -2 \\ -4 & -2 & 2 \end{bmatrix}$ and I want to orthogonally diagonalise it. I know that there are eigenvalues $-2$ and $7$ (-2 with an algebraic multiplicity of two, and a basis $$\left\{{\pmatrix{1\\0\\2}},{\pmatrix{0\\1\\1}}\right\}$$ I, so far, haven't been able to find:


*

*the eigenvector corresponding to 7  (I know from online calculators that it is in fact $\begin{array}{c} 2 \\1\\-2 \end{array}$), but the matrix (A - -7$\lambda$) = $\begin{bmatrix} 2 & 2 & -4 \\ 2 & -1 & -2 \\ -4 & -2 & 2 \end{bmatrix}$ which row reduces down (as calculated online) to $$A = \begin{bmatrix}{} 1 & 0 & 1 \\ 0 & 2 & 1 \\ 0 & 0 & 0 \end{bmatrix}$$ which gives $x = 2y = -z$, which leads to a vector $\begin{array}{c} 1 \\2\\-1 \end{array}$ or similar.

*how to correctly orthonormalize the vectors (by using Pythagoras geometrically, or by Gram-Schmidt?)
and therefore I can't orthogonally diagonalise A.


If you know there are only eigenvalues $-2$ and $7$, then you can eliminate those with eigenvalue $-2$ and be left with the others. This is done by considering
$$
          (A+2I) = \left[\begin{array}{ccc} 4 & 2 & -4 \\ 2 & 1 & -2 \\ -4 & -2 & 4\end{array}\right]
$$
The columns have to be eigevectors with eigenvalue $7$. There is only one independent column, which is what you expect:
$$
                     \left[\begin{array}{c}2 \\ 1 \\ -2\end{array}\right],\;\;\;\;
          A \left[\begin{array}{c}2 \\ 1 \\ -2\end{array}\right]
           = \left[\begin{array}{c}14 \\ 7 \\ -14\end{array}\right]
           = 7\left[\begin{array}{c}2 \\ 1 \\ -2\end{array}\right]
$$
Now consider the case for eigenvalue $-2$:
$$
          (A-7I) = \left[\begin{array}{ccc} -5 & 2 & -4 \\ 2 & -8 & -2 \\ -4 & -2 & -5\end{array}\right]
$$
The column space is two-dimensional; it's obviously not one-dimensional, and you can easily check that the columns are orthogonal to the eigenvector with eigenvalue $7$ given above. So everything checks. If you add the first and the third columns, you find that the following is an eigenvector with eigenvalue $-2$:
$$
               \left[\begin{array}{c} 1 \\ 0 \\ 1 \end{array}\right],
$$
and this one is orthogonal to the middle column. So an orthogonal basis of the eigenspace with eigenvalue $-2$ is
$$
               \left\{ \left[\begin{array}{c} 1 \\ 0 \\ 1 \end{array},\right]
       \left[\begin{array}{c} 1 \\ -4 \\ -1 \end{array}\right]\right\}
$$
If you normalize the column vectors, then you get the required orthogonal change of basis matrix $U$ such that $U^{-1}AU=D=\left[\begin{array}{ccc}7 & 0 & 0 \\ 0 & -2 & 0 \\ 0 & 0 & -2\end{array}\right]$ is a diagonal matrix. The matrix $U$ is
$$
           U = \left[\begin{array}{ccc}
                        2/3 & 1/\sqrt{2} & 1/\sqrt{18}  \\
                        1/3 & 0 &  -4/\sqrt{18} \\
                        -2/3 & 1/\sqrt{2} & -1/\sqrt{18}
                       \end{array}\right]
$$
The matrix $U$ is orthogonal, which means $U^{-1}=U^{T}$.
