Home / Maths for AI / Symbols / Vectors and matrices

Identity matrix

Say it: "the identity", "I"

What it means

A square matrix with 1s on the diagonal and 0s elsewhere. Multiplying by it changes nothing: AI=AAI = A.

Example

I3=(100010001)I_3 = \begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix}

The matrix version of the number 1.

In code

import numpy as np
print(np.eye(3))

Output

[[1. 0. 0.]
 [0. 1. 0.]
 [0. 0. 1.]]

Where it appears in machine learning

Ridge regression adds λI\lambda I to make a matrix invertible; residual connections add the identity map.

Related symbols

Learn it properly in the free lesson Matrices, with practice questions that check your answers.