Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 26

Diagonalizing a Matrix

Recommended resources

Hello! Welcome back to your study of linear algebra.

In our last lesson, we established the crucial conditions for determining if a matrix can be diagonalized. We learned that an matrix is diagonalizable if and only if it has linearly independent eigenvectors, which we test by checking if the geometric multiplicity equals the algebraic multiplicity for every eigenvalue.

Today, we move from the "if" to the "how." Our goal is to construct the diagonalization of a matrix, if it exists. This means we will learn the step-by-step procedure to find the invertible matrix and the diagonal matrix such that . This technique is not just a theoretical exercise; it's a computational workhorse that simplifies complex problems in both deep learning and quantum mechanics.

1. From Eigenvectors to the Diagonalization Formula

Let's start by understanding where the famous formula comes from. It's a clever way of stacking all the individual eigenvalue-eigenvector equations into a single matrix equation.

Suppose we have an matrix that is diagonalizable. By definition, this means we can find linearly independent eigenvectors with corresponding eigenvalues . For each pair, we have:

  • ...

Now, let's assemble the eigenvectors into the columns of a matrix, which we'll call :

What happens when we multiply by ? The multiplication acts on each column separately:

Using our eigenvalue equations, we can substitute with :

This is the key step. The right side can be factored into the original matrix multiplied by a diagonal matrix containing the eigenvalues:

So, we have arrived at the compact equation:

Since the eigenvectors are linearly independent, the matrix is invertible. This allows us to isolate by right-multiplying by :

This is the diagonalization of matrix .

To see this derivation explained, let's watch a classic lecture segment from Professor Gilbert Strang. He uses for the eigenvector matrix and the capital Greek letter Lambda () for the eigenvalue matrix, which is another common notation.

22. Diagonalization and Powers of A

In this video from MIT OpenCourseWare, Professor Strang clearly derives the diagonalization formula, showing how stacking eigenvector equations leads to the expression AS = SΛ.

Watch from the beginning to 6:30. Follow his derivation of the formula A = SΛS⁻¹ (our A = PDP⁻¹). Notice how matrix multiplication allows us to capture all eigenvalue information in one elegant equation.


2. The Recipe for Diagonalization

Now that you've seen the "why," let's outline the "how." Here is a step-by-step recipe for diagonalizing an matrix .

  1. Find the Eigenvalues: Solve the characteristic equation to find all eigenvalues .
  2. Find Linearly Independent Eigenvectors: For each distinct eigenvalue , find a basis for its eigenspace by solving .
  3. Check for Diagonalizability: Count your total number of linearly independent eigenvectors. If this number is less than (which happens when any eigenvalue's geometric multiplicity is less than its algebraic multiplicity), the matrix is not diagonalizable. Stop here.
  4. Construct P and D: If you have linearly independent eigenvectors, create the matrices:
    • : The columns of are the eigenvectors .
    • : is a diagonal matrix with the corresponding eigenvalues on the diagonal. The order must match. If the -th column of is , the -th diagonal entry of must be .
  5. Verify (Optional but Recommended): You can confirm your work by computing and checking that , or by checking the simpler relation .

For a detailed walkthrough of these steps, you can read the following guide.

Matrix Diagonalization: A Comprehensive Guide

This guide from DataCamp provides a clear, step-by-step process for diagonalization, reinforcing the recipe we just discussed.

Read the section 'Step-by-Step Process for Diagonalization'. This will give you a well-structured summary of the procedure.


3. A Worked Example

Let's apply this recipe to diagonalize the matrix .

Step 1: Find Eigenvalues
The characteristic polynomial is:

Setting this to zero gives . Our eigenvalues are and .

Step 2: Find Eigenvectors

  • For : We find the null space of .

    The equation leads to . An eigenvector is .
  • For : We find the null space of .

    The equation leads to . An eigenvector is .

Step 3: Check for Diagonalizability
We have a 2x2 matrix and we found 2 linearly independent eigenvectors. The matrix is diagonalizable.

Step 4: Construct P and D
Let's put our first eigenvector in the first column of .

The corresponding eigenvalues must be in the same order in :

This gives us the diagonalization of .

Step 5: Verify
Let's check that .


The results match, confirming our diagonalization is correct.

The image below shows another complete example for a 2x2 matrix, visually summarizing the entire process.

Matrix Diagonalization Example
This image provides another full example of diagonalizing a 2x2 matrix. It shows the calculation of eigenvalues, eigenvectors, and the construction of the final matrices S (our P) and Λ (our D).

4. The Geometric Meaning: A Change of Basis

The formula is more than an algebraic trick. It represents a deep geometric idea: diagonalization is a change of basis.

  • The matrix describes a linear transformation in our familiar standard coordinate system (defined by and ).
  • The diagonal matrix describes the exact same transformation, but viewed from the perspective of a new coordinate system whose axes are the eigenvectors. This new basis is called an eigenbasis.

In this special eigenbasis, the transformation is incredibly simple: it's just a scaling along each of the new axes by the corresponding eigenvalue. The formula can be read as a three-step process:

  1. : Change to the eigenbasis. Take a vector and find its coordinates in the eigenbasis.
  2. : Scale. Apply the simple scaling transformation in the eigenbasis.
  3. : Change back to the standard basis. Convert the resulting vector back to the standard coordinate system.

This concept of changing to a simpler basis to analyze a transformation is fundamental in both physics and computer science. Let's watch a short clip that illustrates this beautifully.

Eigenvectors and eigenvalues | Chapter 14, Essence of linear algebra

This clip from 3Blue1Brown masterfully illustrates the geometric interpretation of diagonalization as a change of coordinate system to an 'eigenbasis'.

Watch from 12:44 to 16:23. Focus on how the transformation becomes a simple scaling once you change the basis vectors to be the eigenvectors. This is the core intuition behind diagonalization.

Test your understanding!

You are diagonalizing a 3x3 matrix and have found three linearly independent eigenvectors corresponding to eigenvalues .

You construct the matrix . What must the matrix be for the equation to hold?

Show answer

The matrix must have the eigenvalues on its diagonal in the same order as their corresponding eigenvectors appear in the columns of .

Since , the eigenvalues in must be .

Therefore, the matrix must be:


Conclusion

Today, you've learned the complete procedure for diagonalizing a matrix. This powerful technique bridges the abstract theory of eigenvalues with concrete computational benefits.

Key Takeaways:

  • The diagonalization is derived by expressing all equations in a single matrix form, .
  • The columns of are the linearly independent eigenvectors of .
  • The diagonal entries of are the corresponding eigenvalues, placed in the same order as their eigenvectors in .
  • Geometrically, diagonalization represents changing to an eigenbasis where the transformation is a simple scaling, performing the scaling, and then changing back.

Preview of the Next Lesson:

Now that we know how to construct the diagonalization, what can we do with it? In the next lesson, we will explore one of its most immediate and powerful applications: applying diagonalization to efficiently compute powers of a matrix. This is not only useful for algorithms but is also conceptually similar to how one calculates the evolution of systems over time, a key idea in fields like quantum mechanics.