library(tidyverse)
library(dasc2594)
set.seed(2021)
22 Diagonalization
Definition 22.1 A \(n \times n\) matrix \(\mathbf{A}\) is diagonalizable if the matrix \(\mathbf{A}\) is similar to a diagonal matrix. This is equivalent to saying there exists some invertible \(n \times n\) matrix \(\mathbf{P}\) and diagonal matrix \(\mathbf{D}\) such that
\[ \begin{aligned} \mathbf{A} & = \mathbf{P} \mathbf{D} \mathbf{P}^{-1} \end{aligned} \]
Example 22.1 Any diagonal matrix \(\mathbf{D}\) is diagonalizable becuase it is self-similar.
Theorem 22.1 (The Diagonalization Theorem) A \(n \times n\) matrix \(\mathbf{A}\) is diagonalizable if and only if the matrix \(\mathbf{A}\) has \(n\) linearly independent eigenvectors.
In addition, the \(n \times n\) matrix \(\mathbf{A} = \mathbf{P} \mathbf{D} \mathbf{P}^{-1}\) with diagonal matrix \(\mathbf{D}\) if and only if the columns of \(\mathbf{P}\) are the lienarly independent eigenvectors of \(\mathbf{A}\). Then, the diagonal elements of \(\mathbf{D}\) are the eigenvalues of \(\mathbf{A}\) that correspond to the eigenvectors in \(\mathbf{P}\).
This theorem implies that the matrix \(\mathbf{A}\) is diagonalizable if and only if the eigenvectors of \(\mathbf{A}\) form a basis for \(\mathcal{R}^n\). When this is the case, the set of eigenvectors is called an eigenbasis.
Example 22.2 Consider the following example of a diagonalizable matrix \(\mathbf{A}\)
<- matrix(c(9, 2, 0, -3, 2, -4, 1, 0, 3), 3, 3)
A A
[,1] [,2] [,3]
[1,] 9 -3 1
[2,] 2 2 0
[3,] 0 -4 3
<- eigen(A)
eigen_A str(eigen_A)
List of 2
$ values : num [1:3] 7.63 4.52 1.86
$ vectors: num [1:3, 1:3] -0.905 -0.322 0.278 -0.407 -0.324 ...
- attr(*, "class")= chr "eigen"
<- eigen_A$vectors
P P
[,1] [,2] [,3]
[1,] -0.9050468 -0.4069141 -0.01938647
[2,] -0.3217259 -0.3235720 0.27433148
[3,] 0.2781774 0.8542377 0.96143976
<- diag(eigen_A$values)
D D
[,1] [,2] [,3]
[1,] 7.626198 0.000000 0.000000
[2,] 0.000000 4.515138 0.000000
[3,] 0.000000 0.000000 1.858664
%*% D %*% solve(P) P
[,1] [,2] [,3]
[1,] 9.000000e+00 -3 1.000000e+00
[2,] 2.000000e+00 2 -9.144832e-16
[3,] 1.342835e-15 -4 3.000000e+00
all.equal(A, P %*% D %*% solve(P))
[1] TRUE
Theorem 22.2 Let \(\mathbf{A}\) be a \(n \times n\) diagonalizable matrix with \(\mathbf{A} = \mathbf{P} \mathbf{D} \mathbf{P}^{-1}\). Then, the matrix power \(\mathbf{A}^p\) is
\[ \begin{aligned} \mathbf{A}^p = \mathbf{P} \mathbf{D}^p \mathbf{P}^{-1} \end{aligned} \]
Example 22.3 In this example, we apply the diagonalization theorem to the matrix \(\mathbf{A}\)
Consider the matrix \(\mathbf{A} = \begin{pmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \end{pmatrix}\) which has eigenvalues 1, 2, 3. Then the standard basis \(\mathbf{e}_1 = \begin{pmatrix} 1 \\ 0 \\ 0 \end{pmatrix}\), \(\mathbf{e}_2 = \begin{pmatrix} 0 \\ 1 \\ 0 \end{pmatrix}\), and \(\mathbf{e}_3 = \begin{pmatrix} 0 \\ 0 \\ 1 \end{pmatrix}\) are corresponding eigenvectors (check the definition \(\mathbf{A} \lambda = \mathbf{v} \lambda\)) because
\[ \begin{aligned} \begin{pmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \end{pmatrix} \begin{pmatrix} 1 \\ 0 \\ 0 \end{pmatrix} & = 1 * \begin{pmatrix} 1 \\ 0 \\ 0 \end{pmatrix} \\ \begin{pmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \end{pmatrix} \begin{pmatrix} 0 \\ 1 \\ 0 \end{pmatrix} & = 2 * \begin{pmatrix} 0 \\ 1 \\ 0 \end{pmatrix} \\ \begin{pmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \end{pmatrix} \begin{pmatrix} 0 \\ 0 \\ 1 \end{pmatrix} & = 3 * \begin{pmatrix} 0 \\ 0 \\ 1 \end{pmatrix} \end{aligned} \]
Thus, by the diagonlaization theorem, we have \(\mathbf{A} = \mathbf{P} \mathbf{D} \mathbf{P}^{-1}\) where \(\mathbf{P}\) is the identity matrix and \(\mathbf{D}\) is the diagonal matrix with entries 1, 2, 3.
\[ \begin{aligned} \begin{pmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \end{pmatrix} & = \begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \end{pmatrix} \begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix}^{-1} \end{aligned} \]
which gives us that \(\mathbf{A}\) is similar to itself.
However, there is nothing in the diagonalization theorem that says that we must put the eigenvalues in the order 1, 2, 3. If we put the eigenvalues in the order 3, 2, 1, then the corresponding eigenvectors are \(\mathbf{e}_3\), \(\mathbf{e}_2\), and \(\mathbf{e}_1\). Using the diagonlaization theorem, we have \(\mathbf{A} = \tilde{\mathbf{P}} \tilde{\mathbf{D}} \tilde{\mathbf{P}}^{-1}\) where \(\tilde{\mathbf{P}}\) is the matrix with columns \(\mathbf{e}_3\), \(\mathbf{e}_2\), and \(\mathbf{e}_1\) and \(\tilde{\mathbf{D}}\) is the diagonal matrix with entries 3, 2, 1 which results in
\[ \begin{aligned} \begin{pmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \end{pmatrix} & = \begin{pmatrix} 0 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 0 & 0 \end{pmatrix} \begin{pmatrix} 3 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} 0 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 0 & 0 \end{pmatrix}^{-1} \end{aligned} \]
which implies that the matrices \(\begin{pmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \end{pmatrix}\) and \(\begin{pmatrix} 3 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 1 \end{pmatrix}\) are similar to each other