### 11.2.13 Sylvester matrix of two polynomials and resultant

Given two polynomials A(x)=∑i=0i=n aixi and B(x)=∑i=0i=mbixi, their Sylvester matrix is a square matrix of size m+n where m=degree(B) and n=degree(A). The m first lines are made with the coefficients of A, so that:

⎡
⎢
⎢
⎢
⎣

s11=an | s12=an−1 | ⋯ | s1(n+1)=a0 | 0 | ⋯ | 0
s21=0 | s22=an | ⋯ | s2(n+1)=a1 | s2(n+2)=a0 | ⋯ | 0
⋮ | ⋮ | ⋮ | ⋱ | ⋮ | ⋱ | ⋮
sm1=0 | sm2=0 | ⋯ | sm(n+1)=am−1 | sm(n+2)=am−2 | ⋯ | a0

⎤
⎥
⎥
⎥
⎦

and the n further lines are made with the coefficients of B, so that:

⎡
⎢
⎢
⎣

s(m+1)1=bm | s(m+1)2=bm−1 | ⋯ | s(m+1)(m+1)=b0 | 0 | ⋯ | 0
⋮ | ⋮ | ⋮ | ⋱ | ⋮ | ⋱ | ⋮
s(m+n)1=0 | s(m+n)2=0 | ⋯ | s(m+n)(m+1)=bn−1 | bn−2 | ⋯ | b0

⎤
⎥
⎥
⎦

The determinant of a Sylvester polynomial is the resultant of the two polynomials. If A and B have integer coefficients with non-zero resultant r, then the polynomials equation

AU+BV=r

has a unique solution U,V such that degree(U)<degree(B) and degree(V)<degree(A), and this solution has integer coefficients.

##### Remark.

The discriminant of a polynomial is the resultant of the polynomial and its derivative.

The sylvester command computes Sylvester matrices.

- sylvester takes two arguments: P and Q, two polynomials.
- sylvester(P,Q) returns the Sylvester matrix of P and Q.

The resultant command computes the resultant of two polynomials.

- resultant takes three arguments:
  - P and Q, two polynomials.
  - x, a variable.
- resultant(P,Q,x) returns the resultant of P and Q.

#### Example

sylvester(x^3-p*x+q,3*x^2-p,x)

⎡
⎢
⎢
⎢
⎢
⎢
⎣

1 | 0 | −p | q | 0
0 | 1 | 0 | −p | q
3 | 0 | −p | 0 | 0
0 | 3 | 0 | −p | 0
0 | 0 | 3 | 0 | −p

⎤
⎥
⎥
⎥
⎥
⎥
⎦

det([[1,0,-p,q,0],[0,1,0,-p,q],[3,0,-p,0,0],[0,3,0,-p,0],[0,0,3,0,-p]])

−4 p3+27 q2 |  |  |  |  |  |  |  |  |  |

resultant(x^3-p*x+q,3*x^2-p,x)

−4 p3+27 q2 |  |  |  |  |  |  |  |  |  |

#### Examples using the resultant.

