Tutorials › Linear Algebra › Ordering Eigenvalues and Eigenvectors in Q Lambda Q^T

Symmetric Matrices and the Spectral Theorem · Tutorial 738 of 1000

Ordering Eigenvalues and Eigenvectors in Q Lambda Q^T

You will learn to coordinate permutations of eigenvalues and eigenvectors, verify the resulting factorization, and handle repeated eigenvalues safely.

Advanced 9 min read

What You'll Learn

  • Define a permutation matrix by the order in which it rearranges standard basis vectors.
  • Reorder the diagonal entries of a diagonal eigenvalue matrix.
  • Apply the same permutation to the columns of the orthogonal eigenvector matrix.
  • Prove that the reordered factorization represents the same symmetric matrix.
  • Check eigenvalue–eigenvector pairings when eigenvalues are repeated.
  • Identify the error caused by reordering eigenvalues but not eigenvectors.

Why the Order in an Orthogonal Diagonalization Can Change

An orthogonal diagonalization writes a real symmetric matrix as \(\mathbf{A}=\mathbf{Q}\mathbf{\Lambda}\mathbf{Q}^{\top}\), where \(\mathbf{Q}\) is orthogonal and the diagonal entries of \(\mathbf{\Lambda}\) are eigenvalues of \(\mathbf{A}\). The order of those diagonal entries is not fixed. But each entry is paired with a particular column of \(\mathbf{Q}\): the \(j\)th diagonal entry belongs with the \(j\)th eigenvector column. If you change the order of the eigenvalues, you must change the column order in the same way.

Here, \(\mathbf{A}\) is an \(n\times n\) real symmetric matrix, \(\mathbf{Q}\) is an \(n\times n\) real orthogonal matrix, and \(\mathbf{\Lambda}\) is diagonal. Orthogonality means \(\mathbf{Q}^{\top}\mathbf{Q}=\mathbf{I}_n\). Write the columns of \(\mathbf{Q}\) as \(\mathbf{q}_1,\dots,\mathbf{q}_n\), and the diagonal entries of \(\mathbf{\Lambda}\) as \(\lambda_1,\dots,\lambda_n\). The column \(\mathbf{q}_j\) is a unit eigenvector for \(\lambda_j\), so \(\mathbf{A}\mathbf{q}_j=\lambda_j\mathbf{q}_j\). This pairing is what the reordering must preserve.

Definition: A permutation of \(\{1,\dots,n\}\) is a rearrangement of these \(n\) indices, written \(\pi(1),\dots,\pi(n)\), in which each index appears exactly once. Its permutation matrix \(\mathbf{P}\) has columns \(\mathbf{e}_{\pi(1)},\dots,\mathbf{e}_{\pi(n)}\), where \(\mathbf{e}_j\) is the \(j\)th standard basis vector. Thus right multiplication by \(\mathbf{P}\) reorders the columns of a matrix into the order \(\pi(1),\dots,\pi(n)\).

For example, if \(\pi(1)=2,\pi(2)=3,\pi(3)=1\), then the new first column is the old second column, the new second is the old third, and the new third is the old first. The corresponding diagonal entries must be put in that same order. The transpose \(\mathbf{P}^{\top}\) reverses the permutation: its columns are the standard basis vectors in the inverse order.

The Reordering Rule

