Skip to main content

MATH 345: Linear Algebra and Optimization

Section 5.3 Symmetric matrices and orthogonal diagonalization

A symmetric matrix, as defined in Definitionย 1.2.19, is especially well behaved. Its eigenvectors can be chosen to form an orthonormal basis; recall Definitionย 4.1.1. Thus diagonalization uses a rigid change of coordinates that preserves dot products and lengths. This section develops that structure before applying it to quadratic forms.

Subsection Orthogonality of eigenvectors, orthogonal matrices, and orthogonal diagonalization

A key property of symmetric matrices is that for any two vectors \(\mathbf{x}\) and \(\mathbf{y}\text{,}\) \((A \mathbf{x}) \cdot \mathbf{y} = \mathbf{x} \cdot (A\mathbf{y})\text{.}\) Indeed, we calculate that
\begin{align*} (A\mathbf{x}) \cdot \mathbf{y} \amp = (A\mathbf{x})^T\mathbf{y}\\ \amp = \mathbf{x}^TA^T\mathbf{y}\\ \amp = \mathbf{x}^TA\mathbf{y} \quad \text{(since } A^T = A\text{)}\\ \amp = \mathbf{x} \cdot (A\mathbf{y}) \end{align*}
This property leads to a fundamental result about the eigenvectors of symmetric matrices.

Why is this true?.

Let \(A\mathbf{x} = \lambda\mathbf{x}\) and \(A\mathbf{y} = \mu\mathbf{y}\text{,}\) where \(\lambda \neq \mu\text{.}\) Using the property above:
\begin{align*} \lambda(\mathbf{x} \cdot \mathbf{y}) \amp = (\lambda\mathbf{x}) \cdot \mathbf{y}\\ \amp = (A\mathbf{x}) \cdot \mathbf{y}\\ \amp = \mathbf{x} \cdot (A\mathbf{y})\\ \amp = \mathbf{x} \cdot (\mu\mathbf{y})\\ \amp = \mu(\mathbf{x} \cdot \mathbf{y}) \end{align*}
This gives us \((\lambda - \mu)(\mathbf{x} \cdot \mathbf{y}) = 0\text{.}\) Since \(\lambda \neq \mu\text{,}\) we must have \(\mathbf{x} \cdot \mathbf{y} = 0\text{,}\) which means the eigenvectors are orthogonal.
As we will see, it turns out that for any symmetric matrix, there exists a pairwise orthogonal set of eigenvectors which form a basis of \(\R^n\text{.}\) In particular, every symmetric matrix is diagonalizable.
Recall from Definitionย 2.5.52 that a square matrix \(Q\) is orthogonal if \(Q^T = Q^{-1}\text{.}\)

Why is this true?.

Let us start by showing the first property is equivalent to the third. Suppose \(Q\) is invertible, and \(Q^{-1} = Q^T\text{.}\) Let \(\mathbf{v}_1, \dots, \mathbf{v}_n\) be the columns of \(Q\text{.}\) Recall from Theoremย 1.4.3 that the \((i,j)\)-entry of \(Q^T Q\) is equal to the dot product \(\mathbf{v}_i \cdot \mathbf{v}_j\text{.}\) Since \(Q^{-1} = Q^T\text{,}\) \(Q^T Q = I\text{,}\) and so for \(i \neq j\text{,}\) \(\mathbf{v}_i \cdot \mathbf{v}_j = 0\text{,}\) and for each \(i\text{,}\) \(\mathbf{v}_i \cdot \mathbf{v}_i = 1\text{.}\) Thus the column vectors \(\mathbf{v}_1,\dots,\mathbf{v}_n\) are orthonormal. Conversely, if the column vectors \(\mathbf{v}_1,\dots,\mathbf{v}_n\) are orthonormal, then we immediately see that \(Q^T Q = I\text{.}\)
The proof that the first property is equivalent to the second is very similar, using the rows of \(Q\) rather than the columns and that if \(Q^T Q = I\text{,}\) then \(Q Q^T = I\text{,}\) and vice versa.

Why is this true?.

Let \(\mathbf{v}\) and \(\mathbf{w}\) be column vectors. Recalling the fifth property of Theoremย 1.4.7, we calculate that
\begin{align*} (Q\mathbf{v}) \cdot (Q\mathbf{w}) \amp = (Q\mathbf{v})^T(Q\mathbf{w})\\ \amp = \mathbf{v}^T Q^T Q \mathbf{w}\\ \amp = \mathbf{v}^T I_n \mathbf{w}\\ \amp = \mathbf{v}^T \mathbf{w}\\ \amp = \mathbf{v} \cdot \mathbf{w}\text{.} \end{align*}
Thus \(Q\) preserves dot products.
Next, using that \(Q\) preserves dot products, and also Noteย 1.1.21, we find
\begin{equation*} \| Q\mathbf{v} \|^2 = (Q \mathbf{v}) \cdot (Q \mathbf{v}) = \mathbf{v} \cdot \mathbf{v} = \| \mathbf{v} \|^2\text{.} \end{equation*}
Taking square roots on both sides of this equation gives \(\|Q\mathbf{v}\| = \|\mathbf{v}\|\text{.}\)
Figureย 5.3.4 provides a visualization of an orthogonal change of coordinates.
A cube and its rotated image under an orthogonal matrix.
A gray reference cube is shown behind a colored image cube obtained by applying an orthogonal matrix \(Q\text{.}\) The colored cube has red, blue, and green faces and is labeled with the images \(f(\mathbf{e}_1)\text{,}\) \(f(\mathbf{e}_2)\text{,}\) and \(f(\mathbf{e}_3)\text{.}\) The image cube is rotated relative to the gray cube, but its edge lengths and angles are preserved.
Figure 5.3.4. The effect of applying the linear map \(\mathbf{f}(\mathbf{x}) = Q\mathbf{x}\) to a cube, where \(Q\) is orthogonal. Notice that the map is โ€œrigidโ€, i.e., applying the map to the cube results in a cube with the same dimensions. Adapted from: Stanfordโ€™s MATH 51 textbook.

Definition 5.3.5. Orthogonal diagonalizability.

A matrix \(A\) is orthogonally diagonalizable when an orthogonal matrix \(Q\) can be found such that \(Q^{-1}A Q\) is a diagonal matrix. Since \(Q^{-1} = Q^T\text{,}\) this is equivalent to \(Q^T A Q\) being a diagonal matrix.

Activity 5.3.6. Checking eigenvectors and orthogonality (U5-LO1, U4-LO1).

