IdentityMatrix
IdentityMatrix[n] gives the n×n identity matrix.
IdentityMatrix[{m, n}] gives an m×n identity matrix.
Examples
Create a 3×3 identity matrix:
IdentityMatrix[3]
(* {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}} *)Rectangular identity matrix:
IdentityMatrix[{2, 3}]
(* {{1, 0, 0}, {0, 1, 0}} *)Please visit the official Wolfram Language Reference for more details.