Tutorials › Linear Algebra › Constructing an Orthogonal Diagonalization

Symmetric Matrices and the Spectral Theorem · Tutorial 737 of 1000

Constructing an Orthogonal Diagonalization

Find and normalize eigenvectors, assemble the orthogonal matrix and diagonal matrix, and verify the resulting diagonalization.

Advanced 11 min read

What You'll Learn

  • Find eigenvalues and eigenspaces needed for an orthogonal diagonalization
  • Choose orthonormal bases within repeated eigenspaces
  • Assemble the columns of Q and the matching diagonal entries of D
  • Verify QᵀQ = I and A = QDQᵀ by direct calculation
  • Recognize and correct errors caused by unnormalized eigenvectors or mismatched columns

From Eigenvectors to an Orthogonal Diagonalization

For a real symmetric matrix, the Spectral Theorem guarantees that its eigenvectors can be chosen to form an orthonormal basis. Constructing an orthogonal diagonalization turns that guarantee into a concrete calculation: find the eigenvalues and eigenspaces, choose unit eigenvectors that are mutually orthogonal, and place those vectors into a matrix. The diagonal entries must then record the eigenvalues belonging to those columns, in the same order.

Throughout, \(\mathbf{A}\) is a real symmetric \(n\times n\) matrix, and vectors are columns in \(\mathbb{R}^n\). A list \(\mathbf{q}_1,\dots,\mathbf{q}_n\) is an orthonormal basis if it is a basis, every vector has norm \(1\), and distinct vectors in the list have dot product \(0\). A matrix \(\mathbf{Q}\) is orthogonal if \(\mathbf{Q}^{\top}\mathbf{Q}=\mathbf{I}_n\). For a square matrix, this also gives \(\mathbf{Q}\mathbf{Q}^{\top}=\mathbf{I}_n\), since its columns form an orthonormal basis and \(\mathbf{Q}^{-1}=\mathbf{Q}^{\top}\).

Definition: An orthogonal diagonalization of a real \(n\times n\) matrix \(\mathbf{A}\) is an expression \(\mathbf{A}=\mathbf{Q}\mathbf{D}\mathbf{Q}^{\top}\), where \(\mathbf{Q}\) is an orthogonal \(n\times n\) matrix and \(\mathbf{D}\) is diagonal. Equivalently, \(\mathbf{A}=\mathbf{Q}\mathbf{D}\mathbf{Q}^{-1}\), because \(\mathbf{Q}^{-1}=\mathbf{Q}^{\top}\).

To construct this expression, use each eigenvector as a column of \(\mathbf{Q}\). If the \(i\)th column \(\mathbf{q}_i\) has eigenvalue \(\lambda_i\), put \(\lambda_i\) in the \(i\)th diagonal position of \(\mathbf{D}\). The vectors must be an orthonormal basis, not just a collection of eigenvectors. For repeated eigenvalues, there may be several choices of basis within the eigenspace; choose an orthonormal one.

Why the Construction Works

Theorem (Construction of an orthogonal diagonalization): Suppose \(\mathbf{A}\in\mathbb{R}^{n\times n}\) has an orthonormal basis of eigenvectors \(\mathbf{q}_1,\dots,\mathbf{q}_n\), with \(\mathbf{A}\mathbf{q}_i=\lambda_i\mathbf{q}_i\). Let \(\mathbf{Q}=\begin{bmatrix}\mathbf{q}_1&\cdots&\mathbf{q}_n\end{bmatrix}\) and \(\mathbf{D}=\operatorname{diag}(\lambda_1,\dots,\lambda_n)\). Then \(\mathbf{Q}\) is orthogonal and \(\mathbf{A}=\mathbf{Q}\mathbf{D}\mathbf{Q}^{\top}\).

Proof. The columns of \(\mathbf{Q}\) are orthonormal, so the \((i,j)\) entry of \(\mathbf{Q}^{\top}\mathbf{Q}\) is \(\mathbf{q}_i^{\top}\mathbf{q}_j\). This is \(1\) when \(i=j\) and \(0\) when \(i\ne j\), giving \(\mathbf{Q}^{\top}\mathbf{Q}=\mathbf{I}_n\). Since the columns are a basis, \(\mathbf{Q}\) is invertible; therefore \(\mathbf{Q}^{-1}=\mathbf{Q}^{\top}\), and hence \(\mathbf{Q}\mathbf{Q}^{\top}=\mathbf{I}_n\). The \(i\)th column of \(\mathbf{A}\mathbf{Q}\) is \(\mathbf{A}\mathbf{q}_i=\lambda_i\mathbf{q}_i\), which is also the \(i\)th column of \(\mathbf{Q}\mathbf{D}\). Thus \(\mathbf{A}\mathbf{Q}=\mathbf{Q}\mathbf{D}\). Multiplying on the right by \(\mathbf{Q}^{\top}\) gives \(\mathbf{A}\mathbf{Q}\mathbf{Q}^{\top}=\mathbf{Q}\mathbf{D}\mathbf{Q}^{\top}\). Since \(\mathbf{Q}\mathbf{Q}^{\top}=\mathbf{I}_n\), this is \(\mathbf{A}=\mathbf{Q}\mathbf{D}\mathbf{Q}^{\top}\). \(\square\)

For real symmetric matrices, the Spectral Theorem supplies the required orthonormal eigenbasis. In particular, eigenspaces for distinct eigenvalues are orthogonal, and an orthonormal basis can be chosen within each eigenspace. Combining these bases gives an orthonormal eigenbasis of \(\mathbb{R}^n\). These are standard results established in the earlier material on the Spectral Theorem and orthogonality of eigenspaces.

1
Find the eigenvalues.
Solve the characteristic equation, then find an eigenspace for each eigenvalue.
2
Choose orthonormal eigenvectors.
Normalize eigenvectors and, if an eigenspace has dimension greater than one, choose an orthonormal basis for it.
3
Assemble \(\mathbf{Q}\) and \(\mathbf{D}\).
Use the orthonormal eigenvectors as the columns of \(\mathbf{Q}\); place each vector’s eigenvalue in the corresponding diagonal position of \(\mathbf{D}\).
4
Verify the construction.
Check \(\mathbf{Q}^{\top}\mathbf{Q}=\mathbf{I}_n\) and multiply \(\mathbf{Q}\mathbf{D}\mathbf{Q}^{\top}\) to confirm that it equals \(\mathbf{A}\).

A Two-Dimensional Construction

Worked Example: Two Distinct Eigenvalues

Construct an orthogonal diagonalization of \(\mathbf{A}=\begin{bmatrix}2&1\\1&2\end{bmatrix}\).

The characteristic equation is

$$ \det(\mathbf{A}-\lambda\mathbf{I}_2) =(2-\lambda)^2-1 =(3-\lambda)(1-\lambda)=0. $$

The eigenvalues are \(3\) and \(1\). For \(\lambda=3\), solving \((\mathbf{A}-3\mathbf{I}_2)\mathbf{x}=\mathbf{0}\) gives \(x_1=x_2\), so choose \(\mathbf{v}_1=\begin{bmatrix}1\\1\end{bmatrix}\). Its norm is \(\sqrt{1^2+1^2}=\sqrt{2}\), giving the unit eigenvector \(\mathbf{q}_1=\frac{1}{\sqrt{2}}\begin{bmatrix}1\\1\end{bmatrix}\). For \(\lambda=1\), the equation gives \(x_1=-x_2\); choose \(\mathbf{v}_2=\begin{bmatrix}1\\-1\end{bmatrix}\). Its norm is also \(\sqrt{2}\), so \(\mathbf{q}_2=\frac{1}{\sqrt{2}}\begin{bmatrix}1\\-1\end{bmatrix}\).

The vectors are orthogonal because \(\mathbf{q}_1^{\top}\mathbf{q}_2=(1-1)/2=0\), and each has norm \(1\). Put them in that order as columns, with the corresponding eigenvalues on the diagonal:

$$ \mathbf{Q}=\frac{1}{\sqrt{2}} \begin{bmatrix}1&1\\1&-1\end{bmatrix}, \qquad \mathbf{D}=\begin{bmatrix}3&0\\0&1\end{bmatrix}. $$

First check orthogonality:

$$ \mathbf{Q}^{\top}\mathbf{Q} =\frac{1}{2} \begin{bmatrix}1&1\\1&-1\end{bmatrix} \begin{bmatrix}1&1\\1&-1\end{bmatrix} =\frac{1}{2} \begin{bmatrix}2&0\\0&2\end{bmatrix} =\mathbf{I}_2. $$

Now multiply back. Since \(\mathbf{Q}^{\top}=\mathbf{Q}\),

$$ \mathbf{Q}\mathbf{D}\mathbf{Q}^{\top} =\frac{1}{2} \begin{bmatrix}3&1\\3&-1\end{bmatrix} \begin{bmatrix}1&1\\1&-1\end{bmatrix} =\frac{1}{2} \begin{bmatrix}4&2\\2&4\end{bmatrix} =\begin{bmatrix}2&1\\1&2\end{bmatrix} =\mathbf{A}. $$

