Euclid's Algorithm and Computation of Polynomial GCD ' s
495
4.6
UNLUCKY b-VALUES. We shall call the integer b C Zp chosen in Step (6)
of Algorithm P
lucky
if e = d, and
unlucky
otherwise.
In Theorem 4 we shall prove that all of the unlucky b-values are roots (in Zp) of a
polynomial o- (in 9 =
Zp[x~]),
which depends only on F~ and F~. Using this result,
Theorem 5 bounds the total number u of unlucky b-values, thereby establishing
the fact that the algorithm terminates.
If b is chosen at random from the elements of Zv, the probability of its being un-
lucky is
u/p.
If p is large (as suggested in Section 4.4), this probability is exceed-
ingly small. Thus if F~ and F2 are relatively prime, we can expect to prove it with
only a single b-value. Otherwise the expected number of b-values to determine the
GCD and the cofactors is fi = p +
1 =
max
(0v(F1),
0v(/~2))
-t- ].
THEORE_U 4.
Let F~ and F2 be given nonzero polynomials in 9[x~, ...,
x,-1],
where ~ = Zp[x~]. Let
G = ged(F~,
F2), and let di= O~(G). Also, let S}~) (F~, F:)
denote the jth subresultant of F1 and F2 viewed as univa','iale polynomials in x~ , with
eoeficients in ~[xl,
-.. , xi_~, x~+~, ... , x~_~],
and let ai be the content (in ~)
of
S(~) (F~
F2 ) viewed as a polynomial in 9Ix,,
, x~_l]. (Here di is the degree of G
di
,
"
"
"
in X~, and not, as in Seclion 3.5, the degree of the ith polynomial in a PRS.) Finally, let
v--1
=
II,,~.
(55)
i=l
Then every unlucky b-value is a root (in Zp) of a.
PROOF.
The proof is analogous to the proof of Theorem 1.
THEOREM 5.
Let u be the total number of unlucky b-values,
let
and let
Finally, let
V--1
m = ½ max
(Oi(F~) + O~(F2)),
(56)
i=I
e = max (0~ (F1), 0~ (F2)).
(57)
(ss)
= 2me(v-
1).
Then u < ~.
PROOF. Let P
=
1~ (xv -- b), where the product is taken over all unlucky
b-values. Since P 1 cr by Theorem 4, we have u = 0v (P) < 0~ (~) = ~
0v (~i). But
by (20), 0" (gi) <
2me,
sou <
2me(v -
1), aswas to be shown.
4.7
ALGORITHM U.
Let F1 and F2 be given nonzero polynomials in
Zv[x],
where
p is a fixed prime. Algorithm U computes G = gcd(F1, F2). Since Zp is a field, G
must be monic in order to satisfy the requirement of unit normality. Also since Zp
is a field, we may use the rational algorithm of Section
2.2.
In the example (4) with p = 13, the monic PRS which mirrors (6) is
1, 0, 1, 0, --3, -3, --5, 2, --5
1, 0, 6, 0, 3, --3, --6
1,0,5,0, --2
1, --3
1.
(59)
Journal of the Association for Computing Machinery, Vol. 18, No. 4, October 1971