Function identity

identity(n) returns the $n \times n$ identity matrix $$I = \left[ \begin{array}{cccc} 1 & 0 & \cdots & 0 \ 0 & 1 & \cdots & 0 \ \vdots & \vdots & \ddots & \vdots \ 0 & 0 & \cdots & 1 \end{array} \right].$$