Repeated Eigenvalues Require a Basis Choice

When an eigenvalue is repeated, its eigenspace may contain more than one independent direction. The diagonalization needs enough eigenvectors to form a basis of the whole space. Any basis of a repeated eigenspace can be used if it is orthonormal; the eigenspace’s eigenvalue is repeated in \(\mathbf{D}\) for each column chosen from it.

Worked Example: An Eigenspace of Dimension Two

Construct an orthogonal diagonalization of \(\mathbf{A}=\begin{bmatrix}2&1&1\\1&2&1\\1&1&2\end{bmatrix}\).

The vector \(\begin{bmatrix}1\\1\\1\end{bmatrix}\) is an eigenvector with eigenvalue \(4\), since each row of \(\mathbf{A}\) sums to \(4\). Vectors whose coordinates sum to \(0\) are sent to themselves: for such a vector \(\mathbf{x}\), the \(i\)th coordinate of \(\mathbf{A}\mathbf{x}\) is \(x_i+\sum_j x_j=x_i\). Thus the plane \(x_1+x_2+x_3=0\) is the eigenspace for eigenvalue \(1\). Choose two vectors in that plane, \(\begin{bmatrix}1\\-1\\0\end{bmatrix}\) and \(\begin{bmatrix}1\\1\\-2\end{bmatrix}\). Their dot product is \(1-1+0=0\), so they are already orthogonal. Their norms are \(\sqrt{2}\) and \(\sqrt{6}\), respectively.

Normalize the three vectors and use them as columns, matching each column with its eigenvalue:

$$ \mathbf{Q}= \begin{bmatrix} \frac{1}{\sqrt{3}}&\frac{1}{\sqrt{2}}&\frac{1}{\sqrt{6}}\\ \frac{1}{\sqrt{3}}&-\frac{1}{\sqrt{2}}&\frac{1}{\sqrt{6}}\\ \frac{1}{\sqrt{3}}&0&-\frac{2}{\sqrt{6}} \end{bmatrix}, \qquad \mathbf{D}=\begin{bmatrix}4&0&0\\0&1&0\\0&0&1\end{bmatrix}. $$

Each column has norm \(1\). The first column has dot product \(0\) with the second and third, and the second and third have dot product \((1-1+0)/\sqrt{12}=0\). Therefore \(\mathbf{Q}^{\top}\mathbf{Q}=\mathbf{I}_3\). To check the matrix product, write the columns as \(\mathbf{q}_1,\mathbf{q}_2,\mathbf{q}_3\). The displayed vectors give \(\mathbf{q}_1\mathbf{q}_1^{\top}=\frac13\begin{bmatrix}1&1&1\\1&1&1\\1&1&1\end{bmatrix}\); orthonormality gives \(\mathbf{q}_2\mathbf{q}_2^{\top}+\mathbf{q}_3\mathbf{q}_3^{\top}=\mathbf{I}_3-\mathbf{q}_1\mathbf{q}_1^{\top}\). Hence

$$ \mathbf{Q}\mathbf{D}\mathbf{Q}^{\top} =4\mathbf{q}_1\mathbf{q}_1^{\top} +\mathbf{q}_2\mathbf{q}_2^{\top} +\mathbf{q}_3\mathbf{q}_3^{\top} =\mathbf{I}_3+3\mathbf{q}_1\mathbf{q}_1^{\top} =\begin{bmatrix}2&1&1\\1&2&1\\1&1&2\end{bmatrix} =\mathbf{A}. $$

Checking a Block-Structured Example

Worked Example: Three Different Eigenvalues

Construct an orthogonal diagonalization of \(\mathbf{A}=\begin{bmatrix}4&0&0\\0&0&2\\0&2&0\end{bmatrix}\).

The first standard basis vector is an eigenvector with eigenvalue \(4\). In the last two coordinates, \(\begin{bmatrix}0&2\\2&0\end{bmatrix}\begin{bmatrix}1\\1\end{bmatrix}=2\begin{bmatrix}1\\1\end{bmatrix}\) and \(\begin{bmatrix}0&2\\2&0\end{bmatrix}\begin{bmatrix}1\\-1\end{bmatrix}=-2\begin{bmatrix}1\\-1\end{bmatrix}\). Thus eigenvectors for eigenvalues \(2\) and \(-2\) are \(\begin{bmatrix}0\\1\\1\end{bmatrix}\) and \(\begin{bmatrix}0\\1\\-1\end{bmatrix}\). After normalization, take