Consider the symmetric matrix
\begin{equation*} A = \begin{bmatrix} 2 \amp -1 \\ -1 \amp 2 \end{bmatrix} \end{equation*}
Check that the vectors
\begin{equation*} \mathbf{u} = \begin{bmatrix} 1 \\ 1 \end{bmatrix} \quad\text{and}\quad \mathbf{v} = \begin{bmatrix} 1 \\ -1 \end{bmatrix} \end{equation*}
are eigenvectors of \(A\) which are orthogonal to each other. What are the corresponding eigenvalues?
Solution.
The vectors \(\mathbf{u}\) and \(\mathbf{v}\) are eigenvectors of \(A\) with eigenvalues \(\lambda_1 = 1\) and \(\lambda_2 = 3\) respectively, since
\begin{equation*} A\mathbf{u} = \begin{bmatrix} 2 \amp -1 \\ -1 \amp 2 \end{bmatrix} \begin{bmatrix} 1 \\ 1 \end{bmatrix} = \begin{bmatrix} 1 \\ 1 \end{bmatrix} = 1\mathbf{u} \end{equation*}
and
\begin{equation*} A\mathbf{v} = \begin{bmatrix} 2 \amp -1 \\ -1 \amp 2 \end{bmatrix}\begin{bmatrix} 1 \\ -1 \end{bmatrix} = \begin{bmatrix} 3 \\ -3 \end{bmatrix} = 3\mathbf{v} \end{equation*}
We also calculate that
\begin{equation*} \mathbf{u} \cdot \mathbf{v} = 1 \cdot 1 + 1 \cdot (-1) = 0\text{.} \end{equation*}
Thus the two vectors \(\mathbf{u}\) and \(\mathbf{v}\) are orthogonal.
Before-and-after grid diagram for a symmetric matrix with orthogonal eigenvector directions.
The left panel shows a square coordinate grid with a red line in the direction \(\mathbf{u}=(1,1)\) and a blue line in the direction \(\mathbf{v}=(1,-1)\text{.}\) The right panel shows the image of the grid under \(A\text{:}\) the red direction is unchanged, while the blue direction is stretched to three times its original length. The red and blue eigenvector directions remain perpendicular in both panels.
Figure 5.3.7. Visualization of the action of matrix \(A\) from Activityย 5.3.6 on a grid. The red line along eigenvector \(\mathbf{u}\) is unchanged (since \(\mathbf{u}\) is an eigenvector with eigenvalue 1), while the blue line along eigenvector \(\mathbf{v}\) is stretched by a factor of 3 (since \(\mathbf{v}\) is an eigenvector with eigenvalue 3). Adapted from: Stanfordโ€™s MATH 51 textbook.
Figureย 5.3.7 should be compared to Figureย 5.2.7. Notice that since the matrix \(A\) in Activityย 5.3.6 is symmetric, the red and blue line in Figureย 5.3.7 meet at right angles, since the vectors \(\mathbf{u}\) and \(\mathbf{v}\) are orthogonal, whereas the red and blue lines in Figureย 5.2.7 do not meet at right angles, since the eigenvectors for that example are not orthogonal to one another.

Activity 5.3.8. Orthogonal diagonalization in two dimensions (U5-LO3).

Consider the matrix
\begin{equation*} A = \begin{bmatrix} 1 \amp 1 \\ 1 \amp -1 \end{bmatrix}\text{.} \end{equation*}
Find an orthogonal matrix \(Q\) such that \(Q^{-1} A Q\) is diagonal.
Solution.
We proceed as in Activityย 5.2.3, i.e., finding a basis of eigenvectors of \(A\text{,}\) and defining \(Q\) by taking those columns as eigenvectors. By Theoremย 5.3.2, as long as the eigenvectors are orthonormal, the matrix \(Q\) will be orthogonal. We start by finding the eigenvalues of \(A\) by computing its characteristic polynomial. We calculate that
\begin{align*} c_A(\lambda) \amp = \det\begin{bmatrix} 1-\lambda \amp 1 \\ 1 \amp -1-\lambda \end{bmatrix}\\ \amp = (1-\lambda)(-1-\lambda) - 1\\ \amp = \lambda^2 - 2\\ \amp = (\lambda - \sqrt{2})(\lambda + \sqrt{2})\text{.} \end{align*}
The solutions to \(c_A(\lambda) = 0\) are thus given by \(\lambda = \pm \sqrt{2}\text{,}\) and so \(\lambda_1 = \sqrt{2}\) and \(\lambda_2 = - \sqrt{2}\) are the two eigenvalues of \(A\text{.}\)
To calculate an eigenvector with eigenvalue \(\sqrt{2}\text{,}\) we solve the system
\begin{equation*} \begin{bmatrix} 1-\sqrt{2} \amp 1 \\ 1 \amp -1-\sqrt{2} \end{bmatrix}\begin{bmatrix} v_1 \\ v_2 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \end{bmatrix}\text{.} \end{equation*}
Expanding the left-hand side and reading off the second entry of the resulting vector gives
\begin{equation*} v_1 + (-1 - \sqrt{2}) v_2 = 0\text{.} \end{equation*}
Because \(\sqrt{2}\) is an eigenvalue, the matrix \(A-\sqrt{2}I\) is singular. The displayed matrix is nonzero, so its rank is \(1\text{.}\) Therefore there is one pivot variable and one free variable. Setting \(v_2 = 1\) and solving for \(v_1\text{,}\) we obtain the basic eigenvector
\begin{equation*} \begin{bmatrix} 1 + \sqrt{2} \\ 1 \end{bmatrix}\text{.} \end{equation*}
We are looking for an orthonormal basis of eigenvectors, and so in particular, the eigenvectors we choose as a basis must all have length \(1\text{.}\) We thus consider a multiple of the basic eigenvector which has length \(1\text{.}\) Since the basic eigenvector has length
\begin{equation*} \sqrt{ (1 + \sqrt{2})^2 + (1)^2 } = \sqrt{ 4 + 2\sqrt{2} } \end{equation*}
The vector
\begin{equation*} \mathbf{v} = \frac{1}{\sqrt{4 + 2 \sqrt{2}}} \begin{bmatrix} 1 + \sqrt{2} \\ 1 \end{bmatrix} = \begin{bmatrix} \frac{1 + \sqrt{2}}{\sqrt{4 + 2 \sqrt{2}}} \\ \frac{1}{\sqrt{4 + 2 \sqrt{2}}} \end{bmatrix} \end{equation*}
has length \(1\text{.}\) This will be the first vector in our basis.
With a similar technique, one may find the basic eigenvector with eigenvalue \(- \sqrt{2}\text{.}\) It is the vector
\begin{equation*} \begin{bmatrix} 1 - \sqrt{2} \\ 1 \end{bmatrix}\text{.} \end{equation*}
Normalizing gives the vector
\begin{equation*} \mathbf{w} = \frac{1}{\sqrt{4 - 2 \sqrt{2}}} \begin{bmatrix} 1 - \sqrt{2} \\ 1 \end{bmatrix} = \begin{bmatrix} \frac{1 - \sqrt{2}}{\sqrt{4 - 2 \sqrt{2}}} \\ \frac{1}{\sqrt{4 - 2 \sqrt{2}}} \end{bmatrix}\text{,} \end{equation*}
which has length \(1\text{.}\) This is the second vector in our basis.
Using Theoremย 5.3.1, since \(A\) is symmetric, \(\mathbf{v}\) and \(\mathbf{w}\) are orthogonal, and thus, by Theoremย 4.1.12, are linearly independent, thus forming a basis. But this means that the matrix
\begin{equation*} Q = \begin{bmatrix} \frac{1 + \sqrt{2}}{\sqrt{4+2\sqrt{2}}} \amp \frac{1 - \sqrt{2}}{\sqrt{4-2\sqrt{2}}} \\ \frac{1}{\sqrt{4+2\sqrt{2}}} \amp \frac{1}{\sqrt{4-2\sqrt{2}}} \end{bmatrix} \end{equation*}
is orthogonal, and
\begin{equation*} Q^{-1}AQ = \begin{bmatrix} \sqrt{2} \amp 0 \\ 0 \amp - \sqrt{2} \end{bmatrix} \end{equation*}
is diagonal.

Activity 5.3.9. Rewriting an orthogonal diagonalization (U5-LO3).

Suppose that \(A\) is orthogonally diagonalizable, i.e., we can find an orthogonal matrix \(Q\) so that \(Q^TAQ = D\text{,}\) where \(D\) is diagonal. Explain why \(A = QDQ^T\text{.}\)
Solution.
We calculate that
\begin{equation*} QDQ^T = Q(Q^TAQ)Q^T = (QQ^T) A (QQ^T) = I A I = A\text{.} \end{equation*}

Remark 5.3.10.

