Smith normal form of a matrix
MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
linalg::smithForm(A
, <var>, <All>)
linalg::smithForm(A)
computes the Smith normal
form of the ndimensional
square matrix A,
that is an n×n diagonal
matrix S,
such that S_{i 
1, i  1} divides S_{i, i} for i =
2, …, n.
The Smith normal form of a matrix A
is unique.
The component ring of A
must be a Euclidean
ring, that is, a domain of category Cat::EuclideanDomain
.
linalg::smithForm(A, var)
returns the Smith
normal form of A
, assuming that the elements of A
are
univariate polynomials in the variable var
. If A
does
not contain var
, then smithForm(A)
and smithForm(A,var)
return
different results.
linalg::smithForm(A, <var>, All)
returns
the list [S, U, V]
, where S
is
the Smith normal form of A
, and U
and V
are
unimodular transformation matrices, such that S = U*A*V
.
You can use the All
option with or without specifying
the variable var
.
Create the following matrix of integers.
A := matrix([[9, 36, 30], [36, 192, 180], [30, 180, 180]])
Find the Smith normal form of this matrix.
linalg::smithForm(A)
Use the All
option to find the corresponding
transformation matrices.
[S, U, V] := linalg::smithForm(A, All)
Verify that S = U*A*V
.
S = U*A*V
Create the following matrix of polynomials.
B := matrix([[(x  3)^2*(x  2),(x  3)*(x  2)*(x  4)], [(x  3)*(x  2)*(x  4),(x  3)^2*(x  4)] ])
Find the Smith normal form of this matrix.
linalg::smithForm(B)
Use the All
option to find the corresponding
transformation matrices.
[U, S, V] := linalg::smithForm(B, All)
If a matrix does not contain a particular variable, and you
call linalg::smithForm
specifying that variable
as the second argument, then the result differs from what you get
without specifying that variable. For example, create a matrix that
does not contain any variables.
A := matrix([[9, 36, 30], [36, 192, 180], [30, 180, 180]])
Call linalg::smithForm
specifying variable x
as
the second argument. In this case, linalg::smithForm
assumes that the elements of A
are univariate polynomials
in x
.
linalg::hermiteForm(A, x)
Call linalg::smithForm
without specifying
variables. In this case, linalg::smithForm
treats A
as
a matrix of integers.
linalg::hermiteForm(A)

A square matrix of a domain of category 

Returns the list 
Matrix of the same domain type as A
. With
the option All
, linalg::smithForm
returns
the list [S, U, V]
, where S
is
a matrix of the same domain type as A
, and U
and V
are
corresponding transformation matrices.
An n×n matrix S = (s_{ij}) with coefficients in a Euclidean ring is the Smith normal form of a matrix if S is a diagonal matrix (with nonnegative coefficients in case of the ring ℤ), such that s_{i, i} divides s_{i + 1, i + 1} for all i < n.