MathAlgebraLinear algebraMatrix decomposition

Diagonalizing matrices

9 minutes read

In this topic, we will finally delve into the practical procedure of diagonalizing matrices. Our focus is to provide you with the necessary tools and steps to successfully carry out the diagonalization process.

But first, let's develop the necessary theoretical results. Please remember that a square matrix AA of dimension nn is diagonalizable if there exists a diagonal matrix DD and an invertible one PP such that A=PDP1A=PDP^{−1}.

The surprising connection with eigenvectors

Let us first carefully analyze the definition of diagonalizability. Let's write the columns of PP as v1,,vn\bold{v_1, \dots, v_n} and the diagonal entries of DD as d1,,dnd_1, \dots, d_n.

If we multiply the equation A=PDP1A=PDP^{−1} on the right by PP, then we simply have that:AP=PDAP =PDFor these two matrices to be equal, it is enough that their columns are equal, so we will focus on them. In fact, we only need to consider the first column, since the reasoning is the same for all the others.

First, from the properties of matrix multiplication, we know that the first column of the product APAP is simply the product of AA with the first column of PP, that is, Av1A \mathbf{v_1}. On the other hand, we can follow the same reasoning for the first column of PDPD; but since we also know that DD is diagonal, we obtain the first column of PDPD is d1v1d_1 \bold{v_1}. Therefore, we are looking for:Av1=d1v1A\bold{v_1} = d_1 \bold{v_1}But wait just a moment... that equation looks like one we already know... what that expression means is that v1\mathbf{v_1} is an eigenvector of AA with eigenvalue d1d_1!

Thus, AA is diagonalizable if and only if the columns of PP are eigenvectors of AA whose corresponding eigenvalues are the diagonal entries of DD.

Thanks to our surprising result, to construct PP and DD all we need is to calculate all the eigenvalues of AA together with their eigenvectors:

  • Put the eigenvalues as the entries of the diagonal of DD.

  • Put the respective eigenvectors as the columns of PP.

How to detect diagonalizability

Not every matrix is diagonalizable, but the connection with eigenvectors is so deep that it allows us to fully understand when a matrix can be diagonalizable.

Before, remember each eigenvalue has an associated eigenspace (the subspace spanned by its eigenvectors), which has a certain dimension. We call this number the geometric multiplicity of the eigenvalue. The characterization theorem is:

The following are equivalent:

a) AA is diagonalizable.

b) There exists a basis consisting of eigenvectors of AA.

c) The sum of the geometric multiplicities of the eigenvalues of AA is nn

The simplest case when diagonalizability exists for sure is when an n×nn \times n matrix has exactly nn eigenvalues. If not, then you have to get the sum of the geometric multiplicities of the eigenvalues.

In short, when you don't have nn distinct eigenvalues, you need to calculate all geometric multiplicities and check if they sum to nn.

Steps to diagonalize

Combining everything we discovered, we now have a straightforward and elegant procedure for diagonalizing any square matrix (as long as it is):

  1. Find all the eigenvalues of the matrix.

  2. Determine the eigenvectors corresponding to each eigenvalue.

  3. Find the dimension of each eigenspace.

  4. Add the geometric multiplicities of each eigenvalue. If the sum is exactly nn, then it is diagonalizable, and we can go to the next step. Otherwise, the matrix is not diagonalizable.

  5. Build PP: its columns are the eigenvectors.

  6. Build DD: the entries on its diagonal are the eigenvalues corresponding to the eigenvectors in the same order. If an eigenvalue has more than one eigenvector, then it is repeated as many times as many eigenvectors it has.

Let's put our brand-new procedure into practice!

A simple diagonalization

Let's start with a simple matrix: A=[3124]A=\begin{bmatrix} 3 & 1 \\ 2 & 4 \\ \end{bmatrix}The first thing you have to do is find its eigenvalues, for this, first calculate its characteristic polynomial χ(λ)=det(AλI)=λ27λ+10\chi(\lambda) = \det(A-\lambda I) = \lambda^2 - 7\lambda + 10. The roots of the polynomial are the eigenvalues, so we get that they are 55 and 22. Thanks to our shortcut, we notice that there are as many eigenvalues as the dimension of AA, so it is diagonalizable!

Now you have to find the eigenvectors. Starting with 55, you need the solutions of the system of equations (A5I)v=0(A-5 I ) v = 0, that is:

[2121][xy]=[00]\begin{bmatrix} -2 & 1 \\ 2 & -1 \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \end{bmatrix}A possible solution would be v1=(1,2)Tv_1=(1, 2)^T. Now, for the eigenvalue 22, you need to solve (A2I)v=0(A-2 I ) v = 0:

[1122][xy]=[00]\begin{bmatrix} 1 & 1 \\ 2 & 2 \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \end{bmatrix}An easy solution is be v2=(1,1)Tv_2=(-1, 1)^T. All ready! You only have to create DD whose diagonal entries are the eigenvalues and PP whose columns are the eigenvectors in the same order:D=[5002]andP=[v1v2]=[1121]D =\begin{bmatrix}5 &0\\ 0&2\\\end{bmatrix} \qquad \text{and} \qquad P =\begin{bmatrix} v_1 | v_2 \\\end{bmatrix} =\begin{bmatrix}1& -1\\ 2& 1\end{bmatrix}Feel free to verify that A=PDP1A=PDP^{−1} .

A more challenging diagonalization

Let's analyze the following matrix:A=[503323604]A=\begin{bmatrix} 5 & 0 & -3 \\ -3 & 2 & 3 \\ 6 & 0 & -4 \end{bmatrix}Calculating its characteristic polynomial χ(λ)=det(AλI)=λ3+3λ24\chi(\lambda) = \det(A-\lambda I) = - \lambda^3 + 3 \lambda^2 -4, we see that the eigenvalues are 2 and -1. Until now, you cannot know if A is diagonalizable, you must find all the eigenvectors.

Starting with 22, the eigenvectors are the solutions to the system:

[303303606][xyz]=[000]\begin{bmatrix} 3 & 0 & -3 \\ -3 & 0 & 3 \\ 6 & 0 & -6 \end{bmatrix} \begin{bmatrix} x \\ y \\ z \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 0 \end{bmatrix}You know that the solutions of a system of linear equations is a vector subspace, in this case, it is of the form:

{x(1,0,1)T+y(0,1,0)Tx,yR}\{x (1,0,1)^T + y (0,1,0)^T \, | \, x, y \in \mathbb{R} \}According to our characterization theorem, you need a basis, so you can take v1=(1,0,1)Tv_1 = (1,0,1)^T and v2=(0,1,0)Tv_2 = (0,1,0)^T.

Finally, for the eigenvalue, you must solve the system:

[603333603][xyz]=[000]\begin{bmatrix} 6 & 0 & -3 \\ -3 & 3 & 3 \\ 6 & 0 & -3 \end{bmatrix} \begin{bmatrix} x \\ y \\ z \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 0 \end{bmatrix}A solution would be v3=(1,1,2)Tv_3=(1, -1, 2)^T. And now, you can build DD and PP:

D=[200020001]andP=[v1v2v3]=[101011102]D = \begin{bmatrix}2&0&0 \\ 0&2&0 \\ 0 &0&-1 \\\end{bmatrix} \qquad \text{and} \qquad P =\begin{bmatrix} v_1 | v_2 | v_3 \\\end{bmatrix} =\begin{bmatrix}1&0&1 \\ 0&1&-1 \\ 1&0&2 \\\end{bmatrix}

Not all matrices are diagonalizable

Not every matrix is diagonalizable. Think about this simple one:

A=[2102]A=\begin{bmatrix} 2 & 1 \\ 0 & 2 \\ \end{bmatrix}Its only eigenvalue is 22 but the dimension of its eigenspace is 11, so the matrix is not diagonalizable. But if we still built D=[2002]D=\begin{bmatrix} 2 & 0 \\ 0 & 2 \\ \end{bmatrix}we would get that:

A=PDP1=P(2I)P1=2PIP1=2PP1=2IA = P D P^{-1} = P (2I) P^{-1} = 2 P I P^{-1} = 2 P P^{-1} = 2 IThis is a clear contradiction!

Conclusion

  • A square matrix AA of dimension nn is diagonalizable if there exists a diagonal matrix DD and an invertible one PP such that A=PDP1A=PDP^{−1}.

  • The diagonal entries of DD are the eigenvalues of AA, while the columns of PP are its eigenvectors.

  • The matrix AA is diagonalizable if and only if there is a basis formed by its eigenvectors, which is also equivalent to the fact that the geometric multiplicities of its eigenvalues add up to nn.

  • If AA has nn eigenvalues, then it is diagonalizable.

  • To diagonalize AA, first calculate its eigenvalues, then the associated eigenvectors, and finally get DD and PP.

4 learners liked this piece of theory. 0 didn't like it. What about you?
Report a typo