Orthogonal Matrices and Symmetric Matrices

Recall that an \(n \times n\) matrix \(A\) is diagonalizable if and only if it has \(n\) linearly independent eigenvectors. (see Diagonalizable Matrices and Multiplicity) Moreover, the matrix \(P\) with these eigenvectors as columns is a diagonalizing matrix for \(A\), that is

\begin{equation*} P^{-1}AP \mbox { is diagonal.} \end{equation*}

As we have seen, the nice bases of \(\RR ^n\) are the orthogonal ones, so a natural question is: which \(n \times n\) matrices have \(n\) orthogonal eigenvectors, so that columns of \(P\) form an orthogonal basis for \(\RR ^n\)? These turn out to be precisely the symmetric matrices (matrices for which \(A=A^T\)), and this is the main result of this section.

Orthogonal Matrices

A collection of non-zero, pairwise orthogonal vectors in \(\RR ^n\) is called an orthogonal set of vectors. An orthogonal set of vectors is called orthonormal if \(\norm {\vec {q}} = 1\) for each vector \(\vec {q}\) in the set. A set of orthogonal vectors \(\{\vec {v}_{1}, \vec {v}_{2}, \dots , \vec {v}_{k}\}\) can be “normalized”, i.e. converted into an orthonormal set \(\left \{ \frac {1}{\norm {\vec {v}_{1}}}\vec {v}_{1}, \frac {1}{\norm {\vec {v}_{2}}}\vec {v}_{2}, \dots , \frac {1}{\norm {\vec {v}_{k}}}\vec {v}_{k} \right \}\). In particular, if a matrix \(A\) has \(n\) orthogonal eigenvectors, they can (by normalizing) be taken to be orthonormal. The corresponding diagonalizing matrix (we will use \(Q\) instead of \(P\)) has orthonormal columns, and such matrices are very easy to invert.

First note that condition (a) is equivalent to \(Q^{T}Q = I\). Let \(\vec {q}_{1}, \vec {q}_{2}, \dots , \vec {q}_{n}\) denote the columns of \(Q\). Then \(\vec {q}_{i}^{T}\) is the \(i\)th row of \(Q^{T}\), so the \((i, j)\)-entry of \(Q^{T}Q\) is \(\vec {q}_{i} \dotp \vec {q}_{j}\). Thus \(Q^{T}Q = I\) means that \(\vec {q}_{i} \dotp \vec {q}_{j} = 0\) if \(i \neq j\) and \(\vec {q}_{i} \dotp \vec {q}_{j} = 1\) if \(i = j\). Hence condition (a) is equivalent to (c). The proof of the equivalence of (a) and (b) is similar.

It is not enough that the rows of a matrix \(A\) are merely orthogonal for \(A\) to be an orthogonal matrix. Here is an example.

Let \(A=\begin{bmatrix} 2&1&1\\-1&1&1\\0&-1&1 \end{bmatrix}\)
(a)
Check that matrix \(A\) has rows that are orthogonal.
(b)
Check that matrix \(A\) has columns that are NOT orthogonal.
(c)
Check that matrix \(A\) has rows that are NOT orthonormal.
(d)
Create a matrix \(Q\) by normalizing each of the rows of \(A\).
(e)
Check that \(Q\) is an orthogonal matrix.

Click the arrow to see the answer.

You should get \(Q = \begin{bmatrix} \frac {2}{\sqrt {6}} & \frac {1}{\sqrt {6}} & \frac {1}{\sqrt {6}} \\ \frac {-1}{\sqrt {3}} & \frac {1}{\sqrt {3}} & \frac {1}{\sqrt {3}} \\ 0 & \frac {-1}{\sqrt {2}} & \frac {1}{\sqrt {2}} \end{bmatrix}\), and one can check that this is orthogonal in a number of ways.

This exploration can certainly be done by hand (although it takes some time), but it also makes for a very nice Octave exercise.

    %Exploration from Section 9.4 Orthogonal Matrices and Symmetric Matrices
    A=[2 1 1; -1 1 1; 0 -1 1]
    %Check that matrix A has rows that are orthogonal.
    A(1,:)*transpose(A(2,:))
    A(2,:)*transpose(A(3,:))
    A(1,:)*transpose(A(3,:))
    %Check that matrix A has columns that are NOT orthogonal.
    transpose(A(:,1))*A(:,2)
    %(This is 1 of 3 calculations to do.)
    %Check that matrix A in the Octave window has rows that are NOT orthonormal.
    %(See the results from the first question.)
    %Create a matrix Q by normalizing each of the rows of A.
    q1=A(1,:)/norm(A(1,:));
    q2=A(2,:)/norm(A(2,:));
    q3=A(3,:)/norm(A(3,:));
    Q = [q1;q2;q3]
    %Check that Q is an orthogonal matrix.
    Q*transpose(Q)
    %(You may get numbers close to zero in some places you expect
    %to get zero due to rounding error)

Link to code.

For more information about using Octave, please see Octave for Chapter 9.

