# IdentityMatrix

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 :

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  ,  entry of any identity matrix is given by KroneckerDelta[i,j]:

The  row or column of 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: