Sylvester Matrix

Author

Eric W. Weisstein
February 26, 2007

This notebook downloaded from http://mathworld.wolfram.com/notebooks/LinearAlgebra/SylvesterMatrix.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/SylvesterMatrix.html.

©2007 Wolfram Research, Inc. except for portions noted otherwise

Additional Authors

SylvesterMatrix code by

Paul Abbott
Pers. comm., Feb. 26, 2006

Michael Trott
The Mathematica GuideBook for Symbolics
New York: Springer-Verlag, 2005.

Code

This code by Paul Abbott:

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]]
]

It uses RotateRight and NestList, corresponds more closely (and transparently) to the description, namely, “the Sylvester matrix is an (n+m)×(n+m)  matrix formed by filling the matrix beginning with the upper left corner with the coefficients of (Subscript[P, 1])(x), 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 (Subscript[P, 2])(x).” Also, it avoids nested use of Table, and the dummy index j.

This code by Michael Trott

SylvesterMatrix2[poly1_,poly2_,var_]:=Function[{coeffs1,coeffs2},With[{l1=Length[coeffs1],l2=Length[coeffs2]},Join[Table[Join[Table[0,{j}],coeffs1,Table[0,{l2-2-j}]],{j,0,l2-2}],Table[Join[Table[0,{j}],coeffs2,Table[0,{l1-2-j}]],{j,0,l1-2}]]]][Reverse[CoefficientList[poly1,var]],Reverse[CoefficientList[poly2,var]]
]

Polynomial[l_List, x_] := Fold[x #1 + #2 &, 0, l]

Built-In

This is an option to Resultant in V5.2

?SylvesterMatrix

Example

SylvesterMatrix1[a0+a1 x+a2 x^2+a3 x^3,b0+b1 x+b2 x^2+b3 x^3,x]==SylvesterMatrix2[a0+a1 x+a2 x^2+a3 x^3,b0+b1 x+b2 x^2+b3 x^3,x]

SylvesterMatrix2[a0+a1 x+a2 x^2+a3 x^3,b0+b1 x+b2 x^2+b3 x^3,x]//TableForm

Table[SylvesterMatrix2[Sequence@@(polys=Polynomial[Reverse[#],x]&/@{Array[a,d,0],Array[b,d,0]}/.x_[n_]:>Subscript[x,n]),x],{d,4}]//TraditionalForm

Table[SylvesterMatrix2[Sequence@@(polys=Polynomial[Reverse[#],x]&/@{Array[a,d,0],Array[b,d-1,0]}/.x_[n_]:>Subscript[x,n]),x],{d,4}]//TraditionalForm

polys=Polynomial[Reverse[#],x]&/@{Array[a,4,0],Array[b,4,0]};

Det[SylvesterMatrix2[Sequence@@polys,x]]==Resultant[Sequence@@polys,x]

Resultant[Sequence@@polys,x,Method->SylvesterMatrix]