LinearAlgebra
IdentityMatrix
construct an identity Matrix
Calling Sequence
Parameters
Description
Examples
IdentityMatrix(r, c, cpt, options)
r

(optional) nonnegative integer; row dimension of the resulting Matrix
c
(optional) nonnegative integer; column dimension of the resulting Matrix
cpt
(optional) equation of the form compact=true or false; selects the compact form of the output
options
(optional); constructor options for the result object
The IdentityMatrix() function returns an identity matrix.
If M := IdentityMatrix(r, c), then M is an r x c Matrix in which all the entries on the diagonal are one and all other entries are zero.
If the row dimension is not provided, it defaults to zero. If the column dimension is not provided, it defaults to the row dimension.
If the compact option (cpt) is omitted, or, if it is included in the calling sequence as just the symbol compact or in the form compact=true, then the result is built by using a shape function designed to minimize storage. If the option is entered as compact=false, a full rectangular Matrix is constructed.
The constructor options provide additional information (readonly, shape, storage, order, datatype, and attributes) to the Matrix constructor that builds the result. These options may also be provided in the form outputoptions=[...], where [...] represents a Maple list. If a constructor option is provided in both the calling sequence directly and in an outputoptions option, the latter takes precedence (regardless of the order).
If a shape value is not provided, then the shape of the resulting Matrix is determined by the compact option. Otherwise, a result with the specified shape is constructed with all diagonal values set to 1.
If readonly=false is included, it is ignored unless the default shape (identity) is overridden by also including a mutable shape in options.
This function is part of the LinearAlgebra package, and so it can be used in the form IdentityMatrix(..) only after executing the command with(LinearAlgebra). However, it can always be accessed through the long form of the command by using LinearAlgebra[IdentityMatrix](..).
$\mathrm{with}\left(\mathrm{LinearAlgebra}\right)\:$
$M\u2254\mathrm{IdentityMatrix}\left(4\right)$
${M}{\u2254}\left[\begin{array}{cccc}{1}& {0}& {0}& {0}\\ {0}& {1}& {0}& {0}\\ {0}& {0}& {1}& {0}\\ {0}& {0}& {0}& {1}\end{array}\right]$
$\mathrm{MatrixOptions}\left(M\,\mathrm{shape}\right)$
$\left[{\mathrm{identity}}\right]$
$N\u2254\mathrm{IdentityMatrix}\left(3\,5\,\mathrm{compact}\=\mathrm{false}\right)$
${N}{\u2254}\left[\begin{array}{ccccc}{1}& {0}& {0}& {0}& {0}\\ {0}& {1}& {0}& {0}& {0}\\ {0}& {0}& {1}& {0}& {0}\end{array}\right]$
$\mathrm{MatrixOptions}\left(N\,\mathrm{shape}\right)$
$\left[\right]$
See Also
LinearAlgebra[ScalarMatrix]
Matrix
Download Help Document
What kind of issue would you like to report? (Optional)