Orthogonal Diagonalization of a matrix I am having problem in diagonalization of \begin{bmatrix}-1&-1&-4\\-1&-4&-1\\-4&-1&-1\end{bmatrix}
This is symmetric so it must be orthogonally diagonalizable. The eigen values are $-6,-3,3$. I did all the computations and found an orthogonal matrix $P$ which is \begin{bmatrix}1/\sqrt3&1/\sqrt6&-1/\sqrt2\\1/\sqrt3&-2/\sqrt6&0\\1/\sqrt3&1/\sqrt6&1/\sqrt2\end{bmatrix}
But some how $P^TAP$ is not the diagonal matrix? Can someone please find a mistake for me?
 A: Note: Since $P^T = P^{-1}$ for an orthogonal $P$, the equality $P^T A P = D$ is
the same as $P^{-1} A P = D$.
Your answer is perfectly correct, just not in a simplified form.
We have:
$$P^T A P = \begin{bmatrix}
 -6 & 0 & 0 \\
 \frac{2 \left(-\sqrt{\frac{2}{3}}-\frac{1}{\sqrt{6}}\right)}{\sqrt{3}}+\sqrt{2} & \sqrt{\frac{2}{3}} \left(-\sqrt{\frac{2}{3}}-\frac{1}{\sqrt{6}}\right)-2 & 0 \\
 \frac{-\frac{1}{\sqrt{2}}+2 \sqrt{2}}{\sqrt{3}}+\frac{\frac{1}{\sqrt{2}}-2 \sqrt{2}}{\sqrt{3}} & \frac{-\frac{1}{\sqrt{2}}+2 \sqrt{2}}{\sqrt{6}}+\frac{\frac{1}{\sqrt{2}}-2 \sqrt{2}}{\sqrt{6}} & \frac{-\frac{1}{\sqrt{2}}+2 \sqrt{2}}{\sqrt{2}}-\frac{\frac{1}{\sqrt{2}}-2 \sqrt{2}}{\sqrt{2}} \\
\end{bmatrix}$$
For example, simplifying the bottom rightmost value yields:
$$\frac{-\frac{1}{\sqrt{2}}+2 \sqrt{2}}{\sqrt{2}}-\frac{\frac{1}{\sqrt{2}}-2 \sqrt{2}}{\sqrt{2}}  = \dfrac{3}{2} + \dfrac{3}{2} = 3$$
If we simplify each value in the matrix, it reduces to:
$$P^T A P = \begin{bmatrix}
 -6 & 0 & 0 \\
 0 & -3 & 0 \\
 0 & 0 & 3 \\
\end{bmatrix}$$
This is obviously a diagonal matrix $D$.
