This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

IdentityMatrix

IdentityMatrix[n]
gives the nn identity matrix.
  • The option WorkingPrecision can be used to specify the precision of matrix elements.
Construct a 3×3 identity matrix:
Construct a 3×3 identity matrix:
In[1]:=
Click for copyable input
Out[1]//MatrixForm=
Construct a 3×4 identity matrix:
Create a machine-precision identity matrix:
Use DiagonalMatrix for general diagonal matrices:
The KroneckerProduct of a matrix with the identity matrix is a block diagonal matrix:
The WorkingPrecision option is equivalent to creating the matrix, then applying N:
IdentityMatrix gives a matrix with dense storage. SparseArray is more compact:
The SparseArray representation uses a fraction of the memory:
For matrix and arithmetic operations they are effectively equal:
New in 1 | Last modified in 7