$$ \mathbf{Q}= \begin{bmatrix} 1&0&0\\ 0&\frac{1}{\sqrt{2}}&\frac{1}{\sqrt{2}}\\ 0&\frac{1}{\sqrt{2}}&-\frac{1}{\sqrt{2}} \end{bmatrix}, \qquad \mathbf{D}=\begin{bmatrix}4&0&0\\0&2&0\\0&0&-2\end{bmatrix}. $$

The columns have unit norms and pairwise dot products \(0\), so \(\mathbf{Q}^{\top}\mathbf{Q}=\mathbf{I}_3\). Direct multiplication gives

$$ \mathbf{Q}\mathbf{D} = \begin{bmatrix} 4&0&0\\ 0&\sqrt{2}&-\sqrt{2}\\ 0&\sqrt{2}&\sqrt{2} \end{bmatrix}, \qquad \mathbf{Q}\mathbf{D}\mathbf{Q}^{\top} = \begin{bmatrix}4&0&0\\0&0&2\\0&2&0\end{bmatrix} =\mathbf{A}. $$

This verifies both required conditions for the orthogonal diagonalization.

Common Pitfall: Eigenvectors Must Be Unit Vectors

Eigenvectors may be scaled without changing their eigenvalues, but the columns of \(\mathbf{Q}\) must be unit vectors. For the first worked example, using the unnormalized eigenvectors as columns gives \(\mathbf{Q}_0=\begin{bmatrix}1&1\\1&-1\end{bmatrix}\). The wrong orthogonality check is to treat these columns as though they were unit length. In fact,

$$ \mathbf{Q}_0^{\top}\mathbf{Q}_0 =\begin{bmatrix}2&0\\0&2\end{bmatrix} \ne\mathbf{I}_2. $$

Using \(\mathbf{Q}_0\) and \(\mathbf{D}=\begin{bmatrix}3&0\\0&1\end{bmatrix}\) in the product also gives the wrong matrix:

$$ \mathbf{Q}_0\mathbf{D}\mathbf{Q}_0^{\top} =\begin{bmatrix}4&2\\2&4\end{bmatrix} \ne\begin{bmatrix}2&1\\1&2\end{bmatrix}. $$

The correction is to divide each eigenvector by its norm before assembling \(\mathbf{Q}\). A separate check is necessary even when the vectors are normalized: if two columns are exchanged, their corresponding diagonal entries must also be exchanged. Each diagonal entry belongs to the eigenvector in the same column.

Why the Checks Matter

The two checks answer different questions. Verifying \(\mathbf{Q}^{\top}\mathbf{Q}=\mathbf{I}_n\) confirms that the chosen columns are orthonormal. Verifying \(\mathbf{Q}\mathbf{D}\mathbf{Q}^{\top}=\mathbf{A}\) confirms that the eigenvalues match those columns and that the resulting product is the given matrix. Neither check should be omitted in a hand construction. In particular, a matrix of eigenvectors can diagonalize by similarity without being orthogonal; the transpose in \(\mathbf{Q}\mathbf{D}\mathbf{Q}^{\top}\) is justified by orthogonality, not merely by having eigenvectors as columns.

Check Your Understanding

For each construction, identify the eigenvectors, their normalization, and the matching diagonal entries before carrying out the final checks.

  1. For \(\mathbf{A}=\begin{bmatrix}5&2\\2&5\end{bmatrix}\), find a matrix \(\mathbf{Q}\) and diagonal matrix \(\mathbf{D}\) such that \(\mathbf{A}=\mathbf{Q}\mathbf{D}\mathbf{Q}^{\top}\).
  2. Explain why two orthogonal eigenvectors from a two-dimensional eigenspace must still be normalized before they are columns of an orthogonal matrix.
  3. Suppose the columns of \(\mathbf{Q}\) are orthonormal eigenvectors with eigenvalues \(2,-1,3\), in that order. Write the matching diagonal matrix \(\mathbf{D}\).
  4. For \(\mathbf{Q}=\frac{1}{\sqrt{2}}\begin{bmatrix}1&1\\1&-1\end{bmatrix}\) and \(\mathbf{D}=\begin{bmatrix}2&0\\0&-2\end{bmatrix}\), compute \(\mathbf{Q}\mathbf{D}\mathbf{Q}^{\top}\).
  5. State the two matrix equalities that verify an orthogonal diagonalization.

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon