• No results found

Brown’s subresultant algorithm

To compute the GCD of two univariate polynomials over a domain, the polynomial remainder sequence (PRS) derived from the Euclidean algorithm suffers from the phenomenon of explosive coefficient growth, which fortunately is not inherent to the problem. The key to controlling coefficient growth is the discovery of subresultants, where each subresultant is in fact proportional to a polynomial in the PRS, [10, 11, 17]. The specialization property of subresultants makes it possible to apply modular techniques, while this property does not hold for a PRS.

In Algorithm 7, we list the subresultant algorithm of Brown [10] for two univariate polynomials over a field. This algorithm preallocates space for all subresultants and initialize them to zero. Then, this algorithm writes the nonzero subresultants, until it exists from the loop or detects termination at Line 7. The loop condition checks whether all remaining subresultants are zero or not, and Line 7 checks whether all subresultants are computed (the last one has index 0).

In total, there are at most deg(G) iterations from Line 3 to Line 8, since each iteration produces at least one new subresultant. The loop invariant is

A is a regular subresultant with A=Sd,B =Sd−1, and δ ≥1. 4

At Line 8, the algorithm advances one step by replacingB with a proper multiple of

prem(A,B, x) and replacing A with Se. If δ= 1 at Line 6, then we have Sd−1 =Se which implies that no new subresultant has been produced in this step.

Algorithm 7: Brown’s subresultant algorithm

Input : polynomials F, G∈k[x] such thatdeg(F)≥deg(G)>0

Output: the subresultant chain of F and G 1 Si ←0 for 0≤i <deg(G)

2 B ←prem(F,−G, x), A←G, α←deg(F)−deg(G) 3 while B 6= 0 do 4 d←deg(A), e←deg(B),δ ←d−e 5 Sd1 ←B 6 Se ←lc(A)α(1−δ)lc(B)δ−1B 7 if e= 0 then break 8 B ←lc(A)−αδ−1prem(A,−B, x), A←Se, α←1 9 return Si for 0≤i <deg(G)

4

For convenience, we regard the input polynomialG as a regular subresultant of indexdeg(G). SubresultantSd−1 might not be a regular subresultant, i.e, δ=d−e >1.

Example 23. Consider univariate polynomials

F = 5x5+ 4x4+ 2x2+ 3x3+x and G= 9x4+ 7x3+ 5x2+ 3x+ 1

in Z/17Z[x]. The first pseudo-division (Line 2) produces

S3 =prem(F,−G, x) = 11x3+ 5x2+ 16x+ 16,

which is a regular subresultant, i.e. δ =de= 43 = 1. Thus Line 6 gets skipped. The second pseudo-division (Line 8) produces

S2 =lc(G)−2prem(G,−S3, x) = 4x,

which is a defective subresultant, i.e. δ =de= 31 = 2. Thus Line 6 computes the regular subresultant S1 associated to S2

S1 =lc(S3)−1lc(S2)S2 = 3x.

The third pseudo-division (Line 8) produces

S0 =lc(S3)−3prem(S3,−S2, x) = 6,

which is the last subresultant of F and G. The subresultant chain of F and G is

S3 = 11x3+ 5x2+ 16x+ 16 S2 = 4x S1 = 3x S0 = 6

in which S3, S1, S0 are regular and S2 is defective.

The major subroutine needed ispseudo-remaindercomputation. Recall that given f(x), g(x) in k[x], the pseudo-division with remainder of f w.r.t. g computes q, r

k[x] with

lc(g)1+deg(f)−deg(g)f =qg+r, deg(r)<deg(g), (6.14)

assuming g 6= 0. The polynomials q and r are uniquely determined by the Equa- tion (6.14) and we also denote r by prem(f, g, x), which can be computed by the Algorithm 8. The polynomials q and r are called respectively the pseudo-quotient

Algorithm 8: Compute the pseudo-remainder prem(f, g, x)

Input : polynomials f, g∈k[x] such thatdeg(f)≥deg(g)>0

Output: the pseudo-remainder of f by g inx 1 r ←f

2 for i←deg(f)−deg(g) down to 0 do 3 r ←lc(g)r−lc(f)xig

4 return r

Algorithm 8 runs in deg(f)deg(g) + 1 iterations. Iteration icosts deg(g) +i+ 1 multiplications to compute lc(g)r; it costs deg(g) + 1 multiplications to compute

lc(f)xig and deg(g) + i+ 1 subtractions to compute r. Hence the total number of field operations performed to compute the pseudo-remainder prem(f, g, x) is

