How this calculation works
Smith normal form describes an integer matrix up to invertible integer row and column transformations. Its nonzero diagonal entries are positive and each divides the next. This calculator obtains those invariant factors from determinantal divisors: the greatest common divisors of all minors of a fixed size. It returns the canonical diagonal and rank without claiming to produce the particular unimodular transformation matrices that could realize it.
Δk = gcd of all k×k minors; dₖ = Δk/Δ(k−1), with Δ0 = 1 and dₖ dividing dₖ₊₁.A worked example
For diagonal entries two and three, the 1×1 minors have gcd one and the determinant has absolute value six. The invariant factors are therefore one and six, giving Smith diagonal diag(1,6). Merely sorting the original entries as diag(2,3) would fail the divisibility requirement because two does not divide three.
Good to know
Accepts integer rectangular matrices up to 5×5. Fractional entries are rejected; decimal notation representing an integer is allowed. Exact fraction and integer growth limits still apply. The result does not include transformation matrices U and V, lattice bases or a full finitely generated group interpretation. Zero diagonal positions remain visible in the original rectangular shape.
Reference: SymPy — Smith normal form over the integers (opens in a new tab) ↗
Divisibility is stronger than a sorted diagonal
The default matrix is already diagonal over ordinary real linear algebra, but it is not in Smith form. Smith normalization requires the first nonzero diagonal entry to divide the second. Integer row and column operations can move common factors between positions, producing one and six. The product of the nonzero factors agrees with the absolute determinant for a full-rank square matrix.
For a rank-deficient matrix, the process stops when all minors of the next size vanish. Later diagonal entries are zero. A zero matrix consequently has rank zero and no nonzero invariant factors. The table still displays its full zero matrix shape, rather than implying that no matrix exists because the invariant-factor list is empty.
The Exact matrix permanent calculator uses the same bounded exact-entry convention but computes a different unsigned permutation sum.
Integer equivalence is different from real row reduction
Ordinary RREF may divide rows by arbitrary nonzero numbers and is designed for vector spaces over a field. Smith form allows integer transformations with determinant plus or minus one, preserving integer lattice information. RREF of diag(2,3) is the identity, so it cannot distinguish the same divisibility structure as the Smith diagonal. The underlying coefficient domain is part of the mathematical task.
Computing gcds of minors provides an independent definition of the invariant factors and is practical at the bounded size used here. It does not record a sequence of row and column operations, so no U or V matrix is returned. Larger symbolic implementations use more efficient reduction algorithms. The matrix determinant calculator can check an individual minor, while this page combines all minors of each order into canonical integer invariants.
A few questions, answered
May the matrix be rectangular?
Yes. The Smith diagonal occupies the original shape, with at most the smaller dimension many nonzero factors.
Can negative entries be used?
Yes. The input can be signed, but the nonzero invariant diagonal entries are normalized to positive values.