Tutorials › Linear Algebra › Building P D P Inverse From Eigenvectors

Diagonalization · Tutorial 517 of 1000

Building P D P Inverse From Eigenvectors

Build the diagonalization factors from an ordered list of independent eigenvectors, then check that the columns and eigenvalues match.

Intermediate 9 min read

What You'll Learn

  • Arrange independent eigenvectors as the columns of a matrix P.
  • Place each eigenvector’s eigenvalue in the matching diagonal position of D.
  • Explain why the eigenvector equations give AP = PD and then A = PDP inverse.
  • Compute and check a diagonalization using exact matrix arithmetic.
  • Identify the error caused by mismatching eigenvector and eigenvalue order.

From Eigenvectors to a Factorization

Suppose a matrix has a collection of linearly independent eigenvectors. Those vectors can be assembled into a matrix, while their corresponding eigenvalues are placed on a diagonal. The resulting factorization records how the matrix acts on those vectors all at once. The order matters: each diagonal entry must belong to the eigenvector in the same column of the eigenvector matrix.

Throughout, let \(\mathbf{A}\in\mathbb{R}^{n\times n}\). An eigenvector \(\mathbf{v}\) of \(\mathbf{A}\) is a nonzero vector satisfying \(\mathbf{A}\mathbf{v}=\lambda\mathbf{v}\) for some real scalar \(\lambda\), its eigenvalue. A diagonalization writes \(\mathbf{A}\) as \(\mathbf{P}\mathbf{D}\mathbf{P}^{-1}\), where \(\mathbf{P}\) is invertible and \(\mathbf{D}\) is diagonal. The construction below explains what the factors contain and why their product recovers \(\mathbf{A}\).

Definition: Given eigenvectors \(\mathbf{v}_1,\dots,\mathbf{v}_n\) with corresponding eigenvalues \(\lambda_1,\dots,\lambda_n\), form \(\mathbf{P}=\begin{bmatrix}\mathbf{v}_1&\cdots&\mathbf{v}_n\end{bmatrix}\) and \(\mathbf{D}=\operatorname{diag}(\lambda_1,\dots,\lambda_n)\). The order of the eigenvalues in \(\mathbf{D}\) must match the order of the eigenvectors in the columns of \(\mathbf{P}\). If those \(n\) vectors are linearly independent, \(\mathbf{P}\) is invertible and the associated diagonalization is \(\mathbf{A}=\mathbf{P}\mathbf{D}\mathbf{P}^{-1}\).

Why does independence matter? The columns of \(\mathbf{P}\) must give unique coordinates for every vector in \(\mathbb{R}^n\), so that \(\mathbf{P}^{-1}\) exists. For a square matrix, \(n\) independent columns imply a pivot in every column when row reduced; with \(n\) rows, this makes the matrix invertible. A list of eigenvectors that is dependent may still consist entirely of valid eigenvectors, but it cannot be used as the columns of an invertible \(\mathbf{P}\).

Why the Construction Works

Theorem: Let \(\mathbf{A}\in\mathbb{R}^{n\times n}\), and suppose \(\mathbf{v}_1,\dots,\mathbf{v}_n\) are linearly independent eigenvectors of \(\mathbf{A}\), with \(\mathbf{A}\mathbf{v}_i=\lambda_i\mathbf{v}_i\) for each \(i\). If \(\mathbf{P}=\begin{bmatrix}\mathbf{v}_1&\cdots&\mathbf{v}_n\end{bmatrix}\) and \(\mathbf{D}=\operatorname{diag}(\lambda_1,\dots,\lambda_n)\), then \(\mathbf{A}=\mathbf{P}\mathbf{D}\mathbf{P}^{-1}\).

Proof. The \(i\)th column of \(\mathbf{A}\mathbf{P}\) is \(\mathbf{A}\mathbf{v}_i=\lambda_i\mathbf{v}_i\). The \(i\)th column of \(\mathbf{P}\mathbf{D}\) is also \(\lambda_i\mathbf{v}_i\), because right multiplication by the diagonal matrix multiplies column \(i\) of \(\mathbf{P}\) by \(\lambda_i\). Thus the two matrices have the same columns, so \(\mathbf{A}\mathbf{P}=\mathbf{P}\mathbf{D}\). Independence of the \(n\) columns makes \(\mathbf{P}\) invertible. Multiplying the equation on the right by \(\mathbf{P}^{-1}\) gives \(\mathbf{A}\mathbf{P}\mathbf{P}^{-1}=\mathbf{P}\mathbf{D}\mathbf{P}^{-1}\). Since \(\mathbf{P}\mathbf{P}^{-1}=\mathbf{I}_n\), this is \(\mathbf{A}=\mathbf{P}\mathbf{D}\mathbf{P}^{-1}\). \(\square\)

The proof gives a useful check before calculating an inverse: confirm that each proposed column really is an eigenvector for the eigenvalue in the matching position. The matrix equation \(\mathbf{A}\mathbf{P}=\mathbf{P}\mathbf{D}\) tests all the eigenvector equations at once. Once it holds and \(\mathbf{P}\) is invertible, the factorization follows.

Worked Example: A Two-Column Construction

Let \(\mathbf{A}=\begin{bmatrix}4&1\\0&2\end{bmatrix}\), with eigenvectors \(\mathbf{v}_1=\begin{bmatrix}1\\0\end{bmatrix}\) for \(\lambda_1=4\) and \(\mathbf{v}_2=\begin{bmatrix}-1\\2\end{bmatrix}\) for \(\lambda_2=2\). Construct and verify \(\mathbf{A}=\mathbf{P}\mathbf{D}\mathbf{P}^{-1}\).

First check the eigenvector equations. For the first vector, \(\mathbf{A}\mathbf{v}_1=\begin{bmatrix}4\\0\end{bmatrix}=4\mathbf{v}_1\). For the second, \(\mathbf{A}\mathbf{v}_2=\begin{bmatrix}-4+2\\4\end{bmatrix}=\begin{bmatrix}-2\\4\end{bmatrix}=2\mathbf{v}_2\). Put the vectors in the given order and place their eigenvalues in that same order:

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

The columns of \(\mathbf{P}\) are independent: if \(c_1\begin{bmatrix}1\\0\end{bmatrix}+c_2\begin{bmatrix}-1\\2\end{bmatrix}=\mathbf{0}\), the second coordinate gives \(2c_2=0\), so \(c_2=0\), and then the first gives \(c_1=0\). To find the inverse, row-reduce the augmented matrix:

$$ \left[\begin{array}{cc|cc}1&-1&1&0\\0&2&0&1\end{array}\right] \sim \left[\begin{array}{cc|cc}1&-1&1&0\\0&1&0&\frac12\end{array}\right] \sim \left[\begin{array}{cc|cc}1&0&1&\frac12\\0&1&0&\frac12\end{array}\right]. $$

Thus \(\mathbf{P}^{-1}=\begin{bmatrix}1&\frac12\\0&\frac12\end{bmatrix}\). Now multiply in stages:

$$ \mathbf{P}\mathbf{D} = \begin{bmatrix}1&-1\\0&2\end{bmatrix} \begin{bmatrix}4&0\\0&2\end{bmatrix} = \begin{bmatrix}4&-2\\0&4\end{bmatrix}, $$
$$ \mathbf{P}\mathbf{D}\mathbf{P}^{-1} = \begin{bmatrix}4&-2\\0&4\end{bmatrix} \begin{bmatrix}1&\frac12\\0&\frac12\end{bmatrix} = \begin{bmatrix}4&2-1\\0&2\end{bmatrix} = \begin{bmatrix}4&1\\0&2\end{bmatrix} =\mathbf{A}. $$

Check: the product agrees entry by entry with the original matrix. Also, multiplying \(\mathbf{A}\mathbf{P}\) gives \(\begin{bmatrix}4&-2\\0&4\end{bmatrix}\), which equals \(\mathbf{P}\mathbf{D}\), as the theorem predicts.

The Coordinate Meaning of the Factors

The factorization can be read as a sequence of three operations on a vector. The matrix \(\mathbf{P}^{-1}\) converts standard coordinates into coordinates relative to the ordered eigenvector list. The diagonal matrix \(\mathbf{D}\) scales each of those coordinates by the corresponding eigenvalue. Finally, \(\mathbf{P}\) converts the result back to standard coordinates. This interpretation helps explain why the eigenvector order must be consistent throughout the construction.

Result: Under the hypotheses of the theorem, if \(\mathbf{x}=\mathbf{P}\mathbf{c}\), then \(\mathbf{A}\mathbf{x}=\mathbf{P}\mathbf{D}\mathbf{c}\). Thus, in coordinates given by the ordered eigenvectors, applying \(\mathbf{A}\) acts by the diagonal matrix \(\mathbf{D}\).

Proof. Since \(\mathbf{x}=\mathbf{P}\mathbf{c}\), multiply by \(\mathbf{A}\) to obtain \(\mathbf{A}\mathbf{x}=\mathbf{A}\mathbf{P}\mathbf{c}\). The eigenvector equations give \(\mathbf{A}\mathbf{P}=\mathbf{P}\mathbf{D}\), so \(\mathbf{A}\mathbf{x}=\mathbf{P}\mathbf{D}\mathbf{c}\). Because \(\mathbf{P}\) is invertible, the coordinates of \(\mathbf{A}\mathbf{x}\) in this ordered list are exactly \(\mathbf{D}\mathbf{c}\). \(\square\)

Worked Example: Building the Factors for a Three-by-Three Matrix

Consider the matrix and ordered eigenvectors \(\mathbf{A}=\begin{bmatrix}2&1&-1\\-\frac12&\frac72&\frac12\\-\frac32&\frac32&\frac52\end{bmatrix}\), \(\mathbf{v}_1=\begin{bmatrix}1\\0\\1\end{bmatrix}\), \(\mathbf{v}_2=\begin{bmatrix}1\\1\\0\end{bmatrix}\), and \(\mathbf{v}_3=\begin{bmatrix}0\\1\\1\end{bmatrix}\), with corresponding eigenvalues \(1,3,4\). Construct the factors and check the result.

Place the vectors in the columns of \(\mathbf{P}\). The matching eigenvalues go in the diagonal positions of \(\mathbf{D}\):

$$ \mathbf{P}=\begin{bmatrix}1&1&0\\0&1&1\\1&0&1\end{bmatrix}, \qquad \mathbf{D}=\begin{bmatrix}1&0&0\\0&3&0\\0&0&4\end{bmatrix}. $$

The columns are independent. Indeed, if \(c_1\mathbf{v}_1+c_2\mathbf{v}_2+c_3\mathbf{v}_3=\mathbf{0}\), the coordinate equations are \(c_1+c_2=0\), \(c_2+c_3=0\), and \(c_1+c_3=0\). The first two give \(c_2=-c_1\) and \(c_3=c_1\); the third then gives \(2c_1=0\), so all three coefficients are zero. To compute the inverse, multiply the following matrices:

$$ \mathbf{P}^{-1}=\frac12 \begin{bmatrix}1&-1&1\\1&1&-1\\-1&1&1\end{bmatrix}, \qquad \mathbf{P}\mathbf{P}^{-1} =\frac12\begin{bmatrix}2&0&0\\0&2&0\\0&0&2\end{bmatrix} =\mathbf{I}_3. $$

Next, scale each column of \(\mathbf{P}\) by its matching eigenvalue to form \(\mathbf{P}\mathbf{D}\):

$$ \mathbf{P}\mathbf{D} = \begin{bmatrix}1&3&0\\0&3&4\\1&0&4\end{bmatrix}. $$

Multiplying this by the inverse gives

$$ \mathbf{P}\mathbf{D}\mathbf{P}^{-1} = \frac12 \begin{bmatrix}1&3&0\\0&3&4\\1&0&4\end{bmatrix} \begin{bmatrix}1&-1&1\\1&1&-1\\-1&1&1\end{bmatrix} = \begin{bmatrix}2&1&-1\\-\frac12&\frac72&\frac12\\-\frac32&\frac32&\frac52\end{bmatrix} =\mathbf{A}. $$

Check: multiplying \(\mathbf{A}\mathbf{P}\) gives \(\begin{bmatrix}1&3&0\\0&3&4\\1&0&4\end{bmatrix}\), exactly the displayed \(\mathbf{P}\mathbf{D}\). Its columns are \(1\mathbf{v}_1\), \(3\mathbf{v}_2\), and \(4\mathbf{v}_3\), so each eigenvector equation is verified as well.

Order, Scaling, and a Common Error

The columns of \(\mathbf{P}\) form an ordered list, not an unordered set. If two eigenvectors exchange positions, their eigenvalues must exchange positions in \(\mathbf{D}\) as well. Otherwise, the diagonal matrix scales a vector by the wrong eigenvalue. Eigenvectors may also be multiplied by nonzero scalars: this changes \(\mathbf{P}\), but it does not change the eigenvalue that belongs in the corresponding diagonal position.

Worked Example: Reordering the Same Eigenvectors

Use the two eigenvectors from the first worked example, but reverse their order. The new columns are \(\mathbf{v}_2,\mathbf{v}_1\), so set \(\mathbf{P}'=\begin{bmatrix}-1&1\\2&0\end{bmatrix}\) and match them with \(\mathbf{D}'=\begin{bmatrix}2&0\\0&4\end{bmatrix}\).

