TITLE: How do you orthogonally diagonalize the matrix?
QUESTION [8 upvotes]: How do you orthogonally diagonalize the matrix A?
Matrix A =
$$
\begin{bmatrix}
1 & 1 & 1 \\
1 & 1 & 1 \\
1 & 1 & 1 
\end{bmatrix}
$$

REPLY [14 votes]: Since the matrix $A$ is symmetric, we know that it can be orthogonally diagonalized. We first find its eigenvalues by solving the characteristic equation:
$$0=\det(A-\lambda I)=\begin{vmatrix}
1-\lambda & 1 & 1 \\
1 & 1-\lambda & 1 \\
1 & 1 & 1-\lambda
\end{vmatrix}=-(\lambda-3)\lambda^2 \implies \left\{\begin{array}{l l}
\color{red}{\lambda_1 = 0} \\
\color{green}{\lambda_2 = 0} \\
\color{blue}{\lambda_3 = 3}
\end{array}\right.$$
We now find the eigenvectors corresponding to $\lambda=0$:
$$\left(\begin{array}{ccc|c}
1 & 1 & 1 & 0 \\
1 & 1 & 1 & 0 \\
1 & 1 & 1 & 0
\end{array}\right) \implies \left(\begin{array}{ccc|c}
1 & 1 & 1 & 0 \\
0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0
\end{array}\right) \implies \mathbf{x}=\pmatrix{s\\t\\-s-t}=s\pmatrix{1\\0\\-1}+t\pmatrix{0\\1\\-1}$$
By orthonormalizing them, we obtain the basis
$$\left\{\color{red}{\frac{1}{\sqrt{2}}\pmatrix{1\\0\\-1}},\color{green}{\frac{1}{\sqrt{6}}\pmatrix{-1\\2\\-1}}\right\}$$
We finally find the eigenvector corresponding to $\lambda=3$:
$$\left(\begin{array}{ccc|c}
-2 & 1 & 1 & 0 \\
1 & -2 & 1 & 0 \\
1 & 1 & -2 & 0
\end{array}\right) \implies \left(\begin{array}{ccc|c}
0 & -3 & 3 & 0 \\
1 & -2 & 1 & 0 \\
0 & 3 & -3 & 0
\end{array}\right) \implies \left(\begin{array}{ccc|c}
0 & -1 & 1 & 0 \\
1 & -1 & 0 & 0 \\
0 & 0 & 0 & 0
\end{array}\right) \implies \mathbf{x}=\pmatrix{s\\s\\s}=s\pmatrix{1\\1\\1}$$
By normalizing it, we obtain the basis
$$\left\{\color{blue}{\frac{1}{\sqrt{3}}\pmatrix{1\\1\\1}}\right\}$$
Hence $A$ is orthogonally diagonalized by the orthogonal matrix
$$P=\pmatrix{\color{red}{1/\sqrt{2}}&\color{green}{-1/\sqrt{6}}&\color{blue}{1/\sqrt{3}}\\\color{red}{0}&\color{green}{2/\sqrt{6}}&\color{blue}{1/\sqrt{3}}\\\color{red}{-1/\sqrt{2}}&\color{green}{-1/\sqrt{6}}&\color{blue}{1/\sqrt{3}}}$$
Furthermore,
$$P^{T}AP=\pmatrix{\color{red}{0}&0&0\\0&\color{green}{0}&0\\0&0&\color{blue}{3}}$$