CS 829 Polynomial systems: geometry and algorithms Lecture 3: Euclid, resultant and 2 2 systems Éric Schost eschost@uwo.ca
Summary In this lecture, we start actual computations (as opposed to Lectures 1 and 2, where we discussed properties of univariate representations, but no any actual way to compute them). We discuss systems of 2 equations in 2 unknowns. These systems can be dealt with using resultants. Resultants can be computed using extensions of the Euclidean algorithm. The cost of resolution is O(d 2 M(d) log(d)), where M represents the cost of multiplying univariate polynomials, and d is the total degree of the input.
An overview of Euclid s algorithm
Euclid s algorithm Euclid s algorithm is used to compute GCD s in either Z of K[Y ]. By running it for random examples in K[X][Y ], we observe: that the remainders are in K(X)[Y ]; there are a lot of repetitions as denominators / common factors in numerators; once all the junk has been cleaned, we get most of the information that we need to solve the system. The resultant (and subresultants) are what is left once all the junk has been cleaned.
Euclid s algorithm Euclid s algorithm is used to compute GCD s in either Z of K[Y ]. By running it for random examples in K[X][Y ], we observe: that the remainders are in K(X)[Y ]; there are a lot of repetitions as denominators / common factors in numerators; once all the junk has been cleaned, we get most of the information that we need to solve the system. The resultant (and subresultants) are what is left once all the junk has been cleaned. In K[Y ], the complexity for degree-d inputs is O(d 2 ). This can be made faster, but the extension to K[X][Y ] will add a new layer of difficulties.
Intersection of plane curves
Common factors of univariate polynomials Let K be a field and let F, G be in K[Y ], with deg(f) = m, deg(g) = n. F and G have a common factor F G = B, deg(b) < m, deg(a) < n A
Common factors of univariate polynomials Let K be a field and let F, G be in K[X], with deg(f) = m, deg(g) = n. F and G have a common factor F G = B, deg(b) < m, deg(a) < n A AF BG = 0
Common factors of univariate polynomials Let K be a field and let F, G be in K[X], with deg(f) = m, deg(g) = n. F and G have a common factor F G = B, deg(b) < m, deg(a) < n A AF BG = 0 In other words, gcd(f, G) 1 if and only if the map φ : K[Y ] <n K[Y ] <m K[Y ] <m+n (A, B) AF + BG has a non-trivial kernel, where K[Y ] <l = {a 0 + + a l 1 Y l 1 } K l.
The Sylvester matrix The Sylvester matrix represents the previous application. With F = f m Y m + + f 0, G = g n Y n + + g 0, their Sylvester matrix is Syl(F, G) = n {}}{ f ṃ. f m. f m f 0...... f 0... m {}}{ g ṇ. g n. g n g 0...... g 0... f 0 g 0
Resultant Definition The resultant res(f, G) of F, G K[Y ] is the determinant of their Sylvester matrix.
Resultant Definition The resultant res(f, G) of F, G K[Y ] is the determinant of their Sylvester matrix. Proposition res(f, G) = 0 gcd(f, G) 1.
Resultant Definition The resultant res(f, G) of F, G K[Y ] is the determinant of their Sylvester matrix. Proposition res(f, G) = 0 gcd(f, G) 1. We extend the definition to polynomials F, G with coefficients in a ring R. (warning: GCD s do not really make sense over a general ring).
Resultant Definition The resultant res(f, G) of F, G K[Y ] is the determinant of their Sylvester matrix. Proposition res(f, G) = 0 gcd(f, G) 1. We extend the definition to polynomials F, G with coefficients in a ring R. (warning: GCD s do not really make sense over a general ring). Useful proposition Let ϕ be a morphism from a ring R to a ring S: ϕ(1) = 1, ϕ(a + b) = ϕ(a) + ϕ(b), ϕ(ab) = ϕ(a)ϕ(b).
Resultant Definition The resultant res(f, G) of F, G K[Y ] is the determinant of their Sylvester matrix. Proposition res(f, G) = 0 gcd(f, G) 1. We extend the definition to polynomials F, G with coefficients in a ring R. (warning: GCD s do not really make sense over a general ring). Useful proposition Let ϕ be a morphism from a ring R to a ring S: ϕ(1) = 1, ϕ(a + b) = ϕ(a) + ϕ(b), ϕ(ab) = ϕ(a)ϕ(b). If ϕ(f m )ϕ(g n ) 0, ϕ(res(f, G)) = res(ϕ(f), ϕ(g)).
Resultant Definition The resultant res(f, G) of F, G K[Y ] is the determinant of their Sylvester matrix. Proposition res(f, G) = 0 gcd(f, G) 1. We extend the definition to polynomials F, G with coefficients in a ring R. (warning: GCD s do not really make sense over a general ring). Useful proposition Let ϕ be a morphism from a ring R to a ring S: ϕ(1) = 1, ϕ(a + b) = ϕ(a) + ϕ(b), ϕ(ab) = ϕ(a)ϕ(b). If ϕ(f m )ϕ(g n ) 0 then ϕ(res(f, G)) = res(ϕ(f), ϕ(g)). If ϕ(f m ) 0 then ϕ(res(f, G)) = ϕ(f m ) deg(g) deg(ϕ(g)) res(ϕ(f), ϕ(g)).
Resultant Definition The resultant res(f, G) of F, G K[Y ] is the determinant of their Sylvester matrix. Proposition res(f, G) = 0 gcd(f, G) 1. We extend the definition to polynomials F, G with coefficients in a ring R. (warning: GCD s do not really make sense over a general ring). Useful proposition Let ϕ be a morphism from a ring R to a ring S: ϕ(1) = 1, ϕ(a + b) = ϕ(a) + ϕ(b), ϕ(ab) = ϕ(a)ϕ(b). If ϕ(f m )ϕ(g n ) 0 then ϕ(res(f, G)) = res(ϕ(f), ϕ(g)). If ϕ(f m ) 0 then ϕ(res(f, G)) = ϕ(f m ) deg(g) deg(ϕ(g)) res(ϕ(f), ϕ(g)). Examples R = Z and ϕ(k) = K mod p,
Resultant Definition The resultant res(f, G) of F, G K[Y ] is the determinant of their Sylvester matrix. Proposition res(f, G) = 0 gcd(f, G) 1. We extend the definition to polynomials F, G with coefficients in a ring R. (warning: GCD s do not really make sense over a general ring). Useful proposition Let ϕ be a morphism from a ring R to a ring S: ϕ(1) = 1, ϕ(a + b) = ϕ(a) + ϕ(b), ϕ(ab) = ϕ(a)ϕ(b). If ϕ(f m )ϕ(g n ) 0 then ϕ(res(f, G)) = res(ϕ(f), ϕ(g)). If ϕ(f m ) 0 then ϕ(res(f, G)) = ϕ(f m ) deg(g) deg(ϕ(g)) res(ϕ(f), ϕ(g)). Examples R = Z and ϕ(k) = K mod p, R = K[X] and ϕ(p(x)) = P(x) = P mod (X x).
Let F, G be in K[X, Y ]: Application to the intersection of curves F = m f i (X)Y i G = i=0 n g i (X)Y i. i=0
Let F, G be in K[X, Y ]: Application to the intersection of curves F = m f i (X)Y i G = i=0 n g i (X)Y i. i=0 If they have no common factor in K[X, Y ], then in K [Y ], with K = K(X), we have gcd(f, G) = 1. Hence, R = res Y (F, G) K[X] is not zero.
Let F, G be in K[X, Y ]: Application to the intersection of curves F = m f i (X)Y i G = i=0 n g i (X)Y i. i=0 If they have no common factor in K[X, Y ], then in K [Y ], with K = K(X), we have gcd(f, G) = 1. Hence, R = res Y (F, G) K[X] is not zero. Proposition. Let x be in K. Then R(x) = 0 if and only if f m (x) = g n (x) = 0 or there exists y such that F(x, y) = G(x, y) = 0.
Let F, G be in K[X, Y ]: Application to the intersection of curves F = m f i (X)Y i G = i=0 n g i (X)Y i. i=0 If they have no common factor in K[X, Y ], then in K [Y ], with K = K(X), we have gcd(f, G) = 1. Hence, R = res Y (F, G) K[X] is not zero. Proposition. Let x be in K. Then R(x) = 0 if and only if f m (x) = g n (x) = 0 or there exists y such that F(x, y) = G(x, y) = 0. Proof. If f m (x) = g n (x) = 0, R(x) = 0. Suppose now that e.g. f m (x) 0. Then R(x) = f m (x) k res(f(x, Y ), G(x, Y )), so R(x) = 0 if and only if F(x, Y ) and G(x, Y ) have a common factor.
A degenerate example Consider F = X 2 Y + X + 1, G = XY 1 whose resultant with respect to Y is R = X(2X + 1). The root x = 0 of R does not correspond to any root of the system F(X, Y ) = G(X, Y ) = 0 (or so it seems...)
Let F 0 be in K[X, Y ]: Curves in generic position F = F 0 (X) + + F m (X)Y m. The curve C = V (F) is in Noether position (for the order Y > X) if F m is a constant. NO YES When not in Noether position, values of x where F m (x) = 0 correspond to points going to infinity above x (more on this later).
Let F 0 be in K[X, Y ]: Curves in generic position F = F 0 (X) + + F m (X)Y m. The curve C = V (F) is in Noether position (for the order Y > X) if F m is a constant. Proposition. For a generic change of variable X = X + αy, the curve C is in Noether position (but the degree in Y may change!)
Let F 0 be in K[X, Y ]: Curves in generic position F = F 0 (X) + + F m (X)Y m. The curve C = V (F) is in Noether position (for the order Y > X) if F m is a constant. Proposition. For a generic change of variable X = X + αy, the curve C is in Noether position (but the degree in Y may change!) Proof. Let d be the total degree of F and let H be the homogeneous part of degree d of F. Write H = h i X i Y d i.
Let F 0 be in K[X, Y ]: Curves in generic position F = F 0 (X) + + F m (X)Y m. The curve C = V (F) is in Noether position (for the order Y > X) if F m is a constant. Proposition. For a generic change of variable X = X + αy, the curve C is in Noether position (but the degree in Y may change!) Proof. Let d be the total degree of F and let H be the homogeneous part of degree d of F. Write H = h i X i Y d i. Then H(X + αy, Y ) = h i (X + αy ) i Y d i = Y d h i α i +
Let F 0 be in K[X, Y ]: Curves in generic position F = F 0 (X) + + F m (X)Y m. The curve C = V (F) is in Noether position (for the order Y > X) if F m is a constant. Proposition. For a generic change of variable X = X + αy, the curve C is in Noether position (but the degree in Y may change!) Proof. Let d be the total degree of F and let H be the homogeneous part of degree d of F. Write H = h i X i Y d i. Then H(X + αy, Y ) = h i (X + αy ) i Y d i = Y d h i α i + So it suffices that α is not a root of h i A i.
Let F 0 be in K[X, Y ]: Curves in generic position F = F 0 (X) + + F m (X)Y m. The curve C = V (F) is in Noether position (for the order Y > X) if F m is a constant. Proposition. For a generic change of variable X = X + αy, the curve C is in Noether position (but the degree in Y may change!) Proposition. When this is the case, the roots of the resultant of F, G are exactly the X -coordinates of the solutions.
Finiteness of the solution set Proposition. Let F, G be in K[X, Y ] with a common factor. Then V (F, G) is finite.
Finiteness of the solution set Proposition. Let F, G be in K[X, Y ] with a common factor. Then V (F, G) is finite. Proof. Suppose that the curves C = V (F) and C = V (G) are both in Noether position.
Finiteness of the solution set Proposition. Let F, G be in K[X, Y ] with a common factor. Then V (F, G) is finite. Proof. Suppose that the curves C = V (F) and C = V (G) are both in Noether position. Let R K[X] be the resultant of F and G with respect to Y, so that R 0. Each solution of F(x, y) = G(x, y) = 0 satisfies R(x) = 0.
Finiteness of the solution set Proposition. Let F, G be in K[X, Y ] with a common factor. Then V (F, G) is finite. Proof. Suppose that the curves C = V (F) and C = V (G) are both in Noether position. Let R K[X] be the resultant of F and G with respect to Y, so that R 0. Each solution of F(x, y) = G(x, y) = 0 satisfies R(x) = 0. R has a finite number of roots.
Finiteness of the solution set Proposition. Let F, G be in K[X, Y ] with a common factor. Then V (F, G) is finite. Proof. Suppose that the curves C = V (F) and C = V (G) are both in Noether position. Let R K[X] be the resultant of F and G with respect to Y, so that R 0. Each solution of F(x, y) = G(x, y) = 0 satisfies R(x) = 0. R has a finite number of roots. For any root x of R, there is a finite number of y such that F(x, y) = 0.
Curves in generic position, continued Proposition. Let F, G be in K[X, Y ] with a common factor, of total degrees at most d. For a generic choice of X = X αy, X is a separating element for V = V (F, G).
Curves in generic position, continued Proposition. Let F, G be in K[X, Y ] with a common factor, of total degrees at most d. For a generic choice of X = X αy, X is a separating element for V = V (F, G). Proof. Let {(x i, y i )} i N be the finite set of common solutions.
Curves in generic position, continued Proposition. Let F, G be in K[X, Y ] with a common factor, of total degrees at most d. For a generic choice of X = X αy, X is a separating element for V = V (F, G). Proof. Let {(x i, y i )} i N be the finite set of common solutions. Through the change of variables X = X αy, the solution set becomes {x i αy i, y i } i N.
Curves in generic position, continued Proposition. Let F, G be in K[X, Y ] with a common factor, of total degrees at most d. For a generic choice of X = X αy, X is a separating element for V = V (F, G). Proof. Let {(x i, y i )} i N be the finite set of common solutions. Through the change of variables X = X αy, the solution set becomes {x i αy i, y i } i N. Let (A) = i j(x i x i) A(y i y ). X is separating if and only if (α) 0.
Cardinality of the intersection Proposition. Let F, G be in K[X, Y ] with a common factor, of total degrees at most d. Then V (F, G) has cardinality at most d 2.
Cardinality of the intersection Proposition. Let F, G be in K[X, Y ] with a common factor, of total degrees at most d. Then V (F, G) has cardinality at most d 2. Proof. By a generic change of variables, we can suppose that X is a separating element for V = V (F, G) and that the curves are in Noether position.
Cardinality of the intersection Proposition. Let F, G be in K[X, Y ] with a common factor, of total degrees at most d. Then V (F, G) has cardinality at most d 2. Proof. By a generic change of variables, we can suppose that X is a separating element for V = V (F, G) and that the curves are in Noether position. This does not change the total degree, or the number of solutions!
Cardinality of the intersection Proposition. Let F, G be in K[X, Y ] with a common factor, of total degrees at most d. Then V (F, G) has cardinality at most d 2. Proof. By a generic change of variables, we can suppose that X is a separating element for V = V (F, G) and that the curves are in Noether position. This does not change the total degree, or the number of solutions! Then, then number of solutions of the system is bounded by the degree of R = res Y (F, G).
Cardinality of the intersection Proposition. Let F, G be in K[X, Y ] with a common factor, of total degrees at most d. Then V (F, G) has cardinality at most d 2. Proof. By a generic change of variables, we can suppose that X is a separating element for V = V (F, G) and that the curves are in Noether position. This does not change the total degree, or the number of solutions! Then, then number of solutions of the system is bounded by the degree of R = res Y (F, G). The resultant R is the determinant of a matrix of size 2d, with entries of degree at most d. So deg(r) 2d 2.
Cardinality of the intersection Proposition. Let F, G be in K[X, Y ] with a common factor, of total degrees at most d. Then V (F, G) has cardinality at most d 2. Proof. By a generic change of variables, we can suppose that X is a separating element for V = V (F, G) and that the curves are in Noether position. This does not change the total degree, or the number of solutions! Then, then number of solutions of the system is bounded by the degree of R = res Y (F, G). The resultant R is the determinant of a matrix of size 2d, with entries of degree at most d. So deg(r) 2d 2. Exercise. Work out the bound d 2 by looking more carefully at the matrix.
Some properties of the resultant
Properties of the resultant Theorem. Let f, u 1,...,u m and g, v 1,...,v n be new variables and F = f(x u 1 ) (X u m ), G = g(x v 1 ) (X v n ). Then R := res(f, G) = f n g m i (u i v j ). j Proof. Let F i,j = subs(u i = v j, F). Then res(f i,j, G) = 0 but also res(f i,j, G) = subs(u i = v j, R). Hence, R is divisible by all (u i v j ). Working a little bit more (counting degrees and checking the leading terms) finishes the proof.
Properties of the resultant Theorem. Let F, G be in K[X] with factorization in K: F = f(x u 1 ) (X u m ), G = g(x v 1 ) (X v n ). Then Proof. Specialization properties. R := res(f, G) = f n g m i (u i v j ). j Corollary res(f, GH) = res(f, G)res(F, H). Proof. True for polynomials with coefficients in a field (cf. above). What about more general cases? It is enough to prove it for polynomials with generic coefficients F = f 0 + + f m X m, G = g 0 + + g n X n, H = h 0 + + h l X l. Because then we can use specialization properties. What we want to prove is that a big polynomial in Z[f i, g j, h k ] is identically zero. Since vanishes for all possible evaluations in e.g. Q, it is zero.
Properties of the resultant Theorem. Let F, G be in K[X] with factorization in K: F = f(x u 1 ) (X u m ), G = g(x v 1 ) (X v n ). Then R := res(f, G) = f n g m i (u i v j ). j Proof. Specialization properties. Corollary res(f, GH) = res(f, G)res(F, H). Corollary For F, G with coefficients in a field, R := res(f, G) = f n F(u i )=0 G(u i ).
Properties of the resultant Theorem. Let F, G be in K[X] with factorization in K: F = f(x u 1 ) (X u m ), G = g(x v 1 ) (X v n ). Then Proof. Specialization properties. R := res(f, G) = f n g m i (u i v j ). j Corollary res(f, GH) = res(f, G)res(F, H). Corollary For F, G with coefficients in a field, R := res(f, G) = f n F(u i )=0 G(u i ). Corollary For F, G with coefficients in a field, res(f, G) = ( 1) deg(f) deg(g) LeadCoeff(G) deg(f) deg(r) res(g, R), for R such that F = QG + R.
Computing resultants
Euclid s algorithm Input: F, G in K[Y ]. F 1 := F; F 2 := G; i := 2; while F i <> 0 F i+1 := F i 1 mod F i ; i++; return F i 1 ;
Euclid s algorithm Input: F, G in K[Y ]. F 1 := F; F 2 := G; i := 2; while F i <> 0 F i+1 := F i 1 mod F i ; i++; return F i 1 ; Complexity. Euclidean division in degrees n m has cost O((n m)m); With d i = deg F i, Euclid s algorithm has cost (up to big-oh) (d i 1 d i )d i d 1 (d i 1 d i ) d 2 1. i 2 i
Euclid s algorithm for resultant in K[Y ] Input: F, G in K[Y ]. F 1 := F; F 2 := G; i := 2; R 1 := 1; while deg(f i ) > 0 F i+1 := F i 1 mod F i ; R i := ( 1) d id i 1 LeadCoeff(F i ) d i 1 d i R i 1 ; i++; if F i <> 0 return R i 1 LeadCoeff(F i ) deg(fi 1). else return 0;
Euclid s algorithm for resultant in K[Y ] Correctness As long as deg(f i ) > 0, res(f, G) = R i res(f i, F i+1 ) (by induction). When deg(f i ) 0: If F i = 0, res(f i 1, F i ) = 0 Else, res(f i 1, F i ) is LeadCoeff(F i ) deg(fi 1).
Euclid s algorithm for resultant in K[Y ] Correctness As long as deg(f i ) > 0, res(f, G) = R i res(f i, F i+1 ) (by induction). When deg(f i ) 0: If F i = 0, res(f i 1, F i ) = 0 Else, res(f i 1, F i ) is LeadCoeff(F i ) deg(fi 1). Complexity Still O(d 2 ).
Resultants of bivariate polynomials Euclid s algorithm in K(Y )[X] creates huge intermediate polynomials. With inputs of total degree d: It takes some work (introducing subresultants) to prove that all intermediate degrees are in O(d 4 ). However, the output we want is a single univariate polynomial of degree d 2.
Resultants of bivariate polynomials Euclid s algorithm in K(Y )[X] creates huge intermediate polynomials. With inputs of total degree d: It takes some work (introducing subresultants) to prove that all intermediate degrees are in O(d 4 ). However, the output we want is a single univariate polynomial of degree d 2. Two workarounds: Understand, predict and pre-clean the common factors and denominators; Use a modular algorithm.
Modular algorithm, plain version Input: F, G in K[X, Y ] of total degrees d. Compute res(f(c, Y ), G(c, Y )) for d 2 + 1 values of c (which do not cancel a leading term); Interpolate the result.
Modular algorithm, plain version Input: F, G in K[X, Y ] of total degrees d. Compute res(f(c, Y ), G(c, Y )) for d 2 + 1 values of c (which do not cancel a leading term); Interpolate the result. Complexity. O(d 2 d 2 ) + O(Cost interpolation (d 2 )) O(d 4 ) (proof upcoming).
Interpolating polynomials Given a 0,...,a l pairwise distinct sample points and values v 0,...,v l, the unique polynomial F such that F(a i ) = v i is l i=0 v i j i (X a j) j i (a i a j )
Interpolating polynomials Given a 0,...,a l pairwise distinct sample points and values v 0,...,v l, the unique polynomial F such that F(a i ) = v i is To compute it: Compute M = i (X a i), Deduce all j i (X a j), Deduce all j i (a i a j ), Combine everybody, for a cost of O(l 2 ). l i=0 j i v (X a j) i j i (a i a j )
Switching to fast algorithms
Speeding things up Let M(d) denote the cost of polynomial multiplication in degree d: M(d) O(d 2 ) for a naive algorithm M(d) O(d log d) using Fast Fourier Transform (if the field has roots of 1) M(d) O(d log d log log d) using Fast Fourier Transform in general. Technically, we ask M(d + d ) M(d) + M(d ).
Speeding things up Let M(d) denote the cost of polynomial multiplication in degree d: M(d) O(d 2 ) for a naive algorithm M(d) O(d log d) using Fast Fourier Transform (if the field has roots of 1) M(d) O(d log d log log d) using Fast Fourier Transform in general. Technically, we ask M(d + d ) M(d) + M(d ). Using the fact that Euclidean division can be made in time O(M(d)), both parts can be made faster: Euclid s algorithm: divide-and-conquer and half-gcd techniques, O(d 2 M(d) log(d)) Interpolation using subproduct trees techniques. O(M(d 2 ) log(d))
FFT in a nutshell Suppose you want to evaluate F(X) C[X] at all N-roots of 1 with deg(f) < N. 1, exp 2iπ N, exp 4iπ N,...,exp 2(N 1)iπ N,
FFT in a nutshell Suppose you want to evaluate F(X) C[X] at all N-roots of 1 with deg(f) < N. 1, exp 2iπ N, exp 4iπ N,...,exp 2(N 1)iπ N, Write F = F even (X 2 ) + XF odd (X 2 ). Then with N = N/2. F(exp 2ikπ N ) = F even(exp 2ikπ ) + 2ikπ N N F odd(exp 2ikπ ), N
FFT in a nutshell Suppose you want to evaluate F(X) C[X] at all N-roots of 1 with deg(f) < N. 1, exp 2iπ N, exp 4iπ N,...,exp 2(N 1)iπ N, Write F = F even (X 2 ) + XF odd (X 2 ). Then with N = N/2. So it suffices to F(exp 2ikπ N ) = F even(exp 2ikπ ) + 2ikπ N N F odd(exp 2ikπ ), N F even at all N -roots of 1; F odd at all N -roots of 1; combine the values.
FFT in a nutshell Suppose you want to evaluate F(X) C[X] at all N-roots of 1 with deg(f) < N. 1, exp 2iπ N, exp 4iπ N,...,exp 2(N 1)iπ N, Write F = F even (X 2 ) + XF odd (X 2 ). Then with N = N/2. So it suffices to F(exp 2ikπ N ) = F even(exp 2ikπ ) + 2ikπ N N F odd(exp 2ikπ ), N F even at all N -roots of 1; F odd at all N -roots of 1; combine the values. The complexity satisfies T(N) 2T(N/2) + CN so T(N) O(N log N).
FFT in a nutshell Proposition The inverse FFT can be performed for the same cost as the direct FFT. Corollary One can multiply F(X), G(X) C[X], both of them having degree < N, in O(N log N) operations Evaluate F and G at 2N-th roots of 1 Multiply the values Do inverse-fft to interpolate the product FG. Extension to any field having roots of unity.
Towards a fast Euclidean algorithm We want to make Euclid s algorithm faster, reducing its complexity to O(M(d) log(d)). Warning! Computing all intermediate remainders is too slow (the total number of coefficients is d 2 ). Workaround: Work with the quotients Q i such that F i 1 = Q i F i + F i+1 Main idea: knowing Q i makes it possible to do a single step F i = 0 1 F i 1 1 Q i F i F i+1
Towards a fast Euclidean algorithm We want to make Euclid s algorithm faster, reducing its complexity to O(M(d) log(d)). Warning! Computing all intermediate remainders is too slow (the total number of coefficients is d 2 ). Workaround: Work with the quotients Q i such that F i 1 = Q i F i + F i+1 Main idea: knowing Q i makes it possible to do a single step F i = 0 1 F i 1 F i+1 1 Q i F i One can do several steps at once: F j 1 = 0 1 0 1 F i 1 F j 1 Q j 1 Q i F i
Towards a fast Euclidean algorithm We want to make Euclid s algorithm faster, reducing its complexity to O(M(d) log(d)). Warning! Computing all intermediate remainders is too slow (the total number of coefficients is d 2 ). Workaround: Work with the quotients Q i such that F i 1 = Q i F i + F i+1 Main idea: knowing Q i makes it possible to do a single step F i = 0 1 F i 1 F i+1 1 Q i F i One can do several steps at once: F j 1 F j = M[i j] F i 1 F i
Half GCD: specifications and applications Let F, G K[Y ] with d = deg F > deg G, and let F 1 = F, F 2 = G,...,F N = 0 be the remainders met during Euclid s algorithm.
Half GCD: specifications and applications Let F, G K[Y ] with d = deg F > deg G, and let F 1 = F, F 2 = G,...,F N = 0 be the remainders met during Euclid s algorithm. There exists a unique l such that deg(f l 1 ) d/2 > deg(f l ).
Half GCD: specifications and applications Let F, G K[Y ] with d = deg F > deg G, and let F 1 = F, F 2 = G,...,F N = 0 be the remainders met during Euclid s algorithm. There exists a unique l such that deg(f l 1 ) d/2 > deg(f l ). The half-gcd algorithm compute the matrix M[2 l], so that F l 1 F l = M[2 l] F 1. F 2
Half GCD: specifications and applications Let F, G K[Y ] with d = deg F > deg G, and let F 1 = F, F 2 = G,...,F N = 0 be the remainders met during Euclid s algorithm. There exists a unique l such that deg(f l 1 ) d/2 > deg(f l ). The half-gcd algorithm compute the matrix M[2 l], so that F l 1 F l If F l = 0, F l 1 is the GCD, = M[2 l] F 1. F 2
Half GCD: specifications and applications Let F, G K[Y ] with d = deg F > deg G, and let F 1 = F, F 2 = G,...,F N = 0 be the remainders met during Euclid s algorithm. There exists a unique l such that deg(f l 1 ) d/2 > deg(f l ). The half-gcd algorithm compute the matrix M[2 l], so that F l 1 F l If F l = 0, F l 1 is the GCD, = M[2 l] F 1. Else, compute F l+1 (to be sure that all degrees are < d/2), and continue with F l, F l+1. F 2
Extension to resultant computation Suppose that the half-gcd algorithm outputs as well: the leading coefficients of F 1,...,F l and their degrees.
Extension to resultant computation Suppose that the half-gcd algorithm outputs as well: the leading coefficients of F 1,...,F l and their degrees. Then collecting the leading coefficients and degree of F l+1, we get a recursive algorithm for computing all leading coeffcients and their degrees.
Extension to resultant computation Suppose that the half-gcd algorithm outputs as well: the leading coefficients of F 1,...,F l and their degrees. Then collecting the leading coefficients and degree of F l+1, we get a recursive algorithm for computing all leading coeffcients and their degrees. This leads to the resultant (cf. formula in the plain version).
Extension to resultant computation Suppose that the half-gcd algorithm outputs as well: the leading coefficients of F 1,...,F l and their degrees. Then collecting the leading coefficients and degree of F l+1, we get a recursive algorithm for computing all leading coeffcients and their degrees. This leads to the resultant (cf. formula in the plain version). Complexity Cost resultant (d) Cost Half gcd (d)+o(m(d))+cost Euclidean division (d)+cost resultant (d/2)
Extension to resultant computation Suppose that the half-gcd algorithm outputs as well: the leading coefficients of F 1,...,F l and their degrees. Then collecting the leading coefficients and degree of F l+1, we get a recursive algorithm for computing all leading coeffcients and their degrees. This leads to the resultant (cf. formula in the plain version). Complexity Cost resultant (d) Cost Half gcd (d) + CM(d) + Cost resultant (d/2)
Extension to resultant computation Suppose that the half-gcd algorithm outputs as well: the leading coefficients of F 1,...,F l and their degrees. Then collecting the leading coefficients and degree of F l+1, we get a recursive algorithm for computing all leading coeffcients and their degrees. This leads to the resultant (cf. formula in the plain version). Complexity Cost resultant (d) Cost Half gcd (d) + CM(d) + Cost resultant (d/2) so Cost resultant (d) O(Cost Half gcd (d) + M(d))
The idea of half-gcd Intuition 1. In the first steps of the Euclidean algorithm, the quotients do not depend on the lower degree terms. X 1000 + X 999 + = (X + 2)(X 999 X 998 + ) + R
The idea of half-gcd Intuition 1. In the first steps of the Euclidean algorithm, the quotients do not depend on the lower degree terms. X 1000 + X 999 + = (X + 2)(X 999 X 998 + ) + R Intuition 2. The degrees of the remainders decrease by one at each step and the quotients have degree 1.
The idea of half-gcd Intuition 1. In the first steps of the Euclidean algorithm, the quotients do not depend on the lower degree terms. X 1000 + X 999 + = (X + 2)(X 999 X 998 + ) + R Intuition 2. The degrees of the remainders decrease by one at each step and the quotients have degree 1. Hence, a transition matrix of degree l yields remainders of degree d l.
The idea of half-gcd Intuition 1. In the first steps of the Euclidean algorithm, the quotients do not depend on the lower degree terms. X 1000 + X 999 + = (X + 2)(X 999 X 998 + ) + R Intuition 2. The degrees of the remainders decrease by one at each step and the quotients have degree 1. Hence, a transition matrix of degree l yields remainders of degree d l. Intuition 3. The half-gcd matrix of F 1, F 2 has entries of degrees d/2.
The idea of half-gcd Intuition 1. In the first steps of the Euclidean algorithm, the quotients do not depend on the lower degree terms. X 1000 + X 999 + = (X + 2)(X 999 X 998 + ) + R Intuition 2. The degrees of the remainders decrease by one at each step and the quotients have degree 1. Hence, a transition matrix of degree l yields remainders of degree d l. Intuition 3. The half-gcd matrix of F 1, F 2 has entries of degrees d/2. Intuition 4. Let m d/2 and G i = F i div X m. Then the half-gcd matrix of G 1, G 2 has entries of degrees m/2. So applying it to F 1, F 2 gives remainders of degrees d m/2 3d/4.
The half-gcd (sketch) Input F 1, F 2 with d := deg(f 1 ) > deg(f 2 ) and m := d/2. M := halfgcd(f 1 div X m, F 2 div X m ); [F 0, F 1] t := M[F 1, F 2 ] t ; Q := F 0 quo F 1; F 2 := F 0 QF 1; N = halfgcd(f 1 div X m, F 2 div X m ); return N [ 0 1 1 Q] M;
The half-gcd (sketch) Input F 1, F 2 with d := deg(f 1 ) > deg(f 2 ) and m := d/2. M := halfgcd(f 1 div X m, F 2 div X m ); [F 0, F 1] t := M[F 1, F 2 ] t ; Q := F 0 quo F 1; F 2 := F 0 QF 1; N = halfgcd(f 1 div X m, F 2 div X m ); return N [ 0 1 1 Q] M; Remark. The actual algorithm is slightly more subtle (early exits, more precise choice in the degrees) Complexity. Cost halfgcd (d) 2Cost halfgcd (d/2) + CM(d) so Cost halfgcd (d) O(M(d) log(d)).
The half-gcd (sketch) Input F 1, F 2 with d := deg(f 1 ) > deg(f 2 ) and m := d/2. M := halfgcd(f 1 div X m, F 2 div X m ); [F 0, F 1] t := M[F 1, F 2 ] t ; Q := F 0 quo F 1; F 2 := F 0 QF 1; N = halfgcd(f 1 div X m, F 2 div X m ); return N [ 0 1 1 Q] M; Remark. The actual algorithm is slightly more subtle (early exits, more precise choice in the degrees) Complexity. Cost halfgcd (d) 2Cost halfgcd (d/2) + CM(d) so Cost halfgcd (d) O(M(d) log(d)) and Cost resultant (d) O(M(d) log(d)).