deg(f)−deg(g)

X i=0

(deg(g) +i+ 1) + (deg(g) + 1) + (deg(g) +i+ 1)

=

deg(f)−deg(g)

X i=0

(3deg(g) + 2i+ 3)

= (3deg(g) + 3 +deg(f)deg(g))(deg(f)deg(g) + 1)

= (deg(f) + 2deg(g) + 3)(deg(f)−deg(g) + 1). (6.15) Thus, we obtain the following complexity result.

Lemma 21. The pseudo-remainder of f, g ∈ k[x] with deg(f) ≥ deg(g) can be computed with O(deg(f)2) arithmetic operations in k.

ForF, Gk[x] withdeg(F)deg(G)>0, like the Euclidean algorithm, Brown’s subresultant algorithm costs 3deg(F)2 +O(deg(F)) field operations in k, as implied

by [25]. Theorem 11 is a slightly refined cost estimate, but only for the case of finite fields, in which the sizes of coefficients are bounded. Let ℓ be the degree of G, and denote by di the degree of i-th subresultant Si = subresi(F, G, x) for 0 ≤ i < ℓ. For convenience, we write dℓ =ℓ =deg(G) and dℓ+1 =deg(F).

Theorem 11. Algorithm 7 uses

d2+1+d2 +dℓ+1dℓ+O(dℓ+1)

Proof. We first consider the normal case, where degree drops exactly by one at each iteration of Algorithm 7, that is, di =i for 0< i < ℓ. Note that in the normal case, Line 6 will get skipped since all subresultants are regular. Thus the total cost is

ℓ X i=1 (di+1+ 2di+ 3)(di+1−di+ 1) = (dℓ+1+ 2dℓ+ 3)(dℓ+1−dℓ+ 1) + ℓ−1 X i=1 (di+1+ 2di+ 3)(di+1−di+ 1) = (dℓ+1+ 2dℓ+ 3)(dℓ+1−dℓ+ 1) + ℓ−1 X i=1 (6i+ 8) = (dℓ+1+ 2dℓ+ 3)(dℓ+1−dℓ+ 1) + (3d2ℓ + 5dℓ−8) =d2+1+dℓ+1dℓ+d2ℓ + 4dℓ+1+ 4dℓ−5 ∈d2+1+dℓ+1dℓ+d2ℓ +O(dℓ+1).

Now we consider general cases. Assume that there exits a block of subresultants satisfying the following conditions (1) Sk+1 is regular, (2) Sk has degree e < k. In this case, we have Sk−1 =· · ·=Se+1 = 0 and Se is regular. At Line 6, the algorithm computes Se =α Sk−1 with the cost at most

e+ 1 + 2 log2(ke+ 1),

where α is a power of a field element. 5 At Line 8, the algorithm computes S

e−1 =

βprem(Sk+1, Sk, x) with the cost

(k+ 2e+ 3)(ke+ 1) + 2 log2(ke+ 1)

where β is a power of a field element. In this case, the total cost to compute Sk−1,

. . .,Se, Se−1 is

e+ 1 + (k+ 2e+ 3)(k−e+ 1) + 4 log2(k−e+ 1)

=k2+ke2e2+ 4k+ 4 + 4 log2(ke+ 1). (6.16) However if subresultants Si’s are regular for all e ≤ i ≤ k, then the total cost to

5

By repeated squaring,xn can be computed in 2 log

compute Sk−1, . . ., Se, Se−1 would be k X i=e (di+1+ 2di+ 3)(di+1−di+ 1) + (k−e+ 1) = k X i=e (6i+ 8) + (k−e+ 1) = 3k2+ 12k3e2 6e+ 9 (6.17)

Thus, according to Equation (6.17) and Equation (6.16), the cost difference for com- puting Sk−1, . . . , Se−1 between the normal case and the general case is

3k2+ 12k3e25e+ 9(k2+ke2e2+ 4k+ 4 + 4 log2(ke+ 1)) = (2k−e)(k−e) + 4k−2e+ 5 + 4(k−e−log2(k−e+ 1)) >0

since k > e0 and xlog2(1 +x) for x >0.

Note that the subresultants with index smaller than e −1 will only depend on Se and Se−1. Hence one can proceed to the next block in the similar manner. In

summary, the total cost for the normal case is strictly larger than the non-normal cases. Consequently, the Brown’s subresultant algorithm runs in

d2+1+dℓ+1dℓ+d2ℓ +O(dℓ+1),

field arithmetic operations.