The factorization \(A = QDQ^T\) writes \(A\) as a product of three matrices: an orthogonal matrix, a diagonal matrix, and the transpose of the orthogonal matrix. This product is sometimes called the spectral decomposition of a symmetric matrix \(A\text{.}\)

Subsection Principal axes theorem

Recall Theoremย 5.2.4. That theorem tells us that if \(A\) is orthogonally diagonalizable, where \(Q^{-1} A Q\) is diagonal, then the columns of \(Q\) must be linearly independent eigenvectors of \(A\text{.}\) In addition, in order for \(Q\) to be orthogonal, Theoremย 5.3.2 tells us that the eigenvectors which form the columns of \(Q\) must be orthonormal.
Remarkably, all symmetric matrices are orthogonally diagonalizable.

Why is this true?.

We do not prove the โ€œhardโ€ part of the theorem (that the third property implies the second). But the proof that the second property implies the third is more simple (see Activityย 5.3.13).

Remark 5.3.12.

Theoremย 5.3.11 is also called The Spectral Theorem for symmetric matrices (the set of eigenvalues of a matrix is often called the spectrum of the matrix).
We do not prove the โ€œhardโ€ part of this theorem, that is, that (3) implies (2). Letโ€™s however check that (2) implies (3).

Activity 5.3.13. Orthogonal diagonalization and symmetry (U5-LO3).

Show that if \(A\) is orthogonally diagonalizable, then \(A\) is symmetric.
Solution.
Suppose \(A\) is orthogonally diagonalizable. Then there exists an orthogonal matrix \(Q\) and a diagonal matrix \(D\) such that \(Q^TAQ = D\text{.}\) Activityย 5.3.9 tells us that \(A = QDQ^T\text{.}\) But now we check that
\begin{align*} A^T \amp = (QDQ^T)^T\\ \amp = (Q^T)^T D^T Q^T\\ \amp = Q D Q^T = A\text{.} \end{align*}
The equation \(A^T = A\) means precisely that \(A\) is symmetric.

Activity 5.3.14. Orthogonal diagonalization in three dimensions (U5-LO3).

