For questions about matrix diagonalization. Diagonalization is the process of finding a corresponding diagonal matrix for a diagonalizable matrix or linear map. This tag is NOT for diagonalization arguments common to logic and set theory.
A square matrix $A$ is diagonalizable if there is an invertible matrix $P$ such that $P^{-1}AP$ is a diagonal matrix. One can view $P$ as a change of basis matrix so that, if $A$ is viewed as the standard matrix of a linear map $T$ from a vector space to itself in some basis, it is equivalent to saying there exists an ordered basis such that the standard matrix of $T$ is diagonal. Diagonal matrices present the eigenvalues of the corresponding linear transformation along its diagonal. A square matrix that is not diagonalizable is called defective.
Not every matrix is diagonalizable over $\mathbb{R}$ (i.e. only allowing real matrices $P$). For example, $$\begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}$$
Diagonalization can be used to compute the powers of a matrix $A$ efficiently, provided the matrix is diagonalizable.
Diagonalization Procedure:
Let $A$ be the $n \times n$ matrix that you want to diagonalize (if possible).
Find the characteristic polynomial $p(t)$ of $A$.
Find eigenvalues $\lambda$ of the matrix $A$ and their algebraic multiplicities from the characteristic polynomial $p(t)$.
For each eigenvalue $λ$ of $A$, find a basis of the eigenspace $E_λ$. If there is an eigenvalue $\lambda$ such that the geometric multiplicity of $λ$, $\dim(E_{\lambda})$, is less than the algebraic multiplicity of $λ$, then the matrix $A$ is not diagonalizable. If not, $A$ is diagonalizable, and proceed to the next step.
If we combine all basis vectors for all eigenspaces, we obtained $n$ linearly independent eigenvectors $v_1,v_2, \ldots, v_n$.
Define the nonsingular matrix $$P=[v_1\quad v_2\quad \cdots \quad v_n]$$
Define the diagonal matrix $D$, whose $(i,i)$-entry is the eigenvalue $\lambda$ such that the $i^{th}$ column vector $v_i$ is in the eigenspace $E_λ$.
Then the matrix A is diagonalized as $$P^{−1}AP=D.$$
References: