# macaulayFormula -- Macaulay formula for the resultant

## Synopsis

• Usage:
macaulayFormula F
• Inputs:
• F, , a row matrix whose entries are $n+1$ homogeneous polynomials $F_0,\ldots,F_n$ in $n+1$ variables (or a list to be interpreted as such a matrix)
• Outputs:
• a pair of two square matrices $(D,D')$ such that the ratio of their determinants $det(D)/det(D')$ is the resultant of $F_0,\ldots,F_n$

## Description

This formula is stated in Theorem 4.9 of Using Algebraic Geometry, by David A. Cox, John Little, Donal O'shea.

 i1 : F = genericPolynomials {2,2,3} 2 2 2 2 2 o1 = {a x + a x x + a x + a x x + a x x + a x , b x + b x x + b x + 0 0 1 0 1 3 1 2 0 2 4 1 2 5 2 0 0 1 0 1 3 1 ------------------------------------------------------------------------ 2 3 2 2 3 2 b x x + b x x + b x , c x + c x x + c x x + c x + c x x + 2 0 2 4 1 2 5 2 0 0 1 0 1 3 0 1 6 1 2 0 2 ------------------------------------------------------------------------ 2 2 2 3 c x x x + c x x + c x x + c x x + c x } 4 0 1 2 7 1 2 5 0 2 8 1 2 9 2 o1 : List i2 : time (D,D') = macaulayFormula F -- used 0.013997 seconds o2 = (| a_0 a_1 a_2 a_3 a_4 a_5 0 0 0 0 0 0 0 0 0 0 0 | 0 a_0 0 a_1 a_2 0 a_3 a_4 a_5 0 0 0 0 0 0 0 0 | 0 0 a_0 0 a_1 a_2 0 a_3 a_4 a_5 0 0 0 0 0 0 0 | 0 0 0 a_0 0 0 a_1 a_2 0 0 a_3 a_4 a_5 0 0 0 0 | 0 0 0 0 a_0 0 0 a_1 a_2 0 0 a_3 a_4 a_5 0 0 0 | 0 0 0 0 0 a_0 0 0 a_1 a_2 0 0 a_3 a_4 a_5 0 0 | 0 0 0 0 0 0 a_0 0 0 0 a_1 a_2 0 0 0 a_3 a_4 | 0 0 0 0 0 0 0 a_0 0 0 0 a_1 a_2 0 0 0 a_3 | 0 0 0 0 0 0 0 0 a_0 0 0 0 a_1 a_2 0 0 0 | 0 0 0 0 0 0 0 0 0 a_0 0 0 0 a_1 a_2 0 0 | 0 0 0 b_0 0 0 b_1 b_2 0 0 b_3 b_4 b_5 0 0 0 0 | 0 0 0 0 b_0 0 0 b_1 b_2 0 0 b_3 b_4 b_5 0 0 0 | 0 0 0 0 0 b_0 0 0 b_1 b_2 0 0 b_3 b_4 b_5 0 0 | 0 c_0 0 c_1 c_2 0 c_3 c_4 c_5 0 c_6 c_7 c_8 c_9 0 0 0 | 0 0 c_0 0 c_1 c_2 0 c_3 c_4 c_5 0 c_6 c_7 c_8 c_9 0 0 | 0 0 0 0 0 0 b_0 0 0 0 b_1 b_2 0 0 0 b_3 b_4 | 0 0 0 0 0 0 0 b_0 0 0 0 b_1 b_2 0 0 0 b_3 | 0 0 0 0 0 0 0 0 b_0 0 0 0 b_1 b_2 0 0 0 | 0 0 0 0 0 0 0 0 0 b_0 0 0 0 b_1 b_2 0 0 | 0 0 0 0 c_0 0 0 c_1 c_2 0 0 c_3 c_4 c_5 0 0 c_6 | 0 0 0 0 0 c_0 0 0 c_1 c_2 0 0 c_3 c_4 c_5 0 0 ------------------------------------------------------------------------ 0 0 0 0 |, | a_0 a_1 a_2 0 0 |) 0 0 0 0 | | 0 a_0 0 0 0 | 0 0 0 0 | | 0 0 a_0 0 a_5 | 0 0 0 0 | | 0 0 0 a_0 a_3 | 0 0 0 0 | | 0 0 0 b_0 b_3 | 0 0 0 0 | a_5 0 0 0 | a_4 a_5 0 0 | a_3 a_4 a_5 0 | 0 a_3 a_4 a_5 | 0 0 0 0 | 0 0 0 0 | 0 0 0 0 | 0 0 0 0 | 0 0 0 0 | b_5 0 0 0 | b_4 b_5 0 0 | b_3 b_4 b_5 0 | 0 b_3 b_4 b_5 | c_7 c_8 c_9 0 | c_6 c_7 c_8 c_9 | o2 : Sequence i3 : F = {random(2,Grass(0,2)),random(2,Grass(0,2)),random(3,Grass(0,2))} 9 2 1 1 2 9 3 2 3 2 3 7 2 7 o3 = {-p + -p p + -p + -p p + p p + -p , -p + -p p + -p + -p p + 2 0 2 0 1 2 1 4 0 2 1 2 4 2 2 0 4 0 1 9 1 4 0 2 ------------------------------------------------------------------------ 7 1 2 7 3 7 2 3 2 2 3 2 5 2 --p p + -p , --p + -p p + -p p + -p + 7p p + -p p p + p p + 10 1 2 2 2 10 0 3 0 1 7 0 1 3 1 0 2 2 0 1 2 1 2 ------------------------------------------------------------------------ 6 2 2 3 -p p + 2p p + 6p } 7 0 2 1 2 2 o3 : List i4 : time (D,D') = macaulayFormula F -- used 0.00563083 seconds o4 = (| 9/2 1/2 9/4 1/2 1 3/4 0 0 0 0 0 0 0 0 0 | 0 9/2 0 1/2 9/4 0 1/2 1 3/4 0 0 0 0 0 0 | 0 0 9/2 0 1/2 9/4 0 1/2 1 3/4 0 0 0 0 0 | 0 0 0 9/2 0 0 1/2 9/4 0 0 1/2 1 3/4 0 0 | 0 0 0 0 9/2 0 0 1/2 9/4 0 0 1/2 1 3/4 0 | 0 0 0 0 0 9/2 0 0 1/2 9/4 0 0 1/2 1 3/4 | 0 0 0 0 0 0 9/2 0 0 0 1/2 9/4 0 0 0 | 0 0 0 0 0 0 0 9/2 0 0 0 1/2 9/4 0 0 | 0 0 0 0 0 0 0 0 9/2 0 0 0 1/2 9/4 0 | 0 0 0 0 0 0 0 0 0 9/2 0 0 0 1/2 9/4 | 0 0 0 3/2 0 0 3/4 7/4 0 0 7/9 7/10 1/2 0 0 | 0 0 0 0 3/2 0 0 3/4 7/4 0 0 7/9 7/10 1/2 0 | 0 0 0 0 0 3/2 0 0 3/4 7/4 0 0 7/9 7/10 1/2 | 0 7/10 0 7/3 7 0 3/7 5/2 6/7 0 2/3 1 2 6 0 | 0 0 7/10 0 7/3 7 0 3/7 5/2 6/7 0 2/3 1 2 6 | 0 0 0 0 0 0 3/2 0 0 0 3/4 7/4 0 0 0 | 0 0 0 0 0 0 0 3/2 0 0 0 3/4 7/4 0 0 | 0 0 0 0 0 0 0 0 3/2 0 0 0 3/4 7/4 0 | 0 0 0 0 0 0 0 0 0 3/2 0 0 0 3/4 7/4 | 0 0 0 0 7/10 0 0 7/3 7 0 0 3/7 5/2 6/7 0 | 0 0 0 0 0 7/10 0 0 7/3 7 0 0 3/7 5/2 6/7 ------------------------------------------------------------------------ 0 0 0 0 0 0 |, | 9/2 1/2 9/4 0 0 |) 0 0 0 0 0 0 | | 0 9/2 0 0 0 | 0 0 0 0 0 0 | | 0 0 9/2 0 3/4 | 0 0 0 0 0 0 | | 0 0 0 9/2 1/2 | 0 0 0 0 0 0 | | 0 0 0 3/2 7/9 | 0 0 0 0 0 0 | 1/2 1 3/4 0 0 0 | 0 1/2 1 3/4 0 0 | 0 0 1/2 1 3/4 0 | 0 0 0 1/2 1 3/4 | 0 0 0 0 0 0 | 0 0 0 0 0 0 | 0 0 0 0 0 0 | 0 0 0 0 0 0 | 0 0 0 0 0 0 | 7/9 7/10 1/2 0 0 0 | 0 7/9 7/10 1/2 0 0 | 0 0 7/9 7/10 1/2 0 | 0 0 0 7/9 7/10 1/2 | 0 2/3 1 2 6 0 | 0 0 2/3 1 2 6 | o4 : Sequence i5 : assert(det D == (resultant F) * (det D'))