Let
\begin{equation*} A = \begin{bmatrix} 1 \amp 0 \amp -1 \\ 0 \amp 1 \amp 2 \\ -1 \amp 2 \amp 5 \end{bmatrix} \end{equation*}
Find an orthogonal matrix \(Q\) such that \(Q^{-1} A Q\) is diagonal.
Solution.
First, compute the eigenvalues. We calculate that
\begin{align*} \det(A - \lambda I) \amp = \det\begin{bmatrix} 1-\lambda \amp 0 \amp -1 \\ 0 \amp 1-\lambda \amp 2 \\ -1 \amp 2 \amp 5-\lambda \end{bmatrix}\\ \amp = (1- \lambda) [(1 -\lambda)(5 - \lambda) - 4] + (-1)[0 - (1-\lambda)(-1)]\\ \amp = (1- \lambda) [(1 -\lambda)(5 - \lambda) - 4] - (1-\lambda)\\ \amp = (1- \lambda)[(1 -\lambda)(5 - \lambda) - 4 - 1]\\ \amp = (1- \lambda)[-6 \lambda + \lambda^2]\\ \amp = -\lambda(\lambda-1)(\lambda-6) \end{align*}
This calculation verifies that the eigenvalues of \(A\) are \(\lambda_1 = 0\text{,}\) \(\lambda_2 = 1\text{,}\) and \(\lambda_3 = 6\text{.}\) Now we proceed to find an eigenvector for each of these eigenvalues.
For the eigenvalue \(\lambda_1 = 0\text{,}\) we solve the equation \(A\mathbf{v}_1 = \mathbf{0}\text{,}\) which we expand as
\begin{equation*} \begin{bmatrix} 1 \amp 0 \amp -1 \\ 0 \amp 1 \amp 2 \\ -1 \amp 2 \amp 5 \end{bmatrix} \begin{bmatrix} v_1 \\ v_2 \\ v_3 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 0 \end{bmatrix} \end{equation*}
By observation, we see that the first and second columns will contain pivots in the reduced row echelon form of the matrix on the left-hand side, so setting \(v_3 = 1\) gives the basic eigenvector
\begin{equation*} \begin{bmatrix} 1 \\ -2 \\ 1 \end{bmatrix}\text{.} \end{equation*}
Normalizing gives the normalized eigenvector
\begin{equation*} \mathbf{v}_1 = \frac{1}{\sqrt{6}} \begin{bmatrix} 1 \\ -2 \\ 1 \end{bmatrix} = \begin{bmatrix} 1/\sqrt{6} \\ -2/\sqrt{6} \\ 1/\sqrt{6} \end{bmatrix}\text{,} \end{equation*}
which will be the first vector in our basis.
For the eigenvalue \(\lambda_2 = 1\text{,}\) we solve the equation \((A - I)\mathbf{v}_2 = \mathbf{0}\text{,}\) which we expand as
\begin{equation*} \begin{bmatrix} 0 \amp 0 \amp -1 \\ 0 \amp 0 \amp 2 \\ -1 \amp 2 \amp 4 \end{bmatrix} \begin{bmatrix} v_1 \\ v_2 \\ v_3 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 0 \end{bmatrix} \end{equation*}
We now see that first and third columns will contain pivots when we row reduce this matrix, so setting \(v_2 = 1\) and solving gives the basic eigenvector
\begin{equation*} \begin{bmatrix} 2 \\ 1 \\ 0 \end{bmatrix}\text{.} \end{equation*}
Normalizing gives the eigenvector
\begin{equation*} \mathbf{v}_2 = \frac{1}{\sqrt{5}} \begin{bmatrix} 2 \\ 1 \\ 0 \end{bmatrix} = \begin{bmatrix} 2/\sqrt{5} \\ 1/\sqrt{5} \\ 0 \end{bmatrix}\text{.} \end{equation*}
This will be the second vector in our basis.
For \(\lambda_3 = 6\text{,}\) we solve \((A - 6I)\mathbf{v}_3 = \mathbf{0}\text{,}\) i.e.,
\begin{equation*} \begin{bmatrix} -5 \amp 0 \amp -1 \\ 0 \amp -5 \amp 2 \\ -1 \amp 2 \amp -1 \end{bmatrix} \begin{bmatrix} v_1 \\ v_2 \\ v_3 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 0 \end{bmatrix} \end{equation*}
The first two equations give \(v_1 = -\frac{1}{5}v_3\) and \(v_2 = \frac{2}{5}v_3\text{.}\) Setting \(v_3 = 1\) gives the basic eigenvector
\begin{equation*} \begin{bmatrix} -1/5 \\ 2/5 \\ 1 \end{bmatrix}\text{.} \end{equation*}
Multiplying by \(5\) (to prevent working with fractions) gives the integer eigenvector
\begin{equation*} \begin{bmatrix} -1 \\ 2 \\ 5 \end{bmatrix} \end{equation*}
Normalizing gives the eigenvector
\begin{equation*} \mathbf{v}_3 = \frac{1}{\sqrt{30}} \begin{bmatrix} -1 \\ 2 \\ 5 \end{bmatrix} = \begin{bmatrix} -1/\sqrt{30} \\ 2/\sqrt{30} \\ 5/\sqrt{30} \end{bmatrix}\text{.} \end{equation*}
This will be the third and final vector in our basis.
We now set
\begin{equation*} Q = \begin{bmatrix} 1/\sqrt{6} \amp 2/\sqrt{5} \amp -1/\sqrt{30} \\ -2/\sqrt{6} \amp 1/\sqrt{5} \amp 2/\sqrt{30} \\ 1/\sqrt{6} \amp 0 \amp 5/\sqrt{30} \end{bmatrix}\text{.} \end{equation*}
Then
\begin{equation*} Q^{-1}AQ = \begin{bmatrix} 0 \amp 0 \amp 0 \\ 0 \amp 1 \amp 0 \\ 0 \amp 0 \amp 6 \end{bmatrix}\text{.} \end{equation*}
We have thus found an orthogonal diagonalization of the matrix \(A\text{.}\)
In Activityย 5.3.14, the eigenvalues of \(A\) were distinct. To come up with a general strategy to obtain an orthogonal diagonalization, we need to make one further observation.