Theorem (Reordering an orthogonal diagonalization): Suppose \(\mathbf{A}=\mathbf{Q}\mathbf{\Lambda}\mathbf{Q}^{\top}\), where \(\mathbf{Q}\) is a real orthogonal matrix and \(\mathbf{\Lambda}=\operatorname{diag}(\lambda_1,\dots,\lambda_n)\). For any permutation matrix \(\mathbf{P}\), define \(\mathbf{Q}'=\mathbf{Q}\mathbf{P}\) and \(\mathbf{\Lambda}'=\mathbf{P}^{\top}\mathbf{\Lambda}\mathbf{P}\). Then \(\mathbf{Q}'\) is orthogonal, \(\mathbf{\Lambda}'=\operatorname{diag}(\lambda_{\pi(1)},\dots,\lambda_{\pi(n)})\), and \(\mathbf{A}=\mathbf{Q}'\mathbf{\Lambda}'\mathbf{Q}'^{\top}\).

Proof. The columns of \(\mathbf{P}\) are the standard basis vectors in a rearranged order. Each has length \(1\), and distinct columns have dot product \(0\). Therefore \(\mathbf{P}^{\top}\mathbf{P}=\mathbf{I}_n\). Since \(\mathbf{P}\) is square, its columns also contain every standard basis vector, so \(\mathbf{P}\mathbf{P}^{\top}=\mathbf{I}_n\). Hence \(\mathbf{Q}'^{\top}\mathbf{Q}'=\mathbf{P}^{\top}\mathbf{Q}^{\top}\mathbf{Q}\mathbf{P}=\mathbf{P}^{\top}\mathbf{P}=\mathbf{I}_n\), and \(\mathbf{Q}'\) is orthogonal. The \(j\)th column of \(\mathbf{Q}\mathbf{P}\) is \(\mathbf{q}_{\pi(j)}\). Multiplying \(\mathbf{\Lambda}\) by the corresponding standard basis vectors on the two sides shows that the \(j\)th diagonal entry of \(\mathbf{P}^{\top}\mathbf{\Lambda}\mathbf{P}\) is \(\lambda_{\pi(j)}\), with all off-diagonal entries zero. Finally, using \(\mathbf{P}\mathbf{P}^{\top}=\mathbf{I}_n\), we obtain \(\mathbf{Q}'\mathbf{\Lambda}'\mathbf{Q}'^{\top}=\mathbf{Q}\mathbf{P}\mathbf{P}^{\top}\mathbf{\Lambda}\mathbf{P}\mathbf{P}^{\top}\mathbf{Q}^{\top}=\mathbf{Q}\mathbf{\Lambda}\mathbf{Q}^{\top}=\mathbf{A}\). Thus the reordered factors give the same matrix. \(\square\)

This rule also preserves each eigenvalue–eigenvector pairing. For the \(j\)th new column, \(\mathbf{q}'_j=\mathbf{q}_{\pi(j)}\), and the corresponding diagonal entry is \(\lambda'_j=\lambda_{\pi(j)}\). Consequently, \(\mathbf{A}\mathbf{q}'_j=\mathbf{A}\mathbf{q}_{\pi(j)}=\lambda_{\pi(j)}\mathbf{q}_{\pi(j)}=\lambda'_j\mathbf{q}'_j\). No eigenvector has been assigned a different eigenvalue; only the positions in the lists have changed.

Worked Example: Put the Larger Eigenvalue First

Start with an orthogonal diagonalization whose eigenvalues are \(2\) and \(5\), and reorder it so that \(5\) comes first. Take

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

The columns of \(\mathbf{Q}\) are orthonormal: each has squared length \(\tfrac12+\tfrac12=1\), and their dot product is \(\tfrac12-\tfrac12=0\). First compute the matrix represented by the original factors:

$$ \begin{aligned} \mathbf{Q}\mathbf{\Lambda} &=\frac{1}{\sqrt{2}}\begin{bmatrix}2&-5\\2&5\end{bmatrix},\\ \mathbf{A}=\mathbf{Q}\mathbf{\Lambda}\mathbf{Q}^{\top} &=\frac12\begin{bmatrix}2&-5\\2&5\end{bmatrix} \begin{bmatrix}1&1\\-1&1\end{bmatrix} =\begin{bmatrix}\tfrac72&-\tfrac32\\-\tfrac32&\tfrac72\end{bmatrix}. \end{aligned} $$

To swap the two positions, use \(\pi(1)=2,\pi(2)=1\), with \(\mathbf{P}=\begin{bmatrix}0&1\\1&0\end{bmatrix}\). Then

$$ \mathbf{Q}'=\mathbf{Q}\mathbf{P} =\frac{1}{\sqrt{2}}\begin{bmatrix}-1&1\\1&1\end{bmatrix}, \qquad \mathbf{\Lambda}'=\mathbf{P}^{\top}\mathbf{\Lambda}\mathbf{P} =\begin{bmatrix}5&0\\0&2\end{bmatrix}. $$

Multiplying the reordered factors gives

$$ \begin{aligned} \mathbf{Q}'\mathbf{\Lambda}' &=\frac{1}{\sqrt{2}}\begin{bmatrix}-5&2\\5&2\end{bmatrix},\\ \mathbf{Q}'\mathbf{\Lambda}'\mathbf{Q}'^{\top} &=\frac12\begin{bmatrix}-5&2\\5&2\end{bmatrix} \begin{bmatrix}-1&1\\1&1\end{bmatrix} =\begin{bmatrix}\tfrac72&-\tfrac32\\-\tfrac32&\tfrac72\end{bmatrix} =\mathbf{A}. \end{aligned} $$

Check the eigenpairs: the first new column is \(\mathbf{q}'_1=(-1,1)^{\top}/\sqrt{2}\). Multiplying by \(\mathbf{A}\) gives \(\mathbf{A}\mathbf{q}'_1=5\mathbf{q}'_1\). The second new column is \(\mathbf{q}'_2=(1,1)^{\top}/\sqrt{2}\), and \(\mathbf{A}\mathbf{q}'_2=2\mathbf{q}'_2\). The columns and diagonal entries match in their new order.

Sorting a Three-Eigenvalue Example

In practice, one often wants the diagonal entries in increasing or decreasing order. The procedure is simply to choose the corresponding permutation of indices and apply it to both factors. For instance, if the original order is \((4,-1,2)\), increasing order requires the index order \((2,3,1)\), not merely a new diagonal matrix with sorted entries.

Worked Example: Sort Three Eigenvalues in Increasing Order

Let the orthonormal columns of \(\mathbf{Q}\) be \(\mathbf{q}_1=(1,1,0)^{\top}/\sqrt{2}\), \(\mathbf{q}_2=(1,-1,0)^{\top}/\sqrt{2}\), and \(\mathbf{q}_3=(0,0,1)^{\top}\), with \(\mathbf{\Lambda}=\operatorname{diag}(4,-1,2)\). In matrix form,

$$ \mathbf{Q}=\begin{bmatrix}\tfrac{1}{\sqrt{2}}&\tfrac{1}{\sqrt{2}}&0\\ \tfrac{1}{\sqrt{2}}&-\tfrac{1}{\sqrt{2}}&0\\ 0&0&1\end{bmatrix}. $$

These columns have unit length and pairwise dot products \(0\), so \(\mathbf{Q}\) is orthogonal. Multiplication gives the original matrix:

$$ \begin{aligned} \mathbf{Q}\mathbf{\Lambda} &=\begin{bmatrix}2\sqrt{2}&-\tfrac{1}{\sqrt{2}}&0\\ 2\sqrt{2}&\tfrac{1}{\sqrt{2}}&0\\ 0&0&2\end{bmatrix},\\ \mathbf{A}=\mathbf{Q}\mathbf{\Lambda}\mathbf{Q}^{\top} &=\begin{bmatrix}\tfrac32&\tfrac52&0\\ \tfrac52&\tfrac32&0\\ 0&0&2\end{bmatrix}. \end{aligned} $$

The increasing order is \((-1,2,4)\), so the index order is \((2,3,1)\). The permutation matrix has columns \(\mathbf{e}_2,\mathbf{e}_3,\mathbf{e}_1\), and the matched reordered factors are

$$ \mathbf{P}=\begin{bmatrix}0&0&1\\1&0&0\\0&1&0\end{bmatrix}, \quad \mathbf{Q}'=\mathbf{Q}\mathbf{P} =\begin{bmatrix}\tfrac{1}{\sqrt{2}}&0&\tfrac{1}{\sqrt{2}}\\ -\tfrac{1}{\sqrt{2}}&0&\tfrac{1}{\sqrt{2}}\\ 0&1&0\end{bmatrix}, \quad \mathbf{\Lambda}'=\begin{bmatrix}-1&0&0\\0&2&0\\0&0&4\end{bmatrix}. $$

To check the product, the first reordered column contributes \(-\mathbf{q}_2\mathbf{q}_2^{\top}\), the second contributes \(2\mathbf{q}_3\mathbf{q}_3^{\top}\), and the third contributes \(4\mathbf{q}_1\mathbf{q}_1^{\top}\). Computing those terms gives

$$ \begin{aligned} \mathbf{Q}'\mathbf{\Lambda}'\mathbf{Q}'^{\top} &=\begin{bmatrix}-\tfrac12&\tfrac12&0\\ \tfrac12&-\tfrac12&0\\ 0&0&0\end{bmatrix} +\begin{bmatrix}0&0&0\\0&0&0\\0&0&2\end{bmatrix} +\begin{bmatrix}2&2&0\\2&2&0\\0&0&0\end{bmatrix}\\ &=\begin{bmatrix}\tfrac32&\tfrac52&0\\ \tfrac52&\tfrac32&0\\ 0&0&2\end{bmatrix} =\mathbf{A}. \end{aligned} $$

Check the matching: \(\mathbf{A}\mathbf{q}_2=-\mathbf{q}_2\), \(\mathbf{A}\mathbf{q}_3=2\mathbf{q}_3\), and \(\mathbf{A}\mathbf{q}_1=4\mathbf{q}_1\). These are exactly the three columns and diagonal entries in \(\mathbf{Q}'\) and \(\mathbf{\Lambda}'\).

Repeated Eigenvalues and Ties

A repeated eigenvalue does not change the reordering rule. If two diagonal entries are equal, swapping them leaves the diagonal matrix numerically unchanged, but the columns of \(\mathbf{Q}\) still move. Those columns are both eigenvectors for that same eigenvalue. More generally, when sorting eigenvalues with ties, any order among equal entries is allowed as long as the associated columns follow the same order.

Worked Example: Swapping Columns for a Repeated Eigenvalue

Use the same orthogonal matrix \(\mathbf{Q}\) as in the preceding example, but take \(\mathbf{\Lambda}=\operatorname{diag}(3,3,1)\). The first two eigenvalues are equal. The original product is

$$ \mathbf{Q}\mathbf{\Lambda} =\begin{bmatrix}\tfrac{3}{\sqrt{2}}&\tfrac{3}{\sqrt{2}}&0\\ \tfrac{3}{\sqrt{2}}&-\tfrac{3}{\sqrt{2}}&0\\ 0&0&1\end{bmatrix}, \qquad \mathbf{Q}\mathbf{\Lambda}\mathbf{Q}^{\top} =\begin{bmatrix}3&0&0\\0&3&0\\0&0&1\end{bmatrix}. $$

Swap the first two columns using \(\mathbf{P}=\begin{bmatrix}0&1&0\\1&0&0\\0&0&1\end{bmatrix}\). The reordered factors are

$$ \mathbf{Q}'=\mathbf{Q}\mathbf{P} =\begin{bmatrix}\tfrac{1}{\sqrt{2}}&\tfrac{1}{\sqrt{2}}&0\\ -\tfrac{1}{\sqrt{2}}&\tfrac{1}{\sqrt{2}}&0\\ 0&0&1\end{bmatrix}, \qquad \mathbf{\Lambda}'=\mathbf{P}^{\top}\mathbf{\Lambda}\mathbf{P} =\begin{bmatrix}3&0&0\\0&3&0\\0&0&1\end{bmatrix}. $$

The diagonal matrix appears unchanged because its first two entries agree. The product check is still important: the reordered columns are orthonormal, and multiplication yields

$$ \mathbf{Q}'\mathbf{\Lambda}'\mathbf{Q}'^{\top} =\begin{bmatrix}\tfrac32&-\tfrac32&0\\ -\tfrac32&\tfrac32&0\\ 0&0&0\end{bmatrix} +\begin{bmatrix}\tfrac32&\tfrac32&0\\ \tfrac32&\tfrac32&0\\ 0&0&0\end{bmatrix} +\begin{bmatrix}0&0&0\\0&0&0\\0&0&1\end{bmatrix} =\begin{bmatrix}3&0&0\\0&3&0\\0&0&1\end{bmatrix}. $$

Check the eigenpairs: each of the first two columns of \(\mathbf{Q}'\) is mapped by \(\mathbf{A}\) to three times itself, and the third column is mapped to itself. The repeated eigenvalue permits either order for its two columns, but not a mismatch with a different eigenvalue.

Common Mistake: Sorting Only the Diagonal

A tempting but incorrect step is to sort the diagonal entries of \(\mathbf{\Lambda}\) while leaving \(\mathbf{Q}\) untouched. In the three-eigenvalue example, changing \(\operatorname{diag}(4,-1,2)\) to \(\operatorname{diag}(-1,2,4)\) without changing \(\mathbf{Q}\) assigns \(-1\) to \(\mathbf{q}_1\), \(2\) to \(\mathbf{q}_2\), and \(4\) to \(\mathbf{q}_3\). The resulting product is

$$ \mathbf{Q}\begin{bmatrix}-1&0&0\\0&2&0\\0&0&4\end{bmatrix}\mathbf{Q}^{\top} = \begin{bmatrix}\tfrac12&-\tfrac32&0\\ -\tfrac32&\tfrac12&0\\ 0&0&4\end{bmatrix}, $$

which is not the original matrix \(\begin{bmatrix}\tfrac32&\tfrac52&0\\\tfrac52&\tfrac32&0\\0&0&2\end{bmatrix}\). The correction is to reorder both factors: use \(\mathbf{Q}'=\mathbf{Q}\mathbf{P}\) and \(\mathbf{\Lambda}'=\mathbf{P}^{\top}\mathbf{\Lambda}\mathbf{P}\) for the same permutation matrix. In an orthogonal diagonalization, the order is flexible, but the eigenvalue–eigenvector pairing is not.

When you need a particular order, a reliable check is to write down the old index selected for each new position. If the new order is \((\pi(1),\dots,\pi(n))\), place \(\mathbf{q}_{\pi(j)}\) in column \(j\) and \(\lambda_{\pi(j)}\) in diagonal position \(j\). Then verify the factorization or check each eigenpair. This avoids relying on visual intuition when there are several entries or repeated values.

Check Your Understanding

For each question, keep track of which old index supplies every new column and diagonal entry.

  1. If the eigenvalues are listed as \((6,1,4)\), what index order puts them in decreasing order? Write the corresponding reordered diagonal.
  2. For the index order \((3,1,2)\), write the permutation matrix and state the order of the columns in \(\mathbf{Q}\mathbf{P}\).
  3. Explain why \(\mathbf{Q}\mathbf{P}\) remains orthogonal when \(\mathbf{Q}\) is orthogonal and \(\mathbf{P}\) is a permutation matrix.
  4. Suppose \(\lambda_1=\lambda_2\). What happens to \(\mathbf{\Lambda}\) and \(\mathbf{Q}\) when the first two positions are swapped?
  5. In one sentence, identify the error in sorting the eigenvalues but leaving the eigenvector columns in their original order.

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