gives the nn identity matrix.

Details and Options


open allclose all

Basic Examples  (1)

Construct a 3×3 identity matrix:

Scope  (1)

Construct a 3×4 identity matrix:

Options  (1)

WorkingPrecision  (1)

Create a machine-precision identity matrix:

Properties & Relations  (3)

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:

Possible Issues  (1)

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:

Introduced in 1988
Updated in 2008