Definition 5.3.15. Eigenspaces of a matrix.

Suppose \(A\) is a square matrix. Then for any scalar \(\lambda\text{,}\) the set
\begin{equation*} E_\lambda(A) = \{ \mathbf{x} \in \R^n: A \mathbf{x} = \lambda \mathbf{x} \} \end{equation*}
is called the eigenspace of \(A\) corresponding to \(\lambda\text{.}\)

Why is this true?.

Note that \(\mathbf{x} \in E_\lambda(A)\) precisely when \(\mathbf{x}\) solves the equation \((A - \lambda I) \mathbf{x} = \mathbf{0}\text{.}\) Thus \(E_\lambda(A)\) is precisely the null space of the matrix \(A - \lambda I\text{,}\) and the theorem follows from Theoremย 2.3.18.

Note 5.3.17. Procedure for orthogonally diagonalizing a symmetric matrix \(A\).

  1. Find the eigenvalues of \(A\text{.}\)
  2. For each eigenvalue \(\lambda\) of \(A\text{,}\) find a basis for \(E_\lambda(A)\text{,}\) and convert it to an orthonormal basis using the Gram-Schmidt orthogonalization process (see Theoremย 4.2.19) if necessary.
  3. Collecting the orthonormal bases for each of the eigenspaces gives an orthonormal basis of eigenvectors for \(A\text{.}\) Taking these eigenvectors as the columns of a matrix \(Q\) gives an orthogonal matrix such that \(Q^{-1}AQ\) is diagonal.

Activity 5.3.18. Orthogonal diagonalization from eigenspace data (U5-LO3).

If
\begin{equation*} A = \begin{bmatrix} 8 \amp -2 \amp 2 \\ -2 \amp 5 \amp 4 \\ 2 \amp 4 \amp 5 \end{bmatrix}, \end{equation*}
compute an orthonormal diagonalization of \(A\text{.}\) You may use the fact that the characteristic polynomial of \(A\) is \(\lambda (\lambda - 9)^2\text{,}\) and the null space of \(A\) is spanned by the vector
\begin{equation*} \begin{bmatrix} 1 \\ 2 \\ -2 \end{bmatrix}\text{.} \end{equation*}
Solution.
The eigenvalues are \(\lambda_1 = 0\) and \(\lambda_2 = 9\text{.}\) Since the null space of \(A\) is spanned by the vector
\begin{equation*} \begin{bmatrix} 1 \\ 2 \\ -2 \end{bmatrix}\text{,} \end{equation*}
the eigenvectors of \(A\) with eigenvalue \(0\) are all multiples of this vector. Thus an orthonormal basis for \(E_0(A)\) is given by
\begin{equation*} \left\{ \begin{bmatrix} 1/3 \\ 2/3 \\ -2/3 \end{bmatrix} \right\}\text{.} \end{equation*}
On the other hand, to find an orthonormal basis for \(E_9(A)\) we form the matrix
\begin{equation*} 9I - A = \begin{bmatrix} 9 \amp 0 \amp 0 \\ 0 \amp 9 \amp 0 \\ 0 \amp 0 \amp 9 \end{bmatrix} - \begin{bmatrix} 8 \amp -2 \amp 2 \\ -2 \amp 5 \amp 4 \\ 2 \amp 4 \amp 5 \end{bmatrix} = \begin{bmatrix} 1 \amp 2 \amp -2 \\ 2 \amp 4 \amp -4 \\ -2 \amp -4 \amp 4 \end{bmatrix}\text{.} \end{equation*}
Using the row operations \(R_2 \rightarrow R_2 - 2R_1\) and \(R_3 \rightarrow R_3 + 2R_1\text{,}\) we obtain the reduced row echelon form for the matrix \(9I - A\text{:}\) the matrix
\begin{equation*} \begin{bmatrix} 1 \amp 2 \amp -2 \\ 0 \amp 0 \amp 0 \\ 0 \amp 0 \amp 0 \end{bmatrix}\text{.} \end{equation*}
We thus obtain the two basic solutions
\begin{equation*} \mathbf{v}_1 = \begin{bmatrix} -2 \\ 1 \\ 0 \end{bmatrix} \quad\text{and}\quad \mathbf{v}_2 = \begin{bmatrix} 2 \\ 0 \\ 1 \end{bmatrix}\text{.} \end{equation*}
We now apply Gram-Schmidt to this pair of vectors, which form a basis of \(E_9(A)\text{,}\) in order to obtain an orthogonal basis. We define
\begin{equation*} \mathbf{w}_1=\mathbf{v}_1 \qquad\text{and}\qquad \mathbf{w}_2=\mathbf{v}_2-\frac{\mathbf{v}_2\cdot\mathbf{w}_1}{\mathbf{w}_1\cdot\mathbf{w}_1}\mathbf{w}_1. \end{equation*}
We calculate that
\begin{equation*} \frac{\mathbf{v}_2 \cdot \mathbf{w}_1}{\mathbf{w}_1 \cdot \mathbf{w}_1} = \frac{-4}{5} \end{equation*}
and thus that
\begin{equation*} \mathbf{w}_2 = \begin{bmatrix} 2 \\ 0 \\ 1 \end{bmatrix} + \frac45 \begin{bmatrix} -2 \\ 1 \\ 0 \end{bmatrix} = \begin{bmatrix} 2/5 \\ 4/5 \\ 1 \end{bmatrix}\text{.} \end{equation*}
Normalizing gives the orthonormal basis
\begin{equation*} \left\{ \frac{\mathbf{w}_1}{\| \mathbf{w}_1 \|}, \frac{\mathbf{w}_2}{\| \mathbf{w}_2 \|} \right\} = \left\{ \begin{bmatrix} -2/\sqrt(5) \\ 1/\sqrt{5} \\ 0 \end{bmatrix}, \begin{bmatrix} 2/\sqrt{45} \\ 4/\sqrt{45} \\ 5/\sqrt{45} \end{bmatrix} \right\} \end{equation*}
for \(E_9(A)\text{.}\)
Combining the two orthonormal bases we have calculated gives an orthonormal basis
\begin{equation*} \left\{ \begin{bmatrix} 1/3 \\ 2/3 \\ -2/3 \end{bmatrix}, \begin{bmatrix} -2/\sqrt{5} \\ 1/\sqrt{5} \\ 0 \end{bmatrix}, \begin{bmatrix} 2/\sqrt{45} \\ 4/\sqrt{45} \\ 5/\sqrt{45} \end{bmatrix} \right\} \end{equation*}
of \(\R^n\) consisting of eigenvectors, and so if we define
\begin{equation*} Q = \begin{bmatrix} 1/3 \amp -2/\sqrt{5} \amp 2/\sqrt{45} \\ 2/3 \amp 1/\sqrt{5} \amp 4/\sqrt{45} \\ -2/3 \amp 0 \amp 5/\sqrt{45} \end{bmatrix}\text{,} \end{equation*}
then
\begin{equation*} Q^{-1}AQ = \begin{bmatrix} 0 \amp 0 \amp 0 \\ 0 \amp 9 \amp 0 \\ 0 \amp 0 \amp 9 \end{bmatrix} \end{equation*}
gives an orthogonal diagonalization of \(A\text{.}\)