Euclid's Algorithm and Computation of Polynomial GCD' s
483
dividing the numerator and denominator of this expression by h = gcd
(fk,
.0), we
obtain
G = ((O/h)Fk)/(f,/h).
Since
(fk/h)
and
O/h)
are relatively prime, it follows
that
(f,/h)
divides Fk. Hence, we may obtain G by computing H =
F,/(~/h),
and
then G = pp(H).
We are now prepared to present Algorithm C for computing G' = gcd(Fl', F~') :
(1)
Set cl = cont(Fl'), c2 = cont(F2'), c = gcd(o, c2).
(2)
Set
Fi = F~' /o , F2 = F2' /c2 .
(3)
Set f, = lc(F,),f2 = lc(F2), 0 = gcd(f~,f~).
(4)
Construct a PRS, F1, F2, • • • , Fk.
(5)
If 0(Fk) = 0, set G' = c, and return.
(6)
Set G =
Fk/(fk/O)
or
oFk/fk
as appropriate.
(7)
Set G = pp(G) = G/cont (G).
(8)
Set
G' = cG,
and return.
3.
Constructing a PRS
3.1
INTRODUCTION.
We
turn now to the problem of constructing a PRS, as re-
quired in Step 4 of Algorithm C.
Let F1, F2, • • • , Fk be a PRS in ~[x]. Let di = a(F~), for i = 1, • • • , k, and note
that dl > d2 > d3 > ... ~ dk > 0. Let ~i
-- dl -
d~+~ fori = 1, ... ,k -- 1, andnote
that ~ > 0, while ~ > 0 for i > 1. If ~ = 1 for all i > 1, the PRS is called
normal;
otherwise it is called
abnormal.
Finally, let f~ denote the leading coefficient of Fi.
Referring to (7), we shall always choose
~i = ji-1
,
i = 3, "",k,
(8)
so that
~F~ = prem(Fi_2, F~_i),
i = 3, ...,
k.
(9)
When a method for choosing the f~ is given, this equation and the terminating con-
dition
prem(Fk_l, F~) = 0
(10)
together provide an algorithm for constructing the PRS. We shall consider several
different methods for choosing the fl~.
3.2
THE EUCLIDEAN PRS ALGORITHM.
If we choose ~i = 1 for i = 3, • • • , k, then
Fi = prem(Fi_2, F~_~) for i
=
3, ... , k. Collins calls this the
Euclidean PRS
algorithm
because it is the most obvious generalization of Euclid's algorithm to
polynomials over a unique factorization domain that is not a field.
Returning to the example (4), the Euclidean PRS is
1, 0, 1, 0, -3,
-3, 8, 2, -5
3, 0, 5, 0, -4,
-9, 21
-15, 0, 3, 0, -9
15795, 30375, -59535
1254542875143750, - 1654608338437500
12593338795500743100931141992187500.
( 11 )
Journal of the Association for Computing Machinery, Vol. 18, No. 4, October 1971