For two polynomials and
of degrees
and
, respectively, the Sylvester matrix is an
matrix formed by filling the matrix beginning
with the upper left corner with the coefficients of
, then shifting down one row and one column to the right
and filling in the coefficients starting there until they hit the right side. The
process is then repeated for the coefficients of
.
The Sylvester matrix can be implemented in the Wolfram Language as:
SylvesterMatrix1[poly1_, poly2_, var_] := Function[{coeffs1, coeffs2}, With[ {l1 = Length[coeffs1], l2 = Length[coeffs2]}, Join[ NestList[RotateRight, PadRight[coeffs1, l1 + l2 - 2], l2 - 2], NestList[RotateRight, PadRight[coeffs2, l1 + l2 - 2], l1 - 2] ] ] ][ Reverse[CoefficientList[poly1, var]], Reverse[CoefficientList[poly2, var]] ]
For example, the Sylvester matrix for and
is
The determinant of the Sylvester matrix of two polynomials is the resultant of the polynomials.
SylvesterMatrix is an (undocumented) method for the Resultant function in the Wolfram Language (although it is documented in Trott 2006, p. 29).