1. Let F1 and F2 be two fixed points in the plane and A be a variable point on the circle with center F1 and radius 2a. Find the cartesian equation of the set of points M, intersection of the line F1A and of the perpendicular bisector of F2A.
   Geometric solution.
     Since |MF1|+|MF2|=|MF1|+|MA|=|F1A|=2a, the point M is on an ellipse with focus F1,F2 and major axis 2a.
   Analytic solution.
     In the Cartesian coordinate system with center F1 and x-axis having the same direction as the vector F1F2, the coordinates of A are:

     A=(2acos(θ),2asin(θ))

     where θ is the (Ox,OA) angle. Now choose t=tan(θ/2) as parameter, so that the coordinates of A are rational functions with respect to t. More precisely:

     A=(ax,ay)=

     ⎛
     ⎜
     ⎜
     ⎝

     2a

     1−t2
     1+t2

     ,2a

     2t
     1+t2

     ⎞
     ⎟
     ⎟
     ⎠

     .

     If |F1F2|=2c and if I is the midpoint of AF2, then since the coordinates of F2 are F2=(2c,0), the coordinates of I are

     I=(c+ax/2;ay/2)=

     ⎛
     ⎜
     ⎜
     ⎝

     c+a

     1−t2
     1+t2

     ;a

     2t
     1+t2

     ⎞
     ⎟
     ⎟
     ⎠

     .

     IM is orthogonal to AF2, hence M=(x;y) satisfies the equation eq1=0 where

     eq1:=(x−ix)(ax−2c)+(y−iy)ay.

     But M=(x,y) is also on F1A, hence M satisfies the equation eq2=0 where

     eq2:=y/x−ay/ax.

     The resultant of both equations with respect to t, resultant(eq1,eq2,t), is a polynomial eq3 depending on the variables x,y, independent of t which is the cartesian equation of the set of points M when t varies.

     To obtain the resultant:

     ax:=2*a*(1-t^2)/(1+t^2);ay:=2*a*2*t/(1+t^2); ix:=(ax+2*c)/2; iy:=(ay/2); eq1:=(x-ix)*(ax-2*c)+(y-iy)*ay; eq2:=y/x-ay/ax; factor(resultant(eq1,eq2,t))

     −64(x2+y2)(x2 a2−x2 c2+−2 x a2 c+2 x c3−a4+2 a2 c2+a2 y2−c4) |  |  |  |  |  |  |  |  |  |

     The factor −64 (x2+y2) is always different from zero, hence the locus equation of M:

     x2a2−x2c2+−2xa2c+2xc3−a4+2a2c2+a2y2−c4=0.

     If the frame origin is O, the middle point of F1F2, then this is the cartesian equation of an ellipse. To make the change of origin F1M=F1O+OM:

     normal(subst(x^2*a^2-x^2*c^2+-2*x*a^2*c+2*x*c^3-a^4+2*a^2*c^2+a^2*y^2-c^4, [x,y]=[c+X,Y]))

     X2 a2−X2 c2+Y2 a2−a4+a2 c2 |  |  |  |  |  |  |  |  |  |

     or if b2=a2−c2:

     normal(subst(-c^2*X^2+c^2*a^2+X^2*a^2-a^4+a^2*Y^2,c^2=a^2-b^2))

     X2 b2+Y2 a2−a2 b2 |  |  |  |  |  |  |  |  |  |

     that is to say, after division by a2b2, M satisfies the equation

     X2
     a2

     +

     Y2
     b2

     =1.

2. Let F1 and F2 be fixed points and A a variable point on the circle with center F1 and radius 2a. Find the cartesian equation of the hull of D, the segment bisector of F2A.

   The segment bisector of F2A is tangent to the ellipse of focus F1,F2 and major axis 2a.

   In the Cartesian coordinate system with center F1 and x-axis having the same direction as the vector F1F2, the coordinates of A are:

   A=(2acos(θ);2asin(θ)),

   where θ is the (Ox,OA) angle. Choose t=tan(θ/2) as parameter such that the coordinates of A are rational functions with respect to t. More precisely:

   A=(ax;ay)=

   ⎛
   ⎜
   ⎜
   ⎝

   2a

   1−t2
   1+t2

   ;2a

   2t
   1+t2

   ⎞
   ⎟
   ⎟
   ⎠

   .

   If |F1F2|=2c and I is the midpoint of AF2:

   F2=(2c,0),I=(c+ax/2;ay/2)=

   ⎛
   ⎜
   ⎜
   ⎝

   c+a

   1−t2
   1+t2

   ;a

   2t
   1+t2

   ⎞
   ⎟
   ⎟
   ⎠

   .

   Since D is orthogonal to AF2, the equation of D is eq1=0 where

   eq1:=(x−ix)(ax−2c)+(y−iy)ay.

   So, the hull of D is the locus of M, the intersection point of D and D′ where D′ has equation eq2:=d/d t eq1=0.

   To obtain the resultant:

   ax:=2*a*(1-t^2)/(1+t^2);ay:=2*a*2*t/(1+t^2); ix:=(ax+2*c)/2; iy:=(ay/2); eq1:=normal((x-ix)*(ax-2*c)+(y-iy)*ay); eq2:=normal(diff(eq1,t)); factor(resultant(eq1,eq2,t))

   −64 a2(x2+y2)(x2 a2−x2 c2+−2 x a2c+ 2 x c3−a4+2 a2c2+a2y2−c4) |  |  |  |  |  |  |  |  |  |

   The factor −64 a2(x2+y2) is always different from zero, therefore the locus equation is:

   x2a2−x2c2−2xa2c+2xc3−a4+2a2c2+a2y2−c4=0

   If O, the midpoint of F1F2, is chosen as origin, you find again the cartesian equation of the ellipse:

   X2
   a2

   +

   Y2
   b2

   =1.