We’ll solve this problem with the help of the computer.
We get \(c_A(x)=x(x-9)^2\text{,}\) so our eigenvalues are \(0\) and \(9\text{.}\) For \(0\) we have \(E_0(A) = \nll(A)\text{:}\)
For \(9\) we have \(E_9(A) = \nll(A-9I)\text{.}\)
The approach above is useful as we’re trying to remind ourselves how eigenvalues and eigenvectors are defined and computed. Eventually we might want to be more efficient. Fortunately, there’s a command for that.
Note that the output above lists each eigenvalue, followed by its multiplicity, and then the associated eigenvectors.
This gives us a basis for \(\R^3\) consisting of eigenvalues of \(A\text{,}\) but we want an orthogonal basis. Note that the eigenvector corresponding to \(\lambda = 0\) is orthogonal to both of the eigenvectors corresponding to \(\lambda =9\text{.}\) But these eigenvectors are not orthogonal to each other. To get an orthogonal basis for \(E_9(A)\text{,}\) we apply the Gram-Schmidt algorithm.
This gives us an orthogonal basis of eigenvectors. Scaling to clear fractions, we have
\begin{equation*}
\left\{\bbm 2\\1\\2\ebm, \bbm -1\\2\\0\ebm, \bbm -4\\-2\\5\ebm\right\}
\end{equation*}
From here, we need to normalize each vector to get the matrix \(P\text{.}\) But we might not like that the last vector has norm \(\sqrt{45}\text{.}\) One option to consider is to apply Gram-Schmidt with the vectors in the other order.
That gives us the (slightly nicer) basis
\begin{equation*}
\left\{\bbm 2\\1\\2\ebm, \bbm -1\\0\\1\ebm, \bbm 1\\-4\\1\ebm\right\}\text{.}
\end{equation*}
The corresponding orthonormal basis is
\begin{equation*}
B = \left\{\frac{1}{3}\bbm 2\\1\\2\ebm, \frac{1}{\sqrt{2}}\bbm -1\\0\\1\ebm, \frac{1}{\sqrt{18}}\bbm 1\\-4\\1\ebm\right\}\text{.}
\end{equation*}
This gives us the matrix \(P=\bbm 2/3\amp -1/\sqrt{2}\amp 1/\sqrt{18}\\1/3\amp 0 \amp -4/\sqrt{18}\\2/3\amp 1/\sqrt{2}\amp 1/\sqrt{18}\ebm\text{.}\) Let’s confirm that \(P\) is orthogonal.
Since \(PP^T=I_3\text{,}\) we can conclude that \(P^T=P^{-1}\text{,}\) so \(P\) is orthogonal, as required. Finally, we diagonalize \(A\text{.}\)
Incidentally, the SymPy library for Python does have a diagaonalization routine; however, it does not do orthogonal diagonalization by default. Here is what it provides for our matrix \(A\text{.}\)