## SectionSDSimilarity and Diagonalization

This section's topic will perhaps seem out of place at first, but we will make the connection soon with eigenvalues and eigenvectors. This is also our first look at one of the central ideas of Chapter R.

### SubsectionSMSimilar Matrices

The notion of matrices being “similar” is a lot like saying two matrices are row-equivalent. Two similar matrices are not equal, but they share many important properties. This section, and later sections in Chapter R will be devoted in part to discovering just what these common properties are.

First, the main definition for this section.

#### DefinitionSIM.Similar Matrices.

Suppose $$A$$ and $$B$$ are two square matrices of size $$n\text{.}$$ Then $$A$$ and $$B$$ are similar if there exists a nonsingular matrix of size $$n\text{,}$$ $$S\text{,}$$ such that $$A=\similar{B}{S}\text{.}$$

We will say “$$A$$ is similar to $$B$$ via $$S$$” when we want to emphasize the role of $$S$$ in the relationship between $$A$$ and $$B\text{.}$$ Also, it does not matter if we say $$A$$ is similar to $$B\text{,}$$ or $$B$$ is similar to $$A\text{.}$$ If one statement is true then so is the other, as can be seen by using $$\inverse{S}$$ in place of $$S$$ (see Theorem SER for the careful proof). Finally, we will refer to $$\similar{B}{S}$$ as a similarity transformation when we want to emphasize the way $$S$$ changes $$B\text{.}$$ OK, enough about language, let us build a few examples.

If you wondered if there are examples of similar matrices, then it will not be hard to convince you they exist. Define

\begin{align*} B=\begin{bmatrix} -4 & 1 & -3 & -2 & 2 \\ 1 & 2 & -1 & 3 & -2 \\ -4 & 1 & 3 & 2 & 2 \\ -3 & 4 & -2 & -1 & -3 \\ 3 & 1 & -1 & 1 & -4 \end{bmatrix}&& S=\begin{bmatrix} 1 & 2 & -1 & 1 & 1 \\ 0 & 1 & -1 & -2 & -1 \\ 1 & 3 & -1 & 1 & 1 \\ -2 & -3 & 3 & 1 & -2 \\ 1 & 3 & -1 & 2 & 1\\ \end{bmatrix}\text{.} \end{align*}

Check that $$S$$ is nonsingular and then compute

\begin{align*} &A=\similar{B}{S}\\ &= \begin{bmatrix} 10 & 1 & 0 & 2 & -5 \\ -1 & 0 & 1 & 0 & 0 \\ 3 & 0 & 2 & 1 & -3 \\ 0 & 0 & -1 & 0 & 1 \\ -4 & -1 & 1 & -1 & 1 \end{bmatrix} \begin{bmatrix} -4 & 1 & -3 & -2 & 2 \\ 1 & 2 & -1 & 3 & -2 \\ -4 & 1 & 3 & 2 & 2 \\ -3 & 4 & -2 & -1 & -3 \\ 3 & 1 & -1 & 1 & -4 \end{bmatrix} \begin{bmatrix} 1 & 2 & -1 & 1 & 1 \\ 0 & 1 & -1 & -2 & -1 \\ 1 & 3 & -1 & 1 & 1 \\ -2 & -3 & 3 & 1 & -2 \\ 1 & 3 & -1 & 2 & 1 \end{bmatrix}\\ &= \begin{bmatrix} -10 & -27 & -29 & -80 & -25 \\ -2 & 6 & 6 & 10 & -2 \\ -3 & 11 & -9 & -14 & -9 \\ -1 & -13 & 0 & -10 & -1 \\ 11 & 35 & 6 & 49 & 19 \end{bmatrix}\text{.} \end{align*}

So by this construction, we know that $$A$$ and $$B$$ are similar.

Let us do that again.

Define

\begin{align*} B=\begin{bmatrix} -13 & -8 & -4 \\ 12 & 7 & 4 \\ 24 & 16 & 7 \end{bmatrix}&& S=\begin{bmatrix} 1 & 1 & 2 \\ -2 & -1 & -3 \\ 1 & -2 & 0 \end{bmatrix}\text{.} \end{align*}

Check that $$S$$ is nonsingular and then compute

\begin{align*} A&=\similar{B}{S}\\ &= \begin{bmatrix} -6 & -4 & -1 \\ -3 & -2 & -1 \\ 5 & 3 & 1 \end{bmatrix} \begin{bmatrix} -13 & -8 & -4 \\ 12 & 7 & 4 \\ 24 & 16 & 7 \end{bmatrix} \begin{bmatrix} 1 & 1 & 2 \\ -2 & -1 & -3 \\ 1 & -2 & 0 \end{bmatrix}\\ &= \begin{bmatrix} -1 & 0 & 0 \\ 0 & 3 & 0 \\ 0 & 0 & -1 \end{bmatrix}\text{.} \end{align*}

So by this construction, we know that $$A$$ and $$B$$ are similar. But before we move on, look at how pleasing the form of $$A$$ is. Not convinced? Then consider that several computations related to $$A$$ are especially easy. For example, in the spirit of Example DUTM, $$\detname{A}=(-1)(3)(-1)=3\text{.}$$ Similarly, the characteristic polynomial is straightforward to compute by hand, $$\charpoly{A}{x}=(-1-x)(3-x)(-1-x)=-(x-3)(x+1)^2$$ and since the result is already factored, the eigenvalues are transparently $$\lambda=3,\,-1\text{.}$$ Finally, the eigenvectors of $$A$$ are just the standard unit vectors (Definition SUV).

### SubsectionPSMProperties of Similar Matrices

Similar matrices share many properties and it is these theorems that justify the choice of the word “similar.” First we will show that similarity is an equivalence relation. Equivalence relations are important in the study of various algebras and can always be regarded as a kind of weak version of equality. Sort of alike, but not quite equal. The notion of two matrices being row-equivalent is an example of an equivalence relation we have been working with since the beginning of the course (see Exercise RREF.T11). Row-equivalent matrices are not equal, but they are a lot alike. For example, row-equivalent matrices have the same rank. Formally, an equivalence relation requires three conditions hold: reflexive, symmetric and transitive. We will illustrate these as we prove that similarity is an equivalence relation.

To see that $$A$$ is similar to $$A\text{,}$$ we need only demonstrate a nonsingular matrix that effects a similarity transformation of $$A$$ to $$A\text{.}$$ $$I_n$$ is nonsingular (since it row-reduces to the identity matrix, Theorem NMRRI), and

\begin{equation*} \similar{A}{I_n}=I_nAI_n=A\text{.} \end{equation*}

If we assume that $$A$$ is similar to $$B\text{,}$$ then we know there is a nonsingular matrix $$S$$ so that $$A=\similar{B}{S}$$ by Definition SIM. By Theorem MIMI, $$\inverse{S}$$ is invertible, and by Theorem NI is therefore nonsingular. So

\begin{align*} \similar{A}{(\inverse{S})}&=SA\inverse{S}&& \knowl{./knowl/theorem-MIMI.html}{\text{Theorem MIMI}}\\ &=S\similar{B}{S}\inverse{S}&& \knowl{./knowl/definition-SIM.html}{\text{Definition SIM}}\\ &=\left(S\inverse{S}\right)B\left(S\inverse{S}\right)&& \knowl{./knowl/theorem-MMA.html}{\text{Theorem MMA}}\\ &=I_nBI_n&& \knowl{./knowl/definition-MI.html}{\text{Definition MI}}\\ &=B&& \knowl{./knowl/theorem-MMIM.html}{\text{Theorem MMIM}} \end{align*}

and we see that $$B$$ is similar to $$A\text{.}$$

Assume that $$A$$ is similar to $$B\text{,}$$ and $$B$$ is similar to $$C\text{.}$$ This gives us the existence of two nonsingular matrices, $$S$$ and $$R\text{,}$$ such that $$A=\similar{B}{S}$$ and $$B=\similar{C}{R}\text{,}$$ by Definition SIM. (Notice how we have to assume $$S\neq R\text{,}$$ as will usually be the case.) Since $$S$$ and $$R$$ are invertible, so too $$RS$$ is invertible by Theorem SS and then nonsingular by Theorem NI. Now

\begin{align*} \similar{C}{(RS)}&=\similar{\similar{C}{R}}{S}&& \knowl{./knowl/theorem-SS.html}{\text{Theorem SS}}\\ &=\similar{\left(\similar{C}{R}\right)}{S}&& \knowl{./knowl/theorem-MMA.html}{\text{Theorem MMA}}\\ &=\similar{B}{S}&& \knowl{./knowl/definition-SIM.html}{\text{Definition SIM}}\\ &=A \end{align*}

