How to Diagonalize
(these equations don't work unless you go to my blog directly)
Diagonalizing an n by n square matrix A is done by finding a matrix P which satisfies the equation below where D is a n by n diagonal matrix:
$$A=PDP^{-1}$$
This equation can be rewritten (if only if P is invertible) as the one below which can be used to derive P and D:
$$AP=PD$$
The diagonal matrix will have n different values along the diagonal. These entries will be denoted by λ subscripted with some number indicating its place on the diagonal from left to right.
$$D=\begin{pmatrix} \lambda_1 & \cdots & 0\\\ \vdots & \ddots & \vdots\\\ 0 & \cdots & \lambda_n \end{pmatrix}$$
With this definition in mind for D, the equation for P can be written such that the columns of P can be written with p subscripted by the number of the column.
$$P=\begin{pmatrix} p_1 & \cdots & p_n \end{pmatrix}$$
$$A\begin{pmatrix} p_1 & \cdots & p_n \end{pmatrix}=\begin{pmatrix} p_1 & \cdots & p_n \end{pmatrix} \begin{pmatrix} \lambda_1 & \cdots & 0\\\ \vdots & \ddots & \vdots\\\ 0 & \cdots & \lambda_n \end{pmatrix}$$
$$A \begin{pmatrix} p_1 & \cdots & p_n \end{pmatrix} = \begin{pmatrix} \lambda_1 p_1 & \cdots & \lambda_n p_n \end{pmatrix}$$
This last form of the formula is key to finding the diagonal matrix. If one chooses one of the columns of P, then one can find the formula below, which should look familiar if one knowns about eigenvectors:
$$A p_x = \lambda_x p_x$$
This type of column vector, which equals itself times a scalar λ when multiplied by a matrix, is an eigenvector, and the scalar λ is the eigenvalue.
Therefore, the columns of the matrix P are the eigenvectors of A and the diagonal matrix D is the diagonal matrix of the corresponding eigenvalues (the eigenvector of column 1 in P corresponds to eigenvalue 1 in D and so on).
$$(A - \lambda_x I)p_x = 0$$
(I wrote about eigenvectors here)
BUT, this only works if and only if P is invertible; if it's not, you can kiss this entire process goodbye. Some matrices cannot be diagonalized.
