The inverse is \((\mathbf{P}')^{-1}=\begin{bmatrix}0&\frac12\\1&\frac12\end{bmatrix}\), as direct multiplication confirms: \(\begin{bmatrix}-1&1\\2&0\end{bmatrix}\begin{bmatrix}0&\frac12\\1&\frac12\end{bmatrix}=\begin{bmatrix}1&0\\0&1\end{bmatrix}\). Now compute:

$$ \mathbf{P}'\mathbf{D}' = \begin{bmatrix}-2&4\\4&0\end{bmatrix}, \qquad \mathbf{P}'\mathbf{D}'(\mathbf{P}')^{-1} = \begin{bmatrix}-2&4\\4&0\end{bmatrix} \begin{bmatrix}0&\frac12\\1&\frac12\end{bmatrix} = \begin{bmatrix}4&1\\0&2\end{bmatrix} =\mathbf{A}. $$

Check: the reversed ordering still yields the original matrix because the eigenvalues were reversed with the eigenvectors. If we instead kept \(\mathbf{D}=\operatorname{diag}(4,2)\), then \(\mathbf{P}'\mathbf{D}\) would be \(\begin{bmatrix}-4&2\\8&0\end{bmatrix}\), and multiplying by \((\mathbf{P}')^{-1}\) would give \(\begin{bmatrix}2&-1\\0&4\end{bmatrix}\), not \(\mathbf{A}\).

Common pitfall: mismatched pairs. The incorrect calculation above did not fail because either vector stopped being an eigenvector. It failed because the first column of \(\mathbf{P}'\) is an eigenvector for \(2\), while the first diagonal entry was incorrectly set to \(4\). The correction is to keep each pair together: column \(i\) of \(\mathbf{P}\) must satisfy \(\mathbf{A}\mathbf{v}_i=\lambda_i\mathbf{v}_i\), and entry \(i\) of \(\mathbf{D}\) must be \(\lambda_i\).

A second warning is that merely collecting \(n\) eigenvectors does not guarantee that they can be used in this formula: they must be linearly independent. For example, for the identity matrix \(\mathbf{I}_2\), both \(\begin{bmatrix}1\\0\end{bmatrix}\) and \(\begin{bmatrix}2\\0\end{bmatrix}\) are eigenvectors, but using them as columns gives a dependent list and a matrix with no inverse. Choose an independent list before computing \(\mathbf{P}^{-1}\).

Putting the Procedure into Practice

When a suitable ordered list of eigenvectors is already known, constructing and checking the factorization is systematic:

1
Pair the data.
For each proposed eigenvector, record the eigenvalue that satisfies its defining equation.
2
Build the two matrices.
Put the eigenvectors as columns of \(\mathbf{P}\), and put the matching eigenvalues on the diagonal of \(\mathbf{D}\) in the same order.
3
Check invertibility.
Verify that the columns of \(\mathbf{P}\) are independent. Only then does \(\mathbf{P}^{-1}\) exist.
4
Verify the action.
Check \(\mathbf{A}\mathbf{P}=\mathbf{P}\mathbf{D}\) column by column or by matrix multiplication.
5
Recover the matrix.
Compute \(\mathbf{P}\mathbf{D}\mathbf{P}^{-1}\) and compare every entry with \(\mathbf{A}\).

The intermediate check \(\mathbf{A}\mathbf{P}=\mathbf{P}\mathbf{D}\) is often quicker than a full product and can locate an ordering error immediately. The final product is still valuable: it verifies that the inverse and matrix multiplication have also been computed correctly. The factorization is not a new matrix unrelated to \(\mathbf{A}\); it expresses the same linear action in coordinates adapted to the chosen eigenvectors.

Check Your Understanding

For each question, keep the columns of \(\mathbf{P}\) and the diagonal entries of \(\mathbf{D}\) in matching order.

  1. If the columns of \(\mathbf{P}\) are eigenvectors \(\mathbf{v}_1,\mathbf{v}_2,\mathbf{v}_3\) for eigenvalues \(5,1,5\), write the corresponding diagonal matrix \(\mathbf{D}\).
  2. Explain why \(n\) eigenvectors in \(\mathbb{R}^n\) must be linearly independent for the expression \(\mathbf{P}\mathbf{D}\mathbf{P}^{-1}\) to be defined with those vectors as columns.
  3. Suppose \(\mathbf{A}\mathbf{P}=\mathbf{P}\mathbf{D}\) and \(\mathbf{P}\) is invertible. Show by right multiplication that \(\mathbf{A}=\mathbf{P}\mathbf{D}\mathbf{P}^{-1}\).
  4. For the first worked example, reverse the columns of \(\mathbf{P}\) and state the diagonal entries that must be reversed with them.
  5. Give one reason why checking \(\mathbf{A}\mathbf{P}=\mathbf{P}\mathbf{D}\) is useful before computing the full factorization.

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