Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Mathematics and Algorithms > Matrices and Linear Algebra > Constructing Matrices > IdentityMatrix >
Mathematica > Mathematics and Algorithms > Graphs & Networks > Graph Programming > Matrices and Linear Algebra > Constructing Matrices > IdentityMatrix >
Mathematica > Visualization and Graphics > Graphs & Networks > Graph Programming > Matrices and Linear Algebra > Constructing Matrices > IdentityMatrix >

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
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF