# Identity matrix

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Identity matrix is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

Build an identity matrix of a size known at runtime. An identity matrix is a square matrix, of size n × n, where the diagonal is all

${\displaystyle I_n = \begin{bmatrix} 1 & 0 & 0 & \cdots & 0 \\ 0 & 1 & 0 & \cdots & 0 \\ 0 & 0 & 1 & \cdots & 0 \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & 0 & \cdots & 1 \\ \end{bmatrix}}$