We studied the idea of closure when we studied Subspaces of \(\RR ^n\). The next theorem tells us that orthogonal matrices are closed under matrix multiplication.

Symmetric Matrices

We now shift our focus from orthogonal matrices to another important class of \(n \times n\) matrices called symmetric matrices. A symmetric matrix is a matrix which is equal to its transpose. We saw a few examples of such matrices in Transpose of a Matrix.

When we began our study of eigenvalues and eigenvectors, we saw numerous examples of matrices with entries that were real numbers with eigenvalues that were complex numbers. It can be shown that symmetric matrices only have real eigenvalues. We also learned that some matrices are diagonalizable while other matrices are not. It turns out that every symmetric matrix is diagonalizable. In fact, we can say more, but first we need the following definition.

We have learned earlier that when we diagonalize a matrix \(A\), we write \(P^{-1}AP=D\) for some matrix \(P\) where \(D\) is diagonal, and the diagonal entries are the eigenvalues of \(A\). We have also learned that the columns of the matrix \(P\) are the corresponding eigenvectors of \(A\). So when a matrix is orthogonally diagonalizable, we are able to accomplish the diagonalization using a matrix \(Q\) consisting of \(n\) eigenvectors that form an orthonormal basis for \(\RR ^n\). The following remarkable theorem shows that the matrices that have this property are precisely the symmetric matrices.

If \(A\) is orthogonally diagonalizable, then it is an easy exercise to prove that it is symmetric. You are asked to do this in Practice Problem 27.

To prove the “only if” part of this theorem, we assume \(A\) is symmetric, and we need to show it is orthogonally diagonalizable. We proceed by induction on \(n\), the size of the symmetric matrix. If \(n = 1\), \(A\) is already diagonal. If \(n > 1\), assume that we know the “only if” statement holds for \((n - 1) \times (n - 1)\) symmetric matrices. Let \(\lambda _{1}\) be an eigenvalue of \(A\), and let \(A\vec {x}_{1} = \lambda _{1}\vec {x}_{1}\), where \(\norm {\vec {x}_{1}} = 1\). Next, set \(\vec {q}_{1}=\vec {x}_{1}\), and use the Gram-Schmidt algorithm to find an orthonormal basis \(\{\vec {q}_{1}, \vec {q}_{2}, \dots , \vec {q}_{n}\}\) for \(\RR ^n\). Let \(Q_{1} = \begin{bmatrix} | & | & & | \\ \vec {q}_1 & \vec {q}_2 & \cdots & \vec {q}_n \\ | & | & & | \end{bmatrix}\), so that \(Q_{1}\) is an orthogonal matrix. We have

\begin{align*} Q_{1}^TAQ_{1} &= \begin{bmatrix} -- & \vec {q}_{1}^T & -- \\ -- & \vec {q}_{2}^T & -- \\ & \vdots & \\ -- & \vec {q}_{n}^T & -- \end{bmatrix} A \begin{bmatrix} | & | & & | \\ \vec {q}_1 & \vec {q}_2 & \cdots & \vec {q}_n \\ | & | & & | \end{bmatrix} \\ &= \begin{bmatrix} -- & \vec {q}_{1}^T & -- \\ -- & \vec {q}_{2}^T & -- \\ & \vdots & \\ -- & \vec {q}_{n}^T & -- \end{bmatrix} \begin{bmatrix} | & | & & | \\ A\vec {q}_1 & A\vec {q}_2 & \cdots & A\vec {q}_n \\ | & | & & | \end{bmatrix} \\ &= \begin{bmatrix} \lambda _{1} & B \\ \vec {0} & A_{1} \end{bmatrix},\\ \end{align*}

where the block \(B\) has dimensions \(1 \times (n-1)\), and the block under \(\lambda _1\) is a \((n-1) \times 1\) zero matrix, because of the orthogonality of the basis vectors.

Next, using the fact that \(A\) is symmetric, we notice that

\[(Q_{1}^TAQ_{1})^T = Q_{1}^T A^T (Q_{1}^T)^T = Q_{1}^TAQ_{1},\]
so \(Q_{1}^TAQ_{1}\) is symmetric. It follows that \(B\) is also a zero matrix and that \(A_{1}\) is symmetric. Since \(A_{1}\) is an \((n - 1) \times (n - 1)\) symmetric matrix, we may apply the inductive hypothesis, so there exists an \((n - 1) \times (n - 1)\) orthogonal matrix \(Q\) such that \(Q^{T}A_{1}Q = D_{1}\) is diagonal. We observe that \(Q_{2} = \begin{bmatrix} 1 & 0\\ 0 & Q \end{bmatrix}\) is orthogonal, and we compute:
\begin{align*} (Q_{1}Q_{2})^TA(Q_{1}Q_{2}) &= Q_{2}^T(Q_{1}^TAQ_{1})Q_{2} \\ &= \begin{bmatrix} 1 & 0 \\ 0 & Q^T \end{bmatrix} \begin{bmatrix} \lambda _{1} & 0 \\ 0 & A_{1} \end{bmatrix}\begin{bmatrix} 1 & 0 \\ 0 & Q \end{bmatrix}\\ &= \begin{bmatrix} \lambda _{1} & 0 \\ 0 & D_{1} \end{bmatrix} \end{align*}

