How this calculation works
Smith form over the polynomial ring Q[x] separates a polynomial matrix into canonical invariant factors using invertible polynomial row and column operations. This calculator returns the determinant, the monic divisibility-chain diagonal and the actual transformation matrices U and V. The certificate is verified by polynomial multiplication, and both transformation determinants are checked to be units of Q[x].
U(x)A(x)V(x)=diag(d₁,…,d_r,0,…), d_i monic, d_i divides d_(i+1); det U,det V are nonzero rational constants.A worked example
For A=[[x,x],[0,x²]], subtracting the first column from the second gives D=diag(x,x²). One valid certificate is U=I and V=[[1,−1],[0,1]]. The determinant is x³, and x divides x². The transformation has determinant one, so it is invertible over Q[x], not merely invertible for a few selected numeric values of x.
Good to know
Square polynomial matrices of order one through three with rational coefficients, one variable x and input entry degree at most four. Nonzero invariant factors are monic; zeros trail them. Unimodularity is over Q[x], where every nonzero rational constant is a unit. Intermediate polynomial degree, exact-fraction growth and 1,000 elementary-operation limits can reject a request without returning a partial normal form.
Reference: SymPy — matrix normal forms over polynomial domains (opens in a new tab) ↗
Polynomial units differ from integer-matrix units
Over Q[x], a nonzero constant such as two has an inverse constant one half. A polynomial such as x does not have a polynomial inverse and is not a unit. This differs from integer Smith form, whose units are only plus and minus one. Using integer-domain divisibility rules here would produce the wrong normalization and transformations.
The engine makes each nonzero diagonal polynomial monic by rational row scaling. Its coefficients are therefore canonical under the declared ring convention, although U and V themselves need not be unique. Comparing two valid outputs should focus first on the invariant factors and the checked reconstruction rather than demanding identical elementary-operation histories.
The Smith normal form calculator for integer matrices uses integer-ring divisibility. This page uses Q[x], where nonzero rational constants are units and invariant factors are polynomials.
A diagonal matrix is not automatically Smith form
The nonzero diagonal entries must form a divisibility chain. For diag(x,x+1), a diagonal result alone is not enough: the two polynomials are coprime, and the Smith form has diagonal 1,x(x+1). An implementation that only clears off-diagonal entries would miss this additional reduction.
After clearing the current pivot row and column, the algorithm checks whether that pivot divides every remaining entry. A violating entry is brought into the pivot reduction, allowing the Euclidean polynomial algorithm to shrink the pivot toward the correct gcd. This is why the final divisibility check is a mathematical requirement rather than a cosmetic ordering step.
Transformation determinants certify equivalence over the ring
A matrix transformation whose determinant is x is invertible as a rational-function matrix away from x=0, but not unimodular over Q[x]. Such a transformation could change the polynomial module and invalidate the Smith certificate. The returned U and V must therefore have nonzero constant determinants.
The final checks multiply U A V exactly and compare every coefficient with the returned diagonal. They also verify each adjacent invariant-factor divisibility, including singular matrices with zero trailing entries. The determinant of the original matrix is returned separately because making the diagonal monic can move a nonzero rational unit into U or V.
A few questions, answered
Is this integer Smith form?
No. The coefficient ring is Q[x]. Rational constants are units and the diagonal entries are polynomials, not integer elementary divisors.
Can a singular polynomial matrix be processed?
Yes. Zero invariant factors appear at the end. Exact transformation and divisibility checks still apply.