so $$A$$ is similar to $$C$$ via the nonsingular matrix $$RS\text{.}$$

Here is another theorem that tells us exactly what sorts of properties similar matrices share.

Let $$n$$ denote the size of $$A$$ and $$B\text{.}$$ Since $$A$$ and $$B$$ are similar, there exists a nonsingular matrix $$S\text{,}$$ such that $$A=\similar{B}{S}$$ (Definition SIM). Then

\begin{align*} \charpoly{A}{x}&=\detname{A-xI_n}&& \knowl{./knowl/definition-CP.html}{\text{Definition CP}}\\ &=\detname{\similar{B}{S}-xI_n}&& \knowl{./knowl/definition-SIM.html}{\text{Definition SIM}}\\ &=\detname{\similar{B}{S}-x\similar{I_n}{S}}&& \knowl{./knowl/theorem-MMIM.html}{\text{Theorem MMIM}}\\ &=\detname{\similar{B}{S}-\inverse{S}xI_nS}&& \knowl{./knowl/theorem-MMSMM.html}{\text{Theorem MMSMM}}\\ &=\detname{\similar{\left(B-xI_n\right)}{S}}&& \knowl{./knowl/theorem-MMDAA.html}{\text{Theorem MMDAA}}\\ &=\detname{\inverse{S}}\detname{B-xI_n}\detname{S}&& \knowl{./knowl/theorem-DRMM.html}{\text{Theorem DRMM}}\\ &=\detname{\inverse{S}}\detname{S}\detname{B-xI_n}&& \knowl{./knowl/property-CMCN.html}{\text{Property CMCN}}\\ &=\detname{\inverse{S}S}\detname{B-xI_n}&& \knowl{./knowl/theorem-DRMM.html}{\text{Theorem DRMM}}\\ &=\detname{I_n}\detname{B-xI_n}&& \knowl{./knowl/definition-MI.html}{\text{Definition MI}}\\ &=1\detname{B-xI_n}&& \knowl{./knowl/definition-DM.html}{\text{Definition DM}}\\ &=\charpoly{B}{x}&& \knowl{./knowl/definition-CP.html}{\text{Definition CP}}\text{.} \end{align*}

So similar matrices not only have the same set of eigenvalues, the algebraic multiplicities of these eigenvalues will also be the same. However, be careful with this theorem. It is tempting to think the converse is true, and argue that if two matrices have the same eigenvalues, then they are similar. Not so, as the following example illustrates.

Define

\begin{align*} A&=\begin{bmatrix}1&1\\0&1\end{bmatrix} & B&=\begin{bmatrix}1&0\\0&1\end{bmatrix} \end{align*}

and check that

\begin{equation*} \charpoly{A}{x}=\charpoly{B}{x}=1-2x+x^2=(x-1)^2 \end{equation*}

and so $$A$$ and $$B$$ have equal characteristic polynomials. If the converse of Theorem SMEE were true, then $$A$$ and $$B$$ would be similar. Suppose this is the case. More precisely, suppose there is a nonsingular matrix $$S$$ so that $$A=\similar{B}{S}\text{.}$$

Then

\begin{equation*} A=\similar{B}{S}=\similar{I_2}{S}=\inverse{S}S=I_2\text{.} \end{equation*}

Clearly $$A\neq I_2$$ and this contradiction tells us that the converse of Theorem SMEE is false.

#### SageSM.Similar Matrices.

It is quite easy to determine if two matrices are similar, using the matrix method .is_similar(). However, computationally this can be a very difficult proposition, so support in Sage is incomplete now, though it will always return a result for matrices with rational entries. Here are examples where the two matrices are, and are not, similar. Notice that the keyword option transformation=Truewill cause a pair to be returned, such that if the matrices are indeed similar, the matrix effecting the similarity transformation will be in the second slot of the pair.

A = matrix(QQ, [[ 25,   2,  -8,  -1,  11,  26,  35],
[ 28,   2, -15,   2,   6,  34,  31],
[  1, -17, -25,  28, -44,  26, -23],
[ 36,  -2, -24,  10,  -1,  50,  39],
[  0,  -7, -13,  14, -21,  14, -11],
[-22, -17, -16,  27, -51,   1, -53],
[  -1, 10,  17, -18,  28, -18,  15]])
B = matrix(QQ, [[-89, -16, -55, -23, -104, -48, -67],
[-15,   1, -20, -21,  -20, -60, -26],
[ 48,   6,  37,  25,   59,  64,  46],
[-96, -16, -49, -16, -114, -23, -67],
[ 56,  10,  33,  13,   67,  29,  37],
[ 10,   2,   2,  -2,   12,  -9,   4],
[ 28,   6,  13,   1,   32,  -4,  16]])
is_sim, trans = A.is_similar(B, transformation=True)
is_sim


Since we knew in advance these two matrices are similar, we requested the transformation matrix, so the output is a pair. The similarity matrix is a bit of a mess, so we will use three Sage routines to clean up trans. We convert the entries to numerical approximations, clip very small values (less than $$10^{-5}$$) to zero and then round to three decimal places. You can experiment printing just transall by itself.

trans.change_ring(RDF).zero_at(10^-5).round(3)


The matrix Cis not similar to A(and hence not similar to Bby Theorem SER), so we illustrate the return value when we do not request the similarity matrix (since it does not even exist).

C = matrix(QQ, [[ 16, -26,  19,  -56,  26,   8, -49],
[ 20, -43,  36, -102,  52,  23, -65],
[-18,  29, -21,   62, -30,  -9,  56],
[-17,  31, -27,   73, -37, -16,  49],
[ 18, -36,  30,  -82,  43,  18, -54],
[-32,  62, -56,  146, -77, -35,  88],
[ 11, -19,  17,  -44,  23,  10, -29]])
C.is_similar(A)


### SubsectionDDiagonalization

Good things happen when a matrix is similar to a diagonal matrix. For example, the eigenvalues of the matrix are the entries on the diagonal of the diagonal matrix. And it can be a much simpler matter to compute high powers of the matrix. Diagonalizable matrices are also of interest in more abstract settings. Here are the relevant definitions, then our main theorem for this section.

#### DefinitionDIM.Diagonal Matrix.

Suppose that $$A$$ is a square matrix. Then $$A$$ is a diagonal matrix if $$\matrixentry{A}{ij}=0$$ whenever $$i\neq j\text{.}$$

#### DefinitionDZM.Diagonalizable Matrix.

Suppose $$A$$ is a square matrix. Then $$A$$ is diagonalizable if $$A$$ is similar to a diagonal matrix.

Archetype B has a $$3\times 3$$ coefficient matrix

\begin{equation*} B=\begin{bmatrix} -7&-6&-12\\ 5&5&7\\ 1&0&4 \end{bmatrix} \end{equation*}

and is similar to a diagonal matrix, as can be seen by the following computation with the nonsingular matrix $$S\text{,}$$

\begin{align*} \similar{B}{S}&= \inverse{\begin{bmatrix}-5&-3&-2\\3&2&1\\1&1&1\end{bmatrix}}\begin{bmatrix} -7&-6&-12\\ 5&5&7\\ 1&0&4 \end{bmatrix} \begin{bmatrix}-5&-3&-2\\3&2&1\\1&1&1\end{bmatrix}\\ &=\begin{bmatrix}-1&-1&-1\\2&3&1\\-1&-2&1\end{bmatrix} \begin{bmatrix} -7&-6&-12\\ 5&5&7\\ 1&0&4 \end{bmatrix} \begin{bmatrix}-5&-3&-2\\3&2&1\\1&1&1\end{bmatrix}\\ &= \begin{bmatrix}-1&0&0\\0&1&0\\0&0&2\end{bmatrix}\text{.} \end{align*}

Example SMS3 provides yet another example of a matrix that is subjected to a similarity transformation and the result is a diagonal matrix. Alright, just how would we find the magic matrix $$S$$ that can be used in a similarity transformation to produce a diagonal matrix? Before you read the statement of the next theorem, you might study the eigenvalues and eigenvectors of Archetype B and compute the eigenvalues and eigenvectors of the matrix in Example SMS3.

##### (⇐)

Let $$S=\set{\vectorlist{x}{n}}$$ be a linearly independent set of eigenvectors of $$A$$ for the eigenvalues $$\scalarlist{\lambda}{n}\text{.}$$ Recall Definition SUV and define

\begin{align*} R&=\matrixcolumns{x}{n}\\ D&= \begin{bmatrix} \lambda_1 & 0 & 0 &\cdots & 0\\ 0 &\lambda_2 & 0 &\cdots & 0\\ 0 & 0 &\lambda_3 &\cdots & 0\\ \vdots & \vdots & \vdots & & \vdots\\ 0 & 0 & 0 &\cdots & \lambda_n \end{bmatrix} =[\lambda_1\vect{e}_1|\lambda_2\vect{e}_2|\lambda_3\vect{e}_3|\ldots|\lambda_n\vect{e}_n]\text{.} \end{align*}

The columns of $$R$$ are the vectors of the linearly independent set $$S$$ and so by Theorem NMLIC the matrix $$R$$ is nonsingular. By Theorem NI we know $$\inverse{R}$$ exists. We have

\begin{align*} \inverse{R}AR&= \inverse{R}A\matrixcolumns{x}{n}\\ &=\inverse{R}[A\vect{x}_1|A\vect{x}_2|A\vect{x}_3|\ldots|A\vect{x}_n]&& \knowl{./knowl/definition-MM.html}{\text{Definition MM}}\\ &=\inverse{R}[\lambda_1\vect{x}_1|\lambda_2\vect{x}_2|\lambda_3\vect{x}_3|\ldots|\lambda_n\vect{x}_n]&& \knowl{./knowl/definition-EEM.html}{\text{Definition EEM}}\\ &=\inverse{R}[\lambda_1R\vect{e}_1|\lambda_2R\vect{e}_2|\lambda_3R\vect{e}_3|\ldots|\lambda_nR\vect{e}_n]&& \knowl{./knowl/definition-MVP.html}{\text{Definition MVP}}\\ &=\inverse{R}[R(\lambda_1\vect{e}_1)|R(\lambda_2\vect{e}_2)|R(\lambda_3\vect{e}_3)|\ldots|R(\lambda_n\vect{e}_n)]&& \knowl{./knowl/theorem-MMSMM.html}{\text{Theorem MMSMM}}\\ &=\inverse{R}R[\lambda_1\vect{e}_1|\lambda_2\vect{e}_2|\lambda_3\vect{e}_3|\ldots|\lambda_n\vect{e}_n]&& \knowl{./knowl/definition-MM.html}{\text{Definition MM}}\\ &=I_nD&& \knowl{./knowl/definition-MI.html}{\text{Definition MI}}\\ &=D&& \knowl{./knowl/theorem-MMIM.html}{\text{Theorem MMIM}}\text{.} \end{align*}

This says that $$A$$ is similar to the diagonal matrix $$D$$ via the nonsingular matrix $$R\text{.}$$ Thus $$A$$ is diagonalizable (Definition DZM).

##### (⇒)

Suppose that $$A$$ is diagonalizable, so there is a nonsingular matrix of size $$n$$

\begin{align*} T&=\matrixcolumns{y}{n}\\ \end{align*}

and a diagonal matrix (recall Definition SUV)

\begin{align*} E&=\begin{bmatrix} d_1 & 0 & 0 &\cdots & 0\\ 0 &d_2 & 0 &\cdots & 0\\ 0 & 0 &d_3 &\cdots & 0\\ \vdots & \vdots & \vdots & & \vdots\\ 0 & 0 & 0 &\cdots & d_n \end{bmatrix} =[d_1\vect{e}_1|d_2\vect{e}_2|d_3\vect{e}_3|\ldots|d_n\vect{e}_n]&&\text{} \end{align*}

such that $$\inverse{T}AT=E\text{.}$$

Then consider,

\begin{align*} [A\vect{y}_1|A\vect{y}_2|A\vect{y}_3&|\ldots|A\vect{y}_n]\\ &=A\matrixcolumns{y}{n}&& \knowl{./knowl/definition-MM.html}{\text{Definition MM}}\\ &=AT\\ &=I_nAT&& \knowl{./knowl/theorem-MMIM.html}{\text{Theorem MMIM}}\\ &=T\inverse{T}AT&& \knowl{./knowl/definition-MI.html}{\text{Definition MI}}\\ &=TE\\ &=T[d_1\vect{e}_1|d_2\vect{e}_2|d_3\vect{e}_3|\ldots|d_n\vect{e}_n]\\ &=[T(d_1\vect{e}_1)|T(d_2\vect{e}_2)|T(d_3\vect{e}_3)|\ldots|T(d_n\vect{e}_n)]&& \knowl{./knowl/definition-MM.html}{\text{Definition MM}}\\ &=[d_1T\vect{e}_1|d_2T\vect{e}_2|d_3T\vect{e}_3|\ldots|d_nT\vect{e}_n]&& \knowl{./knowl/definition-MM.html}{\text{Definition MM}}\\ &=[d_1\vect{y}_1|d_2\vect{y}_2|d_3\vect{y}_3|\ldots|d_n\vect{y}_n]&& \knowl{./knowl/definition-MVP.html}{\text{Definition MVP}}\text{.} \end{align*}

This equality of matrices (Definition ME) allows us to conclude that the individual columns are equal vectors (Definition CVE). That is, $$A\vect{y}_i=d_i\vect{y}_i$$ for $$1\leq i\leq n\text{.}$$ In other words, $$\vect{y}_i$$ is an eigenvector of $$A$$ for the eigenvalue $$d_i\text{,}$$ $$1\leq i\leq n\text{.}$$ (Why does $$\vect{y}_i\neq\zerovector\text{?}$$). Because $$T$$ is nonsingular, the set containing $$T$$'s columns, $$S=\set{\vectorlist{y}{n}}\text{,}$$ is a linearly independent set (Theorem NMLIC). So the set $$S$$ has all the required properties.

Notice that the proof of Theorem DC is constructive. To diagonalize a matrix, we need only locate $$n$$ linearly independent eigenvectors. Then we can construct a nonsingular matrix using the eigenvectors as columns ($$R$$) so that $$\inverse{R}AR$$ is a diagonal matrix ($$D$$). The entries on the diagonal of $$D$$ will be the eigenvalues of the eigenvectors used to create $$R\text{,}$$ in the same order as the eigenvectors appear in $$R\text{.}$$ We illustrate this by diagonalizing some matrices.

Consider the matrix

\begin{equation*} F= \begin{bmatrix} -13 & -8 & -4\\ 12 & 7 & 4\\ 24 & 16 & 7 \end{bmatrix} \end{equation*}

of Example CPMS3, Example EMS3 and Example ESMS3. $$F$$'s eigenvalues and eigenspaces are

\begin{align*} \lambda&=3&\eigenspace{F}{3}&=\spn{\set{\colvector{-\frac{1}{2}\\\frac{1}{2}\\1}}}\\ \lambda&=-1&\eigenspace{F}{-1}&=\spn{\set{\colvector{-\frac{2}{3}\\1\\0},\,\colvector{-\frac{1}{3}\\0\\1}}}\text{.} \end{align*}

Define the matrix $$S$$ to be the $$3\times 3$$ matrix whose columns are the three basis vectors in the eigenspaces for $$F\text{,}$$

\begin{equation*} S= \begin{bmatrix} -\frac{1}{2} & -\frac{2}{3} & -\frac{1}{3}\\ \frac{1}{2} & 1 & 0\\ 1 & 0 & 1 \end{bmatrix}\text{.} \end{equation*}

Check that $$S$$ is nonsingular (row-reduces to the identity matrix, Theorem NMRRI or has a nonzero determinant, Theorem SMZD). Then the three columns of $$S$$ are a linearly independent set (Theorem NMLIC). By Theorem DC we now know that $$F$$ is diagonalizable. Furthermore, the construction in the proof of Theorem DC tells us that if we apply the matrix $$S$$ to $$F$$ in a similarity transformation, the result will be a diagonal matrix with the eigenvalues of $$F$$ on the diagonal. The eigenvalues appear on the diagonal of the matrix in the same order as the eigenvectors appear in $$S\text{.}$$ So,

\begin{align*} \similar{F}{S}&= \inverse{ \begin{bmatrix} -\frac{1}{2} & -\frac{2}{3} & -\frac{1}{3}\\ \frac{1}{2} & 1 & 0\\ 1 & 0 & 1 \end{bmatrix} } \begin{bmatrix} -13 & -8 & -4\\ 12 & 7 & 4\\ 24 & 16 & 7 \end{bmatrix} \begin{bmatrix} -\frac{1}{2} & -\frac{2}{3} & -\frac{1}{3}\\ \frac{1}{2} & 1 & 0\\ 1 & 0 & 1 \end{bmatrix}\\ &= \begin{bmatrix} 6 & 4 & 2\\ -3 & -1 & -1\\ -6 & -4 & -1 \end{bmatrix} \begin{bmatrix} -13 & -8 & -4\\ 12 & 7 & 4\\ 24 & 16 & 7 \end{bmatrix} \begin{bmatrix} -\frac{1}{2} & -\frac{2}{3} & -\frac{1}{3}\\ \frac{1}{2} & 1 & 0\\ 1 & 0 & 1 \end{bmatrix}\\ &= \begin{bmatrix} 3 & 0 & 0\\ 0 & -1 & 0\\ 0 & 0 & -1 \end{bmatrix}\text{.} \end{align*}

Note that the above computations can be viewed two ways. The proof of Theorem DC tells us that the four matrices ($$F\text{,}$$ $$S\text{,}$$ $$\inverse{F}$$ and the diagonal matrix) will interact the way we have written the equation. Or as an example, we can actually perform the computations to verify what the theorem predicts.

The dimension of an eigenspace can be no larger than the algebraic multiplicity of the eigenvalue by Theorem ME. When every eigenvalue's eigenspace is this large, then we can diagonalize the matrix, and only then. Three examples we have seen so far in this section, Example SMS5, Example DAB and Example DMS3, illustrate the diagonalization of a matrix, with varying degrees of detail about just how the diagonalization is achieved. However, in each case, you can verify that the geometric and algebraic multiplicities are equal for every eigenvalue. This is the substance of the next theorem.

Suppose $$A$$ has size $$n$$ and $$k$$ distinct eigenvalues, $$\scalarlist{\lambda}{k}\text{.}$$ Let $$S_i=\set{\vect{x}_{i1},\,\vect{x}_{i2},\,\vect{x}_{i3},\,\ldots,\,\vect{x}_{i\geomult{A}{\lambda_i}}}\text{,}$$ denote a basis for the eigenspace of $$\lambda_i\text{,}$$ $$\eigenspace{A}{\lambda_i}\text{,}$$ for $$1\leq i\leq k\text{.}$$ Then

\begin{equation*} S=S_1\cup S_2\cup S_3\cup\cdots\cup S_k \end{equation*}

is a set of eigenvectors for $$A\text{.}$$ A vector cannot be an eigenvector for two different eigenvalues (see Exercise EE.T20) so $$S_i\cap S_j=\emptyset$$ whenever $$i\neq j\text{.}$$ In other words, $$S$$ is a disjoint union of $$S_i\text{,}$$ $$1\leq i\leq k\text{.}$$

##### (⇐)

The size of $$S$$ is

\begin{align*} \card{S} &=\sum_{i=1}^k\geomult{A}{\lambda_i}&& S\text{ disjoint union of }S_i\\ &=\sum_{i=1}^k\algmult{A}{\lambda_i}&& \text{Hypothesis}\\ &=n&& \knowl{./knowl/theorem-NEM.html}{\text{Theorem NEM}}\text{.} \end{align*}

We next show that $$S$$ is a linearly independent set. So we will begin with a relation of linear dependence on $$S\text{,}$$ using doubly-subscripted scalars and eigenvectors,

Define the vectors $$\vect{y}_i\text{,}$$ $$1\leq i\leq k$$ by

Then the relation of linear dependence becomes

\begin{align*} \zerovector&=\vect{y}_1+\vect{y}_2+\vect{y}_3+\cdots+\vect{y}_k\text{.} \end{align*}

Since the eigenspace $$\eigenspace{A}{\lambda_i}$$ is closed under vector addition and scalar multiplication, $$\vect{y}_i\in\eigenspace{A}{\lambda_i}\text{,}$$ $$1\leq i\leq k\text{.}$$ Thus, for each $$i\text{,}$$ the vector $$\vect{y}_i$$ is an eigenvector of $$A$$ for $$\lambda_i\text{,}$$ or is the zero vector. Recall that sets of eigenvectors whose eigenvalues are distinct form a linearly independent set by Theorem EDELI. Should any (or some) $$\vect{y}_i$$ be nonzero, the previous equation would provide a nontrivial relation of linear dependence on a set of eigenvectors with distinct eigenvalues, contradicting Theorem EDELI. Thus $$\vect{y}_i=\zerovector\text{,}$$ $$1\leq i\leq k\text{.}$$

Each of the $$k$$ equations, $$\vect{y}_i=\zerovector\text{,}$$ is a relation of linear dependence on the corresponding set $$S_i\text{,}$$ a set of basis vectors for the eigenspace $$\eigenspace{A}{\lambda_i}\text{,}$$ which is therefore linearly independent. From these relations of linear dependence on linearly independent sets we conclude that the scalars are all zero, more precisely, $$a_{ij}=0\text{,}$$ $$1\leq j\leq\geomult{A}{\lambda_i}$$ for $$1\leq i\leq k\text{.}$$ This establishes that our original relation of linear dependence on $$S$$ has only the trivial relation of linear dependence, and hence $$S$$ is a linearly independent set.

We have determined that $$S$$ is a set of $$n$$ linearly independent eigenvectors for $$A\text{,}$$ and so by Theorem DC is diagonalizable.

##### (⇒)

Now we assume that $$A$$ is diagonalizable. Aiming for a contradiction (Proof Technique CD), suppose that there is at least one eigenvalue, say $$\lambda_t\text{,}$$ such that $$\geomult{A}{\lambda_t}\neq\algmult{A}{\lambda_t}\text{.}$$ By Theorem ME we must have $$\geomult{A}{\lambda_t}\lt\algmult{A}{\lambda_t}\text{,}$$ and $$\geomult{A}{\lambda_i}\leq\algmult{A}{\lambda_i}$$ for $$1\leq i\leq k\text{,}$$ $$i\neq t\text{.}$$

Since $$A$$ is diagonalizable, Theorem DC guarantees a set of $$n$$ linearly independent vectors, all of which are eigenvectors of $$A\text{.}$$ Let $$n_i$$ denote the number of eigenvectors in $$S$$ that are eigenvectors for $$\lambda_i\text{,}$$ and recall that a vector cannot be an eigenvector for two different eigenvalues (Exercise EE.T20). $$S$$ is a linearly independent set, so the subset $$S_i$$ containing the $$n_i$$ eigenvectors for $$\lambda_i$$ must also be linearly independent. Because the eigenspace $$\eigenspace{A}{\lambda_i}$$ has dimension $$\geomult{A}{\lambda_i}$$ and $$S_i$$ is a linearly independent subset in $$\eigenspace{A}{\lambda_i}\text{,}$$ Theorem G tells us that $$n_i\leq\geomult{A}{\lambda_i}\text{,}$$ for $$1\leq i\leq k\text{.}$$

Putting all these facts together gives,

\begin{align*} n &=n_1+n_2+n_3+\cdots+n_t+\cdots+n_k&& \knowl{./knowl/definition-SU.html}{\text{Definition SU}}\\ &\leq\geomult{A}{\lambda_1}+\geomult{A}{\lambda_2}+\geomult{A}{\lambda_3}+\cdots+\geomult{A}{\lambda_t}+\cdots+\geomult{A}{\lambda_k}&& \knowl{./knowl/theorem-G.html}{\text{Theorem G}}\\ &\lt \algmult{A}{\lambda_1}+\algmult{A}{\lambda_2}+\algmult{A}{\lambda_3}+\cdots+\algmult{A}{\lambda_t}+\cdots+\algmult{A}{\lambda_k}&& \knowl{./knowl/theorem-ME.html}{\text{Theorem ME}}\\ &=n&& \knowl{./knowl/theorem-NEM.html}{\text{Theorem NEM}}\text{.} \end{align*}

This is a contradiction (we cannot have $$n\lt n\text{!}$$) and so our assumption that some eigenspace had less than full dimension was false.

Example SEE, Example CAEHW, Example ESMS3, Example ESMS4, Example DEMS5, Archetype B, Archetype F, Archetype K and Archetype L are all examples of matrices that are diagonalizable and that illustrate Theorem DMFE. While we have provided many examples of matrices that are diagonalizable, especially among the archetypes, there are many matrices that are not diagonalizable. Here is one now.

In Example EMMS4 the matrix

\begin{equation*} B= \begin{bmatrix} -2 & 1 & -2 & -4\\ 12 & 1 & 4 & 9\\ 6 & 5 & -2 & -4\\ 3 & -4 & 5 & 10 \end{bmatrix} \end{equation*}

was determined to have characteristic polynomial

\begin{equation*} \charpoly{B}{x}=(x-1)(x-2)^3 \end{equation*}

and an eigenspace for $$\lambda=2$$ of

\begin{equation*} \eigenspace{B}{2}=\spn{\set{\colvector{-\frac{1}{2}\\1\\-\frac{1}{2}\\1}}}\text{.} \end{equation*}

So the geometric multiplicity of $$\lambda=2$$ is $$\geomult{B}{2}=1\text{,}$$ while the algebraic multiplicity is $$\algmult{B}{2}=3\text{.}$$ By Theorem DMFE, the matrix $$B$$ is not diagonalizable.

Archetype A is the lone archetype with a square matrix that is not diagonalizable, as the algebraic and geometric multiplicities of the eigenvalue $$\lambda=0$$ differ. Example HMEM5 is another example of a matrix that cannot be diagonalized due to the difference between the geometric and algebraic multiplicities of $$\lambda=2\text{,}$$ as is Example CEMS6 which has two complex eigenvalues, each with differing multiplicities. Likewise, Example EMMS4 has an eigenvalue with different algebraic and geometric multiplicities and so cannot be diagonalized.

#### SageMD.Matrix Diagonalization.

The third way to get eigenvectors is the matrix method .eigenmatrix_right()(and the analogous .eigenmatrix_left()). It always returns two square matrices of the same size as the original matrix. The first matrix of the output is a diagonal matrix with the eigenvalues of the matrix filling the diagonal entries of the matrix. The second matrix has eigenvectors in the columns, in the same order as the corresponding eigenvalues. For a single eigenvalue, these columns/eigenvectors form a linearly independent set.

A careful reading of the previous paragraph suggests the question: what if we do not have enough eigenvectors to fill the columns of the second square matrix? When the geometric multiplicity does not equal the algebraic multiplicity, the deficit is met by inserting zero columns in the matrix of eigenvectors. Conversely, when the matrix is diagonalizable, by Theorem DMFE the geometric and algebraic multiplicities of each eigenvalue are equal, and the union of the bases of the eigenspaces provides a complete set of linearly independent vectors. So for a matrix $$A\text{,}$$ Sage will output two matrices, $$D$$ and $$S$$ such that $$\inverse{S}AS=D\text{.}$$

We can rewrite the relation above as $$AS=SD\text{.}$$ In the case of a non-diagonalizable matrix, the matrix of eigenvectors is singular (it has zero columns), but the relationship $$AS=SD$$ still holds. Here are examples of the two scenarios, along with demonstrations of the matrix method is_diagonalizable().

A = matrix(QQ, [[ 2, -18, -68,  64, -99, -87,  83],
[ 4, -10, -41,  34, -58, -57,  46],
[ 4,  16,  59, -60,  86,  70, -72],
[ 2, -15, -65,  57, -92, -81,  78],
[-4,  -7, -32,  31, -45, -31,  41],
[ 2,  -6, -22,  20, -32, -31,  26],
[ 0,   7,  30, -27,  42,  37, -36]])
D, S = A.eigenmatrix_right()
D

S

S.inverse()*A*S == D

A.is_diagonalizable()


Now for a matrix that is far from diagonalizable.

B = matrix(QQ, [[ 37, -13,  30,  81, -74, -13,  18],
[  6,  26,  21, -11, -46, -48,  19],
[ 16,  10,  29,  16, -42, -39,  26],
[-24,   8, -24, -53,  54,  13, -15],
[ -8,   3,  -8, -20,  24,   4,  -5],
[ 31,  12,  46,  48, -97, -56,  35],
[  8,   5,  16,  12, -34, -20,  11]])
D, S = B.eigenmatrix_right()
D

S

B*S == S*D

B.is_diagonalizable()


Let $$\scalarlist{\lambda}{n}$$ denote the $$n$$ distinct eigenvalues of $$A\text{.}$$ Then by Theorem NEM we have $$n=\sum_{i=1}^n\algmult{A}{\lambda_i}\text{,}$$ which implies that $$\algmult{A}{\lambda_i}=1\text{,}$$ $$1\leq i\leq n\text{.}$$ From Theorem ME it follows that $$\geomult{A}{\lambda_i}=1\text{,}$$ $$1\leq i\leq n\text{.}$$ So $$\geomult{A}{\lambda_i}=\algmult{A}{\lambda_i}\text{,}$$ $$1\leq i\leq n$$ and Theorem DMFE says $$A$$ is diagonalizable.

In Example DEMS5 the matrix

\begin{equation*} H= \begin{bmatrix} 15 & 18 & -8 & 6 & -5\\ 5 & 3 & 1 & -1 & -3\\ 0 & -4 & 5 & -4 & -2\\ -43 & -46 & 17 & -14 & 15\\ 26 & 30 & -12 & 8 & -10 \end{bmatrix} \end{equation*}

has characteristic polynomial

\begin{equation*} \charpoly{H}{x}=x(x-2)(x-1)(x+1)(x+3) \end{equation*}

and so is a $$5\times 5$$ matrix with 5 distinct eigenvalues.

By Theorem DED we know $$H$$ must be diagonalizable. But just for practice, we exhibit a diagonalization. The matrix $$S$$ contains eigenvectors of $$H$$ as columns, one from each eigenspace, guaranteeing linear independent columns and thus the nonsingularity of $$S\text{.}$$ Notice that we are using the versions of the eigenvectors from Example DEMS5 that have integer entries. The diagonal matrix has the eigenvalues of $$H$$ in the same order that their respective eigenvectors appear as the columns of $$S\text{.}$$ With these matrices, verify computationally that $$\similar{H}{S}=D\text{.}$$

\begin{align*} S&= \begin{bmatrix} 2 & 1 & -1 & 1 & 1\\ -1 & 0 & 2 & 0 & -1\\ -2 & 0 & 2 & -1 & -2\\ -4 & -1 & 0 & -2 & -1\\ 2 & 2 & 1 & 2 & 1 \end{bmatrix} &D&= \begin{bmatrix} -3 & 0 & 0 & 0 & 0\\ 0 & -1 & 0 & 0 & 0\\ 0 & 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 1 & 0\\ 0 & 0 & 0 & 0 & 2 \end{bmatrix}\text{.} \end{align*}

Note that there are many different ways to diagonalize $$H\text{.}$$ We could replace eigenvectors by nonzero scalar multiples, or we could rearrange the order of the eigenvectors as the columns of $$S$$ (which would subsequently reorder the eigenvalues along the diagonal of $$D$$).

Archetype B is another example of a matrix that has as many distinct eigenvalues as its size, and is hence diagonalizable by Theorem DED.

Powers of a diagonal matrix are easy to compute, and when a matrix is diagonalizable, it is almost as easy. We could state a theorem here perhaps, but we will settle instead for an example that makes the point just as well.

Suppose that

\begin{equation*} A=\begin{bmatrix} 19 & 0 & 6 & 13 \\ -33 & -1 & -9 & -21 \\ 21 & -4 & 12 & 21 \\ -36 & 2 & -14 & -28 \end{bmatrix} \end{equation*}

and we wish to compute $$A^{20}\text{.}$$ Normally this would require 19 matrix multiplications, but since $$A$$ is diagonalizable, we can simplify the computations substantially.

First, we diagonalize $$A\text{.}$$ With

\begin{equation*} S=\begin{bmatrix} 1 & -1 & 2 & -1 \\ -2 & 3 & -3 & 3 \\ 1 & 1 & 3 & 3 \\ -2 & 1 & -4 & 0 \end{bmatrix} \end{equation*}

we find

\begin{align*} D&=\similar{A}{S}\\ &= \begin{bmatrix} -6 & 1 & -3 & -6 \\ 0 & 2 & -2 & -3 \\ 3 & 0 & 1 & 2 \\ -1 & -1 & 1 & 1 \end{bmatrix} \begin{bmatrix} 19 & 0 & 6 & 13 \\ -33 & -1 & -9 & -21 \\ 21 & -4 & 12 & 21 \\ -36 & 2 & -14 & -28 \end{bmatrix} \begin{bmatrix} 1 & -1 & 2 & -1 \\ -2 & 3 & -3 & 3 \\ 1 & 1 & 3 & 3 \\ -2 & 1 & -4 & 0 \end{bmatrix}\\ &= \begin{bmatrix} -1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 2 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}\text{.} \end{align*}

Now we find an alternate expression for $$A^{20}\text{,}$$

\begin{align*} A^{20} &=AAA\ldots A\\ &=I_nAI_nAI_nAI_n\ldots I_nAI_n\\ &=\left(S\inverse{S}\right)A\left(S\inverse{S}\right)A\left(S\inverse{S}\right)A\left(S\inverse{S}\right)\ldots \left(S\inverse{S}\right)A\left(S\inverse{S}\right)\\ &=S\left(\inverse{S}AS\right)\left(\inverse{S}AS\right)\left(\inverse{S}AS\right)\ldots \left(\inverse{S}AS\right)\inverse{S}\\ &=SDDD\ldots D\inverse{S}\\ &=SD^{20}\inverse{S}\\ \end{align*}

and since $$D$$ is a diagonal matrix, powers are much easier to compute,

\begin{align*} &= S \begin{bmatrix} -1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 2 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}^{20} \inverse{S}\\ &= S \begin{bmatrix} (-1)^{20} & 0 & 0 & 0 \\ 0 & (0)^{20} & 0 & 0 \\ 0 & 0 & (2)^{20} & 0 \\ 0 & 0 & 0 & (1)^{20} \end{bmatrix} \inverse{S}\\ &= \begin{bmatrix} 1 & -1 & 2 & -1 \\ -2 & 3 & -3 & 3 \\ 1 & 1 & 3 & 3 \\ -2 & 1 & -4 & 0 \end{bmatrix} \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 1048576 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} -6 & 1 & -3 & -6 \\ 0 & 2 & -2 & -3 \\ 3 & 0 & 1 & 2 \\ -1 & -1 & 1 & 1 \end{bmatrix}\\ &= \begin{bmatrix} 6291451 & 2 & 2097148 & 4194297 \\ -9437175 & -5 & -3145719 & -6291441 \\ 9437175 & -2 & 3145728 & 6291453 \\ -12582900 & -2 & -4194298 & -8388596 \end{bmatrix}\text{.} \end{align*}

Notice how we effectively replaced the twentieth power of $$A$$ by the twentieth power of $$D\text{,}$$ and how a high power of a diagonal matrix is just a collection of powers of scalars on the diagonal. The price we pay for this simplification is the need to diagonalize the matrix (by computing eigenvalues and eigenvectors) and finding the inverse of the matrix of eigenvectors. And we still need to do two matrix products. But the higher the power, the greater the savings.

### SubsectionFSFibonacci Sequences

The Fibonacci sequence is a sequence of integers defined recursively by

\begin{align*} a_0&=0 & a_1&=1 & a_{n+1}&=a_n+a_{n-1},\quad n\geq 1\text{.} \end{align*}

So the initial portion of the sequence is $$0,\,1,\,1,\,2,\,3,\,5,\,8,\,13,\,21,\,\ldots\text{.}$$ In this subsection we will illustrate an application of eigenvalues and diagonalization through the determination of a closed-form expression for an arbitrary term of this sequence.

To begin, verify that for any $$n\geq 1$$ the recursive statement above establishes the truth of the statement

\begin{align*} \colvector{a_n\\a_{n+1}} &= \begin{bmatrix}0&1\\1&1\end{bmatrix} \colvector{a_{n-1}\\a_n}\text{.} \end{align*}

Let $$A$$ denote this $$2\times 2$$ matrix. Through repeated applications of the statement above we have

\begin{align*} \colvector{a_n\\a_{n+1}} & =A\colvector{a_{n-1}\\a_n} =A^2\colvector{a_{n-2}\\a_{n-1}} =A^3\colvector{a_{n-3}\\a_{n-2}} =\cdots =A^n\colvector{a_{0}\\a_{1}}\text{.} \end{align*}

In preparation for working with this high power of $$A\text{,}$$ not unlike in Example HPDM, we will diagonalize $$A\text{.}$$ The characteristic polynomial of $$A$$ is $$\charpoly{A}{x}=x^2-x-1\text{,}$$ with roots (the eigenvalues of $$A$$ by Theorem EMRCP)

\begin{align*} \rho&=\frac{1+\sqrt{5}}{2} & \delta&=\frac{1-\sqrt{5}}{2}\text{.} \end{align*}

With two distinct eigenvalues, Theorem DED implies that $$A$$ is diagonalizable. It will be easier to compute with these eigenvalues once you confirm the following properties (all but the last can be derived from the fact that $$\rho$$ and $$\delta$$ are roots of the characteristic polynomial, in a factored or unfactored form)

\begin{align*} \rho+\delta&=1 & \rho\delta&=-1 & 1+\rho&=\rho^2 & 1+\delta&=\delta^2 & \rho-\delta&=\sqrt{5}\text{.} \end{align*}

Then eigenvectors of $$A$$ (for $$\rho$$ and $$\delta\text{,}$$ respectively) are

\begin{align*} &\colvector{1\\\rho} & &\colvector{1\\\delta} \end{align*}

which can be easily confirmed, as we demonstrate for the eigenvector for $$\rho\text{,}$$

\begin{align*} \begin{bmatrix}0&1\\1&1\end{bmatrix}\colvector{1\\\rho} & =\colvector{\rho\\1+\rho} =\colvector{\rho\\\rho^2} =\rho\colvector{1\\\rho}\text{.} \end{align*}

From the proof of Theorem DC we know $$A$$ can be diagonalized by a matrix $$S$$ with these eigenvectors as columns, giving $$D=\inverse{S}AS\text{.}$$ We list $$S\text{,}$$ $$\inverse{S}$$ and the diagonal matrix $$D\text{,}$$

\begin{align*} S&=\begin{bmatrix}1&1\\\rho&\delta\end{bmatrix} & \inverse{S}&=\frac{1}{\rho-\delta}\begin{bmatrix}-\delta&1\\\rho&-1\end{bmatrix} & D&=\begin{bmatrix}\rho&0\\0&\delta\end{bmatrix}\text{.} \end{align*}

OK, we have everything in place now. The main step in the following is to replace $$A$$ by $$SD\inverse{S}\text{.}$$ Here we go,

\begin{align*} \colvector{a_n\\a_{n+1}} &=A^n\colvector{a_{0}\\a_{1}}\\ &=\left(SD\inverse{S}\right)^n\colvector{a_{0}\\a_{1}}\\ &=SD\inverse{S}SD\inverse{S}SD\inverse{S}\cdots SD\inverse{S}\colvector{a_{0}\\a_{1}}\\ &=SDDD\cdots D\inverse{S}\colvector{a_{0}\\a_{1}}\\ &=SD^n\inverse{S}\colvector{a_{0}\\a_{1}}\\ &= \begin{bmatrix}1&1\\\rho&\delta\end{bmatrix} \begin{bmatrix}\rho&0\\0&\delta\end{bmatrix}^n \frac{1}{\rho-\delta}\begin{bmatrix}-\delta&1\\\rho&-1\end{bmatrix} \colvector{a_{0}\\a_{1}}\\ &= \frac{1}{\rho-\delta} \begin{bmatrix}1&1\\\rho&\delta\end{bmatrix} \begin{bmatrix}\rho^n&0\\0&\delta^n\end{bmatrix} \begin{bmatrix}-\delta&1\\\rho&-1\end{bmatrix} \colvector{0\\1}\\ &= \frac{1}{\rho-\delta} \begin{bmatrix}1&1\\\rho&\delta\end{bmatrix} \begin{bmatrix}\rho^n&0\\0&\delta^n\end{bmatrix} \colvector{1\\-1}\\ &= \frac{1}{\rho-\delta} \begin{bmatrix}1&1\\\rho&\delta\end{bmatrix} \colvector{\rho^n\\-\delta^n}\\ &= \frac{1}{\rho-\delta} \colvector{\rho^n-\delta^n\\\rho^{n+1}-\delta^{n+1}}\text{.} \end{align*}

Performing the scalar multiplication and equating the first entries of the two vectors, we arrive at the closed form expression

\begin{align*} a_n&=\frac{1}{\rho-\delta}\left(\rho^n-\delta^n\right)\\ &=\frac{1}{\sqrt{5}} \left(\left(\frac{1+\sqrt{5}}{2}\right)^n-\left(\frac{1-\sqrt{5}}{2}\right)^n\right)\\ &=\frac{1}{2^n\sqrt{5}} \left(\left(1+\sqrt{5}\right)^n-\left(1-\sqrt{5}\right)^n\right)\text{.} \end{align*}

Notice that it does not matter whether we use the equality of the first or second entries of the vectors, we will arrive at the same formula, once in terms of $$n$$ and again in terms of $$n+1\text{.}$$ Also, our definition clearly describes a sequence that will only contain integers, yet the presence of the irrational number $$\sqrt{5}$$ might make us suspicious. But no, our expression for $$a^n$$ will always yield an integer!

The Fibonacci sequence, and generalizations of it, have been extensively studied (Fibonacci lived in the 12th and 13th centuries). There are many ways to derive the closed-form expression we just found, and our approach may not be the most efficient route. But it is a nice demonstration of how diagonalization can be used to solve a problem outside the field of linear algebra.

We close this section with a comment about an important upcoming theorem that we prove in Chapter R. A consequence of Theorem OD is that every Hermitian matrix (Definition HM) is diagonalizable (Definition DZM), and the similarity transformation that accomplishes the diagonalization uses a unitary matrix (Definition UM). This means that for every Hermitian matrix of size $$n$$ there is a basis of $$\complex{n}$$ that is composed entirely of eigenvectors for the matrix and also forms an orthonormal set (Definition ONS). Notice that for matrices with only real entries, we only need the hypothesis that the matrix is symmetric (Definition SYM) to reach this conclusion (Example ESMS4). Can you imagine a prettier basis for use with a matrix? I cannot.

These results in Section OD explain much of our recurring interest in orthogonality, and make the section a high point in your study of linear algebra. A precise statement of this diagonalization result applies to a slightly broader class of matrices, known as “normal” matrices (Definition NRML), which are matrices that commute with their adjoints. With this expanded category of matrices, the result becomes an equivalence (Proof Technique E). See Theorem OD and Theorem OBNM in Section OD for all the details.

#### 1.

What is an equivalence relation?

#### 2.

State a condition that is equivalent to a matrix being diagonalizable, but is not the definition.

#### 3.

Find a diagonal matrix similar to

\begin{equation*} A=\begin{bmatrix} -5 & 8\\-4 & 7 \end{bmatrix}\text{.} \end{equation*}

### ExercisesSDExercises

#### C20.

Consider the matrix $$A$$ below. First, show that $$A$$ is diagonalizable by computing the geometric multiplicities of the eigenvalues and quoting the relevant theorem. Second, find a diagonal matrix $$D$$ and a nonsingular matrix $$S$$ so that $$\similar{A}{S}=D\text{.}$$ (See Exercise EE.C20 for some of the necessary computations.)

\begin{equation*} A= \begin{bmatrix} 18 & -15 & 33 & -15\\ -4 & 8 & -6 & 6\\ -9 & 9 & -16 & 9\\ 5 & -6 & 9 & -4 \end{bmatrix} \end{equation*}
Solution.

Using a calculator, we find that $$A$$ has three distinct eigenvalues, $$\lambda=3,\,2,\,-1\text{,}$$ with $$\lambda=2$$ having algebraic multiplicity two, $$\algmult{A}{2}=2\text{.}$$ The eigenvalues $$\lambda=3,\,-1$$ have algebraic multiplicity one, and so by Theorem ME we can conclude that their geometric multiplicities are one as well. Together with the computation of the geometric multiplicity of $$\lambda=2$$ from Exercise EE.C20, we know

\begin{align*} \geomult{A}{3}&=\algmult{A}{3}=1& \geomult{A}{2}&=\algmult{A}{2}=2& \geomult{A}{-1}&=\algmult{A}{-1}=1\text{.} \end{align*}

This satisfies the hypotheses of Theorem DMFE, and so we can conclude that $$A$$ is diagonalizable.

A calculator will give us four eigenvectors of $$A\text{,}$$ the two for $$\lambda=2$$ being linearly independent presumably. Or, by hand, we could find basis vectors for the three eigenspaces. For $$\lambda=3,\,-1$$ the eigenspaces have dimension one, and so any eigenvector for these eigenvalues will be multiples of the ones we use below. For $$\lambda=2$$ there are many different bases for the eigenspace, so your answer could vary. Our eigenvectors are the basis vectors we would have obtained if we had actually constructed a basis in Exercise EE.C20 rather than just computing the dimension.

By the construction in the proof of Theorem DC, the required matrix $$S$$ has columns that are four linearly independent eigenvectors of $$A$$ and the diagonal matrix has the eigenvalues on the diagonal (in the same order as the eigenvectors in $$S$$). Here are the pieces, “doing” the diagonalization,

\begin{equation*} \inverse{ \begin{bmatrix} -1 & 0 & -3 & 6\\ -2 & -1 & -1 & 0\\ 0 & 0 & 1 & -3\\ 1 & 1 & 0 & 1 \end{bmatrix} } \begin{bmatrix} 18 & -15 & 33 & -15\\ -4 & 8 & -6 & 6\\ -9 & 9 & -16 & 9\\ 5 & -6 & 9 & -4 \end{bmatrix} \begin{bmatrix} -1 & 0 & -3 & 6\\ -2 & -1 & -1 & 0\\ 0 & 0 & 1 & -3\\ 1 & 1 & 0 & 1 \end{bmatrix} = \begin{bmatrix} 3 & 0 & 0 & 0\\ 0 & 2 & 0 & 0\\ 0 & 0 & 2 & 0\\ 0 & 0 & 0 & -1 \end{bmatrix}\text{.} \end{equation*}

#### C21.

Determine if the matrix $$A$$ below is diagonalizable. If the matrix is diagonalizable, then find a diagonal matrix $$D$$ that is similar to $$A\text{,}$$ and provide the invertible matrix $$S$$ that performs the similarity transformation. You should use your calculator to find the eigenvalues of the matrix, but try only using the row-reducing function of your calculator to assist with finding eigenvectors.

\begin{equation*} A= \begin{bmatrix} 1 & 9 & 9 & 24 \\ -3 & -27 & -29 & -68 \\ 1 & 11 & 13 & 26 \\ 1 & 7 & 7 & 18 \end{bmatrix} \end{equation*}
Solution.

A calculator will provide the eigenvalues $$\lambda=2,\,2,\,1,\,0\text{,}$$ so we can reconstruct the characteristic polynomial as

\begin{equation*} \charpoly{A}{x}=(x-2)^2(x-1)x \end{equation*}

so the algebraic multiplicities of the eigenvalues are

\begin{align*} \algmult{A}{2}&=2& \algmult{A}{1}&=1& \algmult{A}{0}&=1\text{.} \end{align*}

Now compute eigenspaces by hand, obtaining null spaces for each of the three eigenvalues by constructing the correct singular matrix (Theorem EMNS),

\begin{align*} A-2I_4&= \begin{bmatrix} -1 & 9 & 9 & 24 \\ -3 & -29 & -29 & -68 \\ 1 & 11 & 11 & 26 \\ 1 & 7 & 7 & 16 \end{bmatrix} \rref \begin{bmatrix} 1 & 0 & 0 & -\frac{3}{2} \\ 0 & 1 & 1 & \frac{5}{2} \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \end{bmatrix}\\ \eigenspace{A}{2}&=\nsp{A-2I_4} =\spn{\set{\colvector{\frac{3}{2}\\-\frac{5}{2}\\0\\1},\,\colvector{0\\-1\\1\\0}}} =\spn{\set{\colvector{3\\-5\\0\\2},\,\colvector{0\\-1\\1\\0}}}\\ A-1I_4&= \begin{bmatrix} 0 & 9 & 9 & 24 \\ -3 & -28 & -29 & -68 \\ 1 & 11 & 12 & 26 \\ 1 & 7 & 7 & 17 \end{bmatrix} \rref \begin{bmatrix} 1 & 0 & 0 & -\frac{5}{3} \\ 0 & 1 & 0 & \frac{13}{3} \\ 0 & 0 & 1 & -\frac{5}{3} \\ 0 & 0 & 0 & 0 \end{bmatrix}\\ \eigenspace{A}{1}&=\nsp{A-I_4} =\spn{\set{\colvector{\frac{5}{3}\\-\frac{13}{3}\\\frac{5}{3}\\1}}} =\spn{\set{\colvector{5\\-13\\5\\3}}}\\ A-0I_4&= \begin{bmatrix} 1 & 9 & 9 & 24 \\ -3 & -27 & -29 & -68 \\ 1 & 11 & 13 & 26 \\ 1 & 7 & 7 & 18 \end{bmatrix} \rref \begin{bmatrix} 1 & 0 & 0 & -3 \\ 0 & 1 & 0 & 5 \\ 0 & 0 & 1 & -2 \\ 0 & 0 & 0 & 0 \end{bmatrix}\\ \eigenspace{A}{0}&=\nsp{A}=\spn{\set{\colvector{3\\-5\\2\\1}}}\text{.} \end{align*}