is diagonal. Because \(Q_{1}Q_{2}\) is orthogonal by Theorem 7(a), this completes the proof.

Because the eigenvalues of a real symmetric matrix are real, Theorem 10 is called the Real Spectral Theorem, and the set of distinct eigenvalues is called the spectrum of the matrix. A similar result holds for matrices with complex entries (Theorem ?? ).

Actually, the fact that the eigenvectors in Example 12 are orthogonal is no coincidence. These vectors certainly must be linearly independent (they correspond to distinct eigenvalues). We will see that the fact that the matrix is symmetric implies that the eigenvectors are orthogonal. To prove this we need the following useful fact about symmetric matrices.

Recall that \(\vec {x} \dotp \vec {y} = \vec {x}^{T} \vec {y}\) for all columns \(\vec {x}\) and \(\vec {y}\). Because \(A^{T} = A\), we get

\begin{equation*} (A\vec {x}) \dotp \vec {y} = (A\vec {x})^T\vec {y} = \vec {x}^TA^T\vec {y} = \vec {x}^TA\vec {y} = \vec {x} \dotp (A\vec {y}) \end{equation*}

Let \(A\vec {x} = \lambda \vec {x}\) and \(A\vec {y} = \mu \vec {y}\), where \(\lambda \neq \mu \). We compute

\begin{equation*} \lambda (\vec {x} \dotp \vec {y}) = (\lambda \vec {x}) \dotp \vec {y} = (A\vec {x}) \dotp \vec {y} = \vec {x} \dotp (A\vec {y}) = \vec {x} \dotp (\mu \vec {y}) = \mu (\vec {x} \dotp \vec {y}) \end{equation*}
Hence \((\lambda - \mu )(\vec {x} \dotp \vec {y}) = 0\), and so \(\vec {x} \dotp \vec {y} = 0\) because \(\lambda \neq \mu \).

Now the procedure for diagonalizing a symmetric \(n \times n\) matrix is clear. Find the distinct eigenvalues and find orthonormal bases for each eigenspace (the Gram-Schmidt algorithm may be needed when there is a repeated eigenvalue). Then the set of all these basis vectors is orthonormal (by Theorem 17) and contains \(n\) vectors. Here is an example.

If we are willing to replace “diagonal” by “upper triangular” in the real spectral theorem, we can weaken the requirement that \(A\) is symmetric to insisting only that \(A\) has real eigenvalues.

See Practice Problem ??

The eigenvalues of an upper triangular matrix are displayed along the main diagonal. Because \(A\) and \(Q^{T}AQ\) have the same determinant and trace whenever \(Q\) is orthogonal (for they are similar matrices), Theorem 23 gives:

This corollary remains true even if the eigenvalues are not real.

Practice Problems

Normalize the columns to make the following matrix orthogonal. \(A = \begin{bmatrix} 1 & -4 \\ 2 & 2 \end{bmatrix}\)
\[\frac {1}{\sqrt {\answer {5}}}\begin{bmatrix}\answer {1} & \answer {-2}\\\answer {2} & \answer {1}\end{bmatrix}\]
Normalize the columns to make the following matrix orthogonal. \(A = \begin{bmatrix} -1 & 2 & 2 \\ 2 & -1 & 2 \\ 2 & 2 & -1 \end{bmatrix}\)
For each matrix \(A\), find an orthogonal matrix \(Q\) such that \(Q^{-1}AQ\) is diagonal.
\[A = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}\]
\[Q=\frac {1}{\sqrt {\answer {2}}}\begin{bmatrix}1 & -1\\\answer {1} & \answer {1}\end{bmatrix}\]
\[A = \begin{bmatrix} 3 & 0 & 7 \\ 0 & 5 & 0 \\ 7 & 0 & 3 \end{bmatrix}\]
Suppose \(A\) is orthogonally diagonalizable. Prove that \(A\) is symmetric. (This is the easy direction of the "if and only if" in Theorem 10.)
Prove the converse of Theorem 14:

If \((A\vec {x}) \dotp \vec {y} = \vec {x} \dotp (A\vec {y})\) for all \(n\)-columns \(\vec {x}\) and \(\vec {y}\), then \(A\) is symmetric.

Let \(Q\) be an orthogonal matrix.
(a)
Show that \(\det Q = 1\) or \(\det Q = -1\).
(b)
Give \(2 \times 2\) examples of \(Q\) such that \(\det Q = 1\) and \(\det Q = -1\).

Text Source

This section was adapted from Section 8.2 of Keith Nicholson’s Linear Algebra with Applications. (CC-BY-NC-SA)

W. Keith Nicholson, Linear Algebra with Applications, Lyryx 2018, Open Edition, p. 424