IdentityMatrix

IdentityMatrix[n]

gives the nn identity matrix.

Details and Options

Examples

open allclose all

Basic Examples  (2)

Construct a 3×3 identity matrix:

Visualize the matrix:

Create a 2×3 identity matrix:

Scope  (4)

A square identity matrix:

Non-square identity matrix:

Compute the rank of an identity matrix:

Construct a sparse identity matrix:

The sparse representation saves a significant amount of memory for larger matrices:

Options  (2)

WorkingPrecision  (2)

Create a machine-precision identity matrix:

Create an identity matrix with ones of precision 24:

Applications  (3)

Use IdentityMatrix to quickly define the standard basis on TemplateBox[{}, Reals]^n:

The variables , , and can now be used as the standard basis variables:

Compute the characteristic polynomial using IdentityMatrix:

Compare with a direct computation using CharacteristicPolynomial:

Form the augmented matrix that combines a matrix m with the identity matrix:

Row reduction of the augmented matrix gives an identity matrix augmented with Inverse[m]:

Verify that the right half of r truly is Inverse[m]:

Properties & Relations  (12)

The determinant of a square identity matrix is always 1:

For an nm matrix , Tr[]==Min[n,m]:

A square identity matrix is its own inverse and its own transpose:

The scalar multiple of an identity matrix is a diagonal matrix:

The ^(th), ^(th) entry of any identity matrix is given by KroneckerDelta[i,j]:

The ^(th) row or column of IdentityMatrix[n] is UnitVector[n,i]:

For IdentityMatrix[{n,m}], the rows are instead UnitVector[m,i] for i<=Min[n,m]:

Use DiagonalMatrix for general diagonal matrices:

For an invertible n×n matrix m, Inverse[m].m==m.Inverse[m]==IdentityMatrix[n]:

For an n×m matrix a, a.PseudoInverse[a]==IdentityMatrix[n]:

The pseudoinverse of an identity matrix is its transpose:

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:

Wolfram Research (1988), IdentityMatrix, Wolfram Language function, https://reference.wolfram.com/language/ref/IdentityMatrix.html (updated 2008).

Text

Wolfram Research (1988), IdentityMatrix, Wolfram Language function, https://reference.wolfram.com/language/ref/IdentityMatrix.html (updated 2008).

CMS

Wolfram Language. 1988. "IdentityMatrix." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2008. https://reference.wolfram.com/language/ref/IdentityMatrix.html.

APA

Wolfram Language. (1988). IdentityMatrix. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/IdentityMatrix.html

BibTeX

@misc{reference.wolfram_2022_identitymatrix, author="Wolfram Research", title="{IdentityMatrix}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/IdentityMatrix.html}", note=[Accessed: 13-August-2022 ]}

BibLaTeX

@online{reference.wolfram_2022_identitymatrix, organization={Wolfram Research}, title={IdentityMatrix}, year={2008}, url={https://reference.wolfram.com/language/ref/IdentityMatrix.html}, note=[Accessed: 13-August-2022 ]}