SmithReduce[m]
gives the Smith normal form of an integer matrix
.
SmithReduce
SmithReduce[m]
gives the Smith normal form of an integer matrix
.
Details
- The result is a diagonal matrix with each diagonal entry dividing the next one.
- This result is the second element of the result given by SmithDecomposition.
- It is often faster to compute the Smith normal form than the full decomposition.
Examples
open all close allBasic Examples (1)
Give the Smith reduction of m into a diagonal matrix r:
m = (| | | |
| - | - | - |
| 1 | 2 | 3 |
| 5 | 4 | 3 |
| 8 | 7 | 9 |);
r = SmithReduce[m];
r//MatrixFormEach entry on the diagonal of r divides the successor:
{Divisible[r[[2, 2]], r[[1, 1]]], Divisible[r[[3, 3]], r[[2, 2]]]}Scope (12)
Basic Uses (8)
Find the Smith reduction of an integer square matrix:
MatrixForm@SmithReduce[(| | | |
| - | - | - |
| 1 | 2 | 3 |
| 5 | 4 | 3 |
| 8 | 7 | 9 |)]Smith reduction of a singular matrix:
m = (| | | |
| - | - | - |
| 1 | 2 | 3 |
| 4 | 5 | 6 |
| 7 | 8 | 9 |);
Det[m]MatrixForm[r = SmithReduce[m]]The number of nonzero rows in r is equal to the rank of m:
MatrixRank[m]Smith reduction for a rectangular matrix:
m = RandomInteger[9, {4, 3}];
MatrixForm[SmithReduce[m]]Use SmithReduce with a rational matrix:
MatrixForm@SmithReduce[(| | | |
| ----- | ----- | ----- |
| (1/2) | (2/3) | (3/4) |
| 5 | 4 | 3 |
| 8 | 7 | 9 |)]Smith reduction for a Gaussian integer matrix:
MatrixForm@SmithReduce[(| | | |
| ----- | ------- | - |
| 1 + I | 4 | 7 |
| 5 | 2 + 3 I | 3 |
| 8 | 3 + 4 I | 9 |)]Smith reduction for a Gaussian rational matrix:
MatrixForm@SmithReduce[(| | | |
| ------------- | --------------- | --------------- |
| (1/2) + (I/3) | (2/5) + (3 I/7) | (3/4) + (4 I/5) |
| 5 | 4 | 3 |
| 8 | 7 | 9 |)]Smith reduction works only with exact matrices:
SmithReduce[(| | | |
| ----- | - | - |
| 1 / 2 | 5 | 4 |
| 3 | 1 | 2 |
| 3 | 5 | 4 |)]SmithReduce[(| | | |
| --- | - | - |
| 0.5 | 5 | 4 |
| 3 | 1 | 2 |
| 3 | 5 | 4 |)]The Smith reduction for a large, integer matrix is computed efficiently:
mat = RandomInteger[5, {100, 100}];
AbsoluteTiming[SmithReduce[mat];]Special Matrices (4)
Find the Smith reduction for sparse matrices:
SparseArray[{{1, 3} -> 1, {2, 2} -> 2, {3, 1} -> 3}, {3, 3}]SmithReduce[%]SparseArray[{{x_, y_} /; Abs[x - y] < 3 -> 3}, {5, 5}]MatrixForm@SmithReduce[%]Smith reduction of structured matrices:
SymmetrizedArray[{{1, 1} -> 2, {1, 2} -> 1}, {2, 2}, Symmetric[All]]SmithReduce[%]Smith reduction of an IdentityMatrix is simply an identity matrix:
SmithReduce[IdentityMatrix[3]]SmithReduce[IdentityMatrix[{3, 4}]]Smith reduction of HilbertMatrix:
MatrixForm[SmithReduce[HilbertMatrix[3]]]Applications (2)
The Smith reduction gives a canonical representation for finitely generated Abelian groups. Consider the quotient group of integer 2‐vectors
modulo the relations
and
. That is to say, consider two points in the plane equivalent if they differ by integer multiples of the vectors
and
. Compute the Smith reduction of the matrix
whose rows are the
:
b1 = {3, -3};
b2 = {2, 1};
m = {b1, b2};
r = SmithReduce[m]From
, it can be seen that the structure of the group is
, or simply
, as
is the trivial group:
r//MatrixFormUse SmithReduce to compute the extended GCD of two integers
and
:
{a, b} = {15, 35};Let
be the column matrix with entries
and
:
m = {{a}, {b}};
m//MatrixFormThe Smith reduction gives the GCD as well as a zero entry:
MatrixForm[r = SmithReduce[m]]Compare to GCD:
GCD[15, 35]Properties & Relations (6)
The Smith reduction is a diagonal, rectangular matrix of the same dimensions as
:
m = RandomInteger[{-5, 5}, {10, 8}];
r = SmithReduce[m];
DiagonalMatrixQ[r]Dimensions[r] == Dimensions[m]Each diagonal entry in
divides its successor:
r = SmithReduce[{{0, 0, 12, 32}, {0, 0, 4, 32}, {0, 12, 8, 16}, {8, 32, 24, 16}}]pairs = Partition[Diagonal[r], 2, 1]Divisible[#2, #1]&@@@pairsThe Smith reduction is the second matrix in the result of SmithDecomposition:
m = RandomInteger[{-5, 5}, {10, 8}];
r = SmithReduce[m];
r == SmithDecomposition[m][[2]]The
matrix has integer values if the input matrix is integer:
mInteger = RandomInteger[{1, 9}, {10, 10}];
SmithReduce[mInteger][[2]]∈ℤIf the input matrix has noninteger rational elements, so will the
matrix:
mRational = mInteger / RandomInteger[{1, 9}, {10, 10}];
With[{r = SmithReduce[mRational][[2]]}, !(r∈ℤ) && r∈Rationals]For a rational-valued input, the diagonal entries of the
matrix are non-negative:
mReal = (RandomInteger[{-9, 9}, {10, 10}]/RandomInteger[{1, 9}, {10, 10}]);
Diagonal[SmithReduce[mReal]]∈NonNegativeRationalsFor complex-valued input, the real and imaginary parts of the entries are non-negative:
mComplex = mReal + I (RandomInteger[{-9, 9}, {10, 10}]/RandomInteger[{1, 9}, {10, 10}]);
ReIm[Diagonal[SmithReduce[mComplex]]]∈NonNegativeRationalsThe Smith reduction can often be found by two iterations of HermiteReduce:
m = {{-7, -6, 0}, {1, -3, 8}, {10, 4, -6}};
m//MatrixFormThe first use of HermiteReduce gives an upper triangular matrix:
MatrixForm[r1 = HermiteReduce[m]]Applying HermiteReduce to the Transpose of the triangular matrix gives
:
r = HermiteReduce[Transpose[r1]]r == SmithReduce[m]See Also
Related Guides
History
Text
Wolfram Research (2025), SmithReduce, Wolfram Language function, https://reference.wolfram.com/language/ref/SmithReduce.html.
CMS
Wolfram Language. 2025. "SmithReduce." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SmithReduce.html.
APA
Wolfram Language. (2025). SmithReduce. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SmithReduce.html
BibTeX
@misc{reference.wolfram_2026_smithreduce, author="Wolfram Research", title="{SmithReduce}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/SmithReduce.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_smithreduce, organization={Wolfram Research}, title={SmithReduce}, year={2025}, url={https://reference.wolfram.com/language/ref/SmithReduce.html}, note=[Accessed: 12-June-2026]}