# Linear Algebra/Matrix Equation

## Diagonal Matrix

A diagonal matrix, $A$, is a square matrix in which the entries outside of the main diagonal are zero. The main diagonal of a square matrix consists of the entries which run from the top left corner to the bottom right corner.

In the example below the main diagonal are $a_{11}, a_{22}, ..., a_{nn}\!$

$\quad A=\begin{bmatrix}a_{11} & 0 & \cdots & 0 \\ 0 & a_{22} & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & a_{nn}\end{bmatrix}$

## Identity Matrix

The identity matrix, with a size of n, is an n-by-n square matrix with ones on the main diagonal and zeros elsewhere. It is commonly denoted as $I_n$, or simply by I if the size is immaterial or can be easily determined by the context.

$I_1=[1] \quad I_2=\begin{bmatrix}1 & 0 \\ 0 & 1\end{bmatrix} \quad I_3=\begin{bmatrix}1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1\end{bmatrix} \quad I_n=\begin{bmatrix}1 & 0 & \cdots & 0 \\ 0 & 1 & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & 1\end{bmatrix}$

The most important property of the identity matrix is that, when multiplied by another matrix, A, the result will be A

$AI_n=A\,$ and $I_n A=A\,$.