From this we can compute the dimensions of the eigenspaces to obtain the geometric multiplicities,

\begin{align*} \geomult{A}{2}&=2& \geomult{A}{1}&=1& \geomult{A}{0}&=1\text{.} \end{align*}

For each eigenvalue, the algebraic and geometric multiplicities are equal and so by Theorem DMFE we now know that $$A$$ is diagonalizable. The construction in Theorem DC suggests we form a matrix whose columns are eigenvectors of $$A$$

\begin{equation*} S= \begin{bmatrix} 3 & 0 & 5 & 3 \\ -5 & -1 & -13 & -5 \\ 0 & 1 & 5 & 2 \\ 2 & 0 & 3 & 1 \end{bmatrix}\text{.} \end{equation*}

Since $$\detname{S}=-1\neq 0\text{,}$$ we know that $$S$$ is nonsingular (Theorem SMZD), so the columns of $$S$$ are a set of 4 linearly independent eigenvectors of $$A\text{.}$$ By the proof of Theorem SMZD we know

\begin{equation*} \similar{A}{S}= \begin{bmatrix} 2 & 0 & 0 & 0 \\ 0 & 2 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 \end{bmatrix} \end{equation*}

is a diagonal matrix with the eigenvalues of $$A$$ along the diagonal, in the same order as the associated eigenvectors appear as columns of $$S\text{.}$$

#### C22.

Consider the matrix $$A$$ below. Find the eigenvalues of $$A$$ using a calculator and use these to construct the characteristic polynomial of $$A\text{,}$$ $$\charpoly{A}{x}\text{.}$$ State the algebraic multiplicity of each eigenvalue. Find all of the eigenspaces for $$A$$ by computing expressions for null spaces, only using your calculator to row-reduce matrices. State the geometric multiplicity of each eigenvalue. Is $$A$$ diagonalizable? If not, explain why. If so, find a diagonal matrix $$D$$ that is similar to $$A\text{.}$$

\begin{equation*} A= \begin{bmatrix} 19 & 25 & 30 & 5 \\ -23 & -30 & -35 & -5 \\ 7 & 9 & 10 & 1 \\ -3 & -4 & -5 & -1 \end{bmatrix} \end{equation*}
Solution.

A calculator will report $$\lambda=0$$ as an eigenvalue of algebraic multiplicity of 2, and $$\lambda=-1$$ as an eigenvalue of algebraic multiplicity 2 as well. Since eigenvalues are roots of the characteristic polynomial (Theorem EMRCP) we have the factored version

\begin{equation*} \charpoly{A}{x}=(x-0)^2(x-(-1))^2=x^2(x^2+2x+1)=x^4+2x^3+x^2\text{.} \end{equation*}

The eigenspaces are then

\begin{align*} \lambda&=0\\ A-(0)I_4&= \begin{bmatrix} 19 & 25 & 30 & 5 \\ -23 & -30 & -35 & -5 \\ 7 & 9 & 10 & 1 \\ -3 & -4 & -5 & -1 \end{bmatrix} \rref \begin{bmatrix} \leading{1} & 0 & -5 & -5 \\ 0 & \leading{1} & 5 & 4 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \end{bmatrix}\\ \eigenspace{A}{0}&=\nsp{C-(0)I_4}= \spn{\set{\colvector{5\\-5\\1\\0},\,\colvector{5\\-4\\0\\1}}}\\ \lambda&=-1\\ A-(-1)I_4&= \begin{bmatrix} 20 & 25 & 30 & 5 \\ -23 & -29 & -35 & -5 \\ 7 & 9 & 11 & 1 \\ -3 & -4 & -5 & 0 \end{bmatrix} \rref \begin{bmatrix} \leading{1} & 0 & -1 & 4 \\ 0 & \leading{1} & 2 & -3 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \end{bmatrix}\\ \eigenspace{A}{-1}&=\nsp{C-(-1)I_4}= \spn{\set{\colvector{1\\-2\\1\\0},\,\colvector{-4\\3\\0\\1}}}\text{.} \end{align*}

Each eigenspace above is described by a spanning set obtained through an application of Theorem BNS and so is a basis for the eigenspace. In each case the dimension, and therefore the geometric multiplicity, is 2.

For each of the two eigenvalues, the algebraic and geometric multiplicities are equal. Theorem DMFE says that in this situation the matrix is diagonalizable. We know from Theorem DC that when we diagonalize $$A$$ the diagonal matrix will have the eigenvalues of $$A$$ on the diagonal (in some order). So we can claim that

\begin{equation*} D= \begin{bmatrix} 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & -1 & 0 \\ 0 & 0 & 0 & -1 \end{bmatrix}\text{.} \end{equation*}

#### T15.

Suppose that $$A$$ and $$B$$ are similar matrices of size $$n\text{.}$$ Prove that $$A^3$$ and $$B^3$$ are similar matrices. Generalize.

Solution.

By Definition SIM we know that there is a nonsingular matrix $$S$$ so that $$A=\similar{B}{S}\text{.}$$ Then

\begin{align*} A^3&=(\similar{B}{S})^3\\ &=(\similar{B}{S})(\similar{B}{S})(\similar{B}{S})\\ &=\inverse{S}B(S\inverse{S})B(S\inverse{S})BS&& \knowl{./knowl/theorem-MMA.html}{\text{Theorem MMA}}\\ &=\inverse{S}B(I_n)B(I_n)BS&& \knowl{./knowl/definition-MI.html}{\text{Definition MI}}\\ &=\inverse{S}BBBS&& \knowl{./knowl/theorem-MMIM.html}{\text{Theorem MMIM}}\\ &=\inverse{S}B^3S\text{.} \end{align*}

This equation says that $$A^3$$ is similar to $$B^3$$ (via the matrix $$S$$).

More generally, if $$A$$ is similar to $$B\text{,}$$ and $$m$$ is a non-negative integer, then $$A^m$$ is similar to $$B^m\text{.}$$ This can be proved using induction (Proof Technique I).

#### T16.

Suppose that $$A$$ and $$B$$ are similar matrices, with $$A$$ nonsingular. Prove that $$B$$ is nonsingular, and that $$\inverse{A}$$ is similar to $$\inverse{B}\text{.}$$

Solution.

$$A$$ being similar to $$B$$ means that there exists an $$S$$ such that $$A=\inverse{S}BS\text{.}$$ So, $$B=SA\inverse{S}$$ and because $$S\text{,}$$ $$A\text{,}$$ and $$\inverse{S}$$ are nonsingular, by Theorem NPNT, $$B$$ is nonsingular.

\begin{align*} \inverse{A} &= \inverse{\left(\inverse{S}BS\right)}&& \knowl{./knowl/definition-SIM.html}{\text{Definition SIM}}\\ &= \inverse{S}\inverse{B}\inverse{\left(\inverse{S}\right)}&& \knowl{./knowl/theorem-SS.html}{\text{Theorem SS}}\\ &= \inverse{S}\inverse{B}S&& \knowl{./knowl/theorem-MIMI.html}{\text{Theorem MIMI}}\text{.} \end{align*}

Then by Definition SIM, $$\inverse{A}$$ is similar to $$\inverse{B}\text{.}$$

#### T17.

Suppose that $$B$$ is a nonsingular matrix. Prove that $$AB$$ is similar to $$BA\text{.}$$

Solution.

The nonsingular (invertible) matrix $$B$$ will provide the desired similarity transformation,

\begin{align*} \inverse{B}\left(BA\right)B &=\left(\inverse{B}B\right)\left(AB\right)&& \knowl{./knowl/theorem-MMA.html}{\text{Theorem MMA}}\\ &=I_nAB&& \knowl{./knowl/definition-MI.html}{\text{Definition MI}}\\ &=AB&& \knowl{./knowl/theorem-MMIM.html}{\text{Theorem MMIM}}\text{.} \end{align*}