# Modal matrix

In linear algebra, the modal matrix is used in the diagonalization process involving eigenvalues and eigenvectors.
Specifically the modal matrix $M$ for the matrix $A$ is the n × n matrix formed with the eigenvectors of $A$ as columns in $M$. It is utilized in the similarity transformation
    $D=M^{-1}AM,$
where $D$ is an n × n diagonal matrix with the eigenvalues of $A$ on the main diagonal of $D$ and zeros elsewhere. The matrix $D$ is called the spectral matrix for $A$. The eigenvalues must appear left to right, top to bottom in the same order as their corresponding eigenvectors are arranged left to right in $M$.

## Example

The matrix
    $A={\begin{pmatrix}3&2&0\\2&0&0\\1&0&2\end{pmatrix}}$
has eigenvalues and corresponding eigenvectors
    $\lambda _{1}=-1,\quad \,\mathbf {b} _{1}=\left(-3,6,1\right),$
    $\lambda _{2}=2,\qquad \mathbf {b} _{2}=\left(0,0,1\right),$
    $\lambda _{3}=4,\qquad \mathbf {b} _{3}=\left(2,1,1\right).$
A diagonal matrix $D$, similar to $A$ is
    $D={\begin{pmatrix}-1&0&0\\0&2&0\\0&0&4\end{pmatrix}}.$
One possible choice for an invertible matrix $M$ such that $D=M^{-1}AM,$ is
    $M={\begin{pmatrix}-3&0&2\\6&0&1\\1&1&1\end{pmatrix}}.$
Note that since eigenvectors themselves are not unique, and since the columns of both $M$ and $D$ may be interchanged, it follows that both $M$ and $D$ are not unique.

## Generalized modal matrix

Let $A$ be an n × n matrix. A generalized modal matrix $M$ for $A$ is an n × n matrix whose columns, considered as vectors, form a canonical basis for $A$ and appear in $M$ according to the following rules:
* All Jordan chains consisting of one vector (that is, one vector in length) appear in the first columns of $M$.
* All vectors of one chain appear together in adjacent columns of $M$.
* Each chain appears in $M$ in order of increasing rank (that is, the generalized eigenvector of rank 1 appears before the generalized eigenvector of rank 2 of the same chain, which appears before the generalized eigenvector of rank 3 of the same chain, etc.).
One can show that
| $AM=MJ,$ | (1) |
where $J$ is a matrix in Jordan normal form. By premultiplying by $M^{-1}$, we obtain
| $J=M^{-1}AM.$ | (2) |
Note that when computing these matrices, equation (1) is the easiest of the two equations to verify, since it does not require inverting a matrix.

### Example

This example illustrates a generalized modal matrix with four Jordan chains. Unfortunately, it is a little difficult to construct an interesting example of low order. The matrix
    $A={\begin{pmatrix}-1&0&-1&1&1&3&0\\0&1&0&0&0&0&0\\2&1&2&-1&-1&-6&0\\-2&0&-1&2&1&3&0\\0&0&0&0&1&0&0\\0&0&0&0&0&1&0\\-1&-1&0&1&2&4&1\end{pmatrix}}$
has a single eigenvalue $\lambda _{1}=1$ with algebraic multiplicity $\mu _{1}=7$. A canonical basis for $A$ will consist of one linearly independent generalized eigenvector of rank 3 (generalized eigenvector rank; see generalized eigenvector), two of rank 2 and four of rank 1; or equivalently, one chain of three vectors $\left\{\mathbf {x} _{3},\mathbf {x} _{2},\mathbf {x} _{1}\right\}$, one chain of two vectors $\left\{\mathbf {y} _{2},\mathbf {y} _{1}\right\}$, and two chains of one vector $\left\{\mathbf {z} _{1}\right\}$, $\left\{\mathbf {w} _{1}\right\}$.
An "almost diagonal" matrix $J$ in Jordan normal form, similar to $A$ is obtained as follows:
    $M={\begin{pmatrix}\mathbf {z} _{1}&\mathbf {w} _{1}&\mathbf {x} _{1}&\mathbf {x} _{2}&\mathbf {x} _{3}&\mathbf {y} _{1}&\mathbf {y} _{2}\end{pmatrix}}={\begin{pmatrix}0&1&-1&0&0&-2&1\\0&3&0&0&1&0&0\\-1&1&1&1&0&2&0\\-2&0&-1&0&0&-2&0\\1&0&0&0&0&0&0\\0&1&0&0&0&0&0\\0&0&0&-1&0&-1&0\end{pmatrix}},$
    $J={\begin{pmatrix}1&0&0&0&0&0&0\\0&1&0&0&0&0&0\\0&0&1&1&0&0&0\\0&0&0&1&1&0&0\\0&0&0&0&1&0&0\\0&0&0&0&0&1&1\\0&0&0&0&0&0&1\end{pmatrix}},$
where $M$ is a generalized modal matrix for $A$, the columns of $M$ are a canonical basis for $A$, and $AM=MJ$. Note that since generalized eigenvectors themselves are not unique, and since some of the columns of both $M$ and $J$ may be interchanged, it follows that both $M$ and $J$ are not unique.