# How to diagonalize a matrix (diagonalizable matrix)

On this post you will find everything about diagonalizable matrices: what diagonalizable matrices are, when a matrix can and cannot be diagonalized, how to to diagonalize matrices,… And you even have several problems solved step by step so that you can practice and understand perfectly how to do it. Finally, you will see the applications that matrix diagonalization has and the properties of diagonalizable matrices.

## What is a diagonalizable matrix?

As we will see below, diagonalizing a matrix is very useful in the field of linear algebra. So you may be wondering… what is diagonalizing a matrix? Well, the definition of diagonalizable matrix is as follows:

A diagonalizable matrix is a square matrix that can be transformed into a diagonal matrix, that is, a matrix filled with zeros except for the main diagonal. The mathematical relation between a matrix and its diagonalized matrix is:

Or equivalently:

Where A is the matrix to be diagonalized, P is the matrix whose columns are the eigenvectors of A, P-1 its inverse matrix, and D is the diagonal matrix composed by the eigenvalues of A.

Matrix P acts as a change of basis matrix, so in reality with this formula we are actually changing basis to matrix A so that the matrix becomes a diagonal matrix (D) in the new basis.

Thus, matrix A and matrix D are similar matrices. And, logically, P is an invertible matrix.

## When is a matrix diagonalizable?

Not all matrices are diagonalizable, only matrices that meet certain characteristics can be diagonalized. There are three ways to know whether a matrix is diagonalizable:

1. A square matrix of order n is diagonalizable if it has n linearly independent eigenvectors, in other words, if these vectors form a basis. That is because matrix P is formed by the eigenvectors of that matrix. To know whether the eigenvectors meet this condition, it is enough that the determinant of the matrix P is nonzero, which means that the matrix has maximum rank.

1. One property of eigenvalues and eigenvectors is that eigenvectors of different eigenvalues are linearly independent. Therefore, if all eigenvalues of the matrix are unique the matrix is diagonalizable.
1. Another way to determine whether a matrix can be factored into a diagonal matrix is by using the algebraic and geometric multiplicities. The algebraic multiplicity is the number of times an eigenvalue is repeated, and the geometric multiplicity is the dimension of the nullspace of matrix (A-λI). Thus, if the algebraic multiplicity is equal to the geometric multiplicity for each eigenvalue, the matrix is diagonalizable.

1. Finally, the spectral theorem states that every real symmetric matrix is diagonalizable.

## How to diagonalize a matrix

The process of diagonalizing a matrix is based on computing the eigenvalues and eigenvectors of a matrix. So, to diagonalize a matrix you must first know how to find the eigenvalues and the eigenvectors of a matrix.

With the following method you can diagonalize a matrix of any dimension: 2×2, 3×3, 4×4, etc. The steps to diagonalize a matrix are:

1. Find the eigenvalues of the matrix.
2. Calculate the eigenvector associated with each eigenvalue.
3. Form matrix P, whose columns are the eigenvectors of the matrix to be diagonalized.
4. Verify that the matrix can be diagonalized (it must satisfy one of the conditions explained in the previous section).
5. Form diagonal matrix D, whose elements are all 0 except those on the main diagonal, which are the eigenvalues found in step 1.

Note: The eigenvectors of matrix P can be placed in any order, but the eigenvalues of diagonal matrix D must be placed in that same order. For example, the first eigenvalue of diagonal matrix D must correspond to the eigenvector of the first column of matrix P.

Below you have several step-by-step solved exercises of matrix diagonalization with which you can practice.

## Practice problems on matrix diagonalization

### Problem 1

Diagonalize the following 2×2 dimension matrix:

First we must determine the eigenvalues of matrix A. So we calculate the characteristic polynomial solving the following determinant:

Now we calculate the roots of the characteristic polynomial:

Then, we calculate the eigenvector associated with each eigenvalue. First the eigenvector corresponding to eigenvalue 1:

And secondly we calculate the eigenvector associated with the eigenvalue 4:

We form matrix P, made up of the eigenvectors:

Since all eigenvalues are different, matrix A is diagonalizable. So the corresponding diagonal matrix is the one with the eigenvalues on the main diagonal:

Remember to place the eigenvalues in the same order as the eigenvectors are placed in matrix P.

In conclusion, the change-of-basis matrix and the diagonalized matrix are:

### Problem 2

Diagonalize the following square matrix of order 2:

Firstly, we must find the eigenvalues of matrix A. So we calculate the characteristic equation solving the following determinant:

.

Now we calculate the roots of the characteristic polynomial:

Once the eigenvalues hace been found, we calculate the eigenvector associated with each one. First the eigenvector corresponding to eigenvalue -1:

And then we calculate the eigenvector associated with the eigenvalue of value 2:

We form matrix P, composed by the eigenvectors of the matrix:

As all eigenvalues are different from each other, matrix A is diagonalizable. Thus, the diagonalized matrix is the one that contains the eigenvalues on the main diagonal:

Remember to place the eigenvalues in the same order as the eigenvectors are placed in matrix P.

In conclusion, the change-of-basis matrix and the diagonalized matrix are:

### Problem 3

Diagonalize the following 3×3 dimension matrix:

The first step is to find the eigenvalues of matrix A. So we calculate the characteristic polynomial solving the determinant of the following matrix:

The roots of the third degree polynomial are:

Now find the eigenvector of each eigenvalue. First, we calculate the eigenvector that corresponds to eigenvalue 1:

Then we calculate the eigenvector associated with the eigenvalue 3:

And, finally, we calculate the eigenvector associated with the eigenvalue 4:

We construct matrix P, formed by the eigenvectors of the matrix:

All eigenvalues are different from each other which means that matrix A is diagonalizable. So the corresponding diagonal matrix is the one that has the eigenvalues on the main diagonal:

Remember to place the eigenvalues in the same order as the eigenvectors are placed in matrix P.

Therefore, matrices P and D are:

### Problem 4

Diagonalize, if possible, the following square matrix of order 3:

The first step is to find the eigenvalues of matrix A. So we calculate the characteristic polynomial solving the determinant of the following matrix:

Whose roots are:

The eigenvalue -2 has simple algebraic multiplicity, on the other hand, the eigenvalue 2 has double multiplicity.

We calculate the eigenvector associated with each eigenvalue. First, the eigenvector corresponding to the eigenvalue -2:

Now we calculate the eigenvectors associated with the eigenvalues 2:

Since the eigenvalue 2 is repeated twice, we have to calculate another eigenvector that satisfies the equations of the eigenspace:

We form matrix P with all the eigenvectors:

However, the three vectors are not linearly independent, since obviously the two eigenvectors of the eigenvalue 2 are a linear combination of each other. This can also be shown because the determinant of matrix P is equal to 0 (it has a row full of zeros):

Consequently, since the eigenvectors are linearly dependent, matrix A is not diagonalizable.

### Problem 5

Diagonalize, if possible, the following 3×3 dimension matrix:

The first step is to find the eigenvalues of matrix A. So we calculate the characteristic polynomial solving the determinant of the following matrix:

The roots of the characteristic polynomial, and therefore the eigenvalues of matrix A, are:

Now we calculate the eigenvector associated with each eigenvalue. First, the eigenvector corresponding to the eigenvalue 1:

Then we calculate the eigenvectors associated with the eigenvalues 3:

Since the eigenvalue 3 is repeated twice, we have to calculate another eigenvector that complies with the equations of the eigenspace:

We form matrix P with the eigenvectors of the matrix:

Unlike exercise 4, in this case we have been able to form 3 linearly independent vectors even though eigenvalue 3 has double algebraic multiplicity. We can check this condition by solving determinant of matrix P (it is different from zero):

So it is possible to perform the diagonal decomposition of matrix A. And the corresponding diagonal matrix is the one that has the eigenvalues on the main diagonal:

Remember to place the eigenvalues in the same order as the eigenvectors are placed in matrix P.

Therefore, matrices P and D are:

### Problem 6

Diagonalize, if possible, the following 4×4 dimension matrix:

The first step is to find the eigenvalues of matrix A. So we determine the characteristic polynomial solving the determinant of the following matrix:

The roots of the fourth degree polynomial, and therefore the eigenvalues of matrix A, are:

Once all the eigenvalues have been calculated, we are going to find the eigenvectors. We determine the eigenvector associated with the eigenvalue 0:

We calculate the eigenvector associated with the eigenvalue -3:

We calculate the eigenvector associated with the eigenvalue 2:

We calculate the eigenvector associated with the eigenvalue 5:

We form matrix P, composed of the eigenvectors of the matrix:

Since all eigenvalues are different from each other, matrix A is diagonalizable. And the corresponding diagonal matrix is the one that has the eigenvalues on the main diagonal:

Remember to place the eigenvalues in the same order as the eigenvectors are placed in matrix P.

In conclusion, the change-of-basis matrix and the diagonalized matrix are:

## Applications of diagonalizable matrices

If you’ve gotten this far, I’m sure you’re wondering: what is a diagonalizable matrix for?

Well, diagonalizable matrices are very useful and are used a lot in mathematics. The reason is that a diagonal matrix is practically full of zeros and therefore makes calculations much easier.

A clear example of this is the power of a diagonalizable matrix, since its result is simplified by the following formula:

So it is only necessary to raise matrix D to the exponent. And since it is a diagonal matrix, the operation consists of only raising each term on the main diagonal to the exponent:

### Example of the power of a diagonalizable matrix

For a better understanding, we will calculate the power of a matrix that is diagonalizable as an example:

The change-of-basis matrix P, made up of its eigenvectors, and the diagonalized matrix D, made up of its eigenvalues, are:

So, to give an example, matrix A raised to 7 is equivalent to:

Now we calculate the inverse of matrix P:

Then we solve the power of the matrix D:

And, finally, we perform the matrix multiplications:

As you have seen, it is more convenient to calculate the power with a diagonal matrix than to multiply the same matrix seven times in a row. Imagine then with much higher exponent values.

## Properties of diagonalizable matrices

The characteristics of this type of matrices are:

• If matrix A is diagonalizable, then so is any power of A.
• Almost all matrices can be diagonalized over a complex environment. Although some matrices can never be diagonalized.
• If matrix P is an orthogonal matrix, then matrix A is said to be orthogonally diagonalizable and, therefore, the equation can be rewritten:

• A matrix is diagonalizable by a unitary matrix if and only if it is a normal matrix.
• Given two diagonalizable matrices, they commute if and only if they can be diagonalized simultaneously, that is, if they share the same orthonormal basis of eigenvectors.
• If an endomorphism is diagonalizable, it is said to be diagonalizable by similarity. However, not all endomorphisms are diagonalizable.