Professional Documents
Culture Documents
by
A.K. LENSTRA
REPRINT FROM:
MC Tract 154 (part I)
MC Tract 155 (part II)
COMPUTATIONAL METHODS IN NUMBER THEORY
H.W. Lenstra Jr. & R. Tijdeman (eds)
169
FACTORIZATION OF POLYNOMIALS
by
A.K. LENSTRA
1. INTRODUCTION
=
Let f be a monic polynomial of degree n in ]F[x], q with p prime.
The following three lemmas enable us to find the square—free decomposition
of f, i.e. polynomials E IFq[X] i = 1... ,k, such that f f, with
=
1 70
171
gcd(f.,f.) = 1, i j In practice we can apply this method by computing mod f and 1 mod f
xq =
LEMMA 2.1. (xq’ nod f)%od f for i =2,... ,Ln/2J. The computation of the partial factoriza—
(i) For each a lFq tion can therefore be done in 0(Ln/2J log q) polynomial multiplications modulo f.
€ there is a unique b E ]Fq such that b
.
f’ 0 3g PROOF. Let Q
= E IF LX] such that f(X) = g(X). U
= iji,j=O
n-I
= v(X)fflodf v.X)modf
If f’
0 we find a polynomial
=
g e IFq[X] such that f(X)
= (
= g(X) (Lemma i=O
2.3). Using Lemma 2.1 we
then write f(X) = h(X), and n-I n-I
square—f ree decomposition of
h recursively. If f’
we determine the
# 0 we observe that the
=
i=O
.
1
k=O
ik :
q.Xmodf
greatest common divisor of f and n-I
f’ equals n-I
( v.q. )Xkmodf
=
1 ik
k Lk/pi k=O i=O
IT i—I
f. IT fg
,i0modp ‘
2
i jI =v.Q. LI
so that f/g
i=2 i0modp f. and f 1 = f/(g•gcd(g,f/g)) Using
these rela (qil
f
0 ).Q
tions the square—f ree From Theorem 2.1 we conclude = modf, so that the
1
xq
decomposition of f can be determined.
For a further i . 3
Ln/2J polynomials Xq —Xmodf for
.
discussion on polynomial i = I,...,Ln/21 can be computed in O(n )
square—free decomposition
algorithms see YTJN [40].
In view of the square—free finite field computations, once we have calculated the matrix Q. This can
decomposition algorithm we now
assume that
f is square—free, i.e. f has be done in O(logq+n—
)
2 polynomial multiplications modulo f; for large q
no repeated factors. We present
a method to
obtain a partial factorization the use of the matrix Q is therefore preferable.
(or distinct degree factorization) of
JFq i.e. Polynomials f over BERLEKAMI’ [3] gives an alternative way to find the partial factoriza—
e ]F[X], i ,...,n, such that f = TT
1 1 g., where
g. is the product of all monic tion. His method makes use of the kernel of the matrix Q—I, where I is the
irreducible factors of degree
i of f. Notice
that, from this factorization nxn identity matrix (see also Section 4), and can be extended to determine
we can see whether or not
f is irreducible
over ]Fq (see also Section 5). the complete factorization over IFq• As this method is fairly complicated
In general, it tells us
the number of irre
ducible factors of f over IF we will not discuss It here.
From the partial factorization of a square—free polynomial f we can de
e polynomial qk X factors rive the degrees of the factors of f over Fq If we want to know only these
over Fq into the product of all
.
i—I and A (gcd(i,j)) Gunji and Arnon prove that Aa = , and they give
g. = gcd(X —X, •1’
f/ Ti g.), i —I
= an explicit formula for A , so that a can be computed, given For further
j= I
‘.
3. ROOT-FINDI IN F
q
LX] 3
Tr(
)
1
s B = ... 3
Tr(
s ) B = t., 0 j <
where q
= /. by Tr(X) the trace—polynomial
Observe that it gives rise to a linea
X1
We conclude that Tr(s) = 0, Vs E ]Fq
0
because {B ,13,.. .,B
.e—1)
forms a basis
r map Fq -* 7LIp72 .
for lFq over /p and Since Tr(X) has degree p this iS a contra—
LEMMA 3.1. For each y € F
q
we have xx
= s€7Z/p
(Tr(yX)—s). [1 diction.
LEMMA 3.2. Let f and v, i Clearly this method is not very efficient for finite fields with a
1,...,k, be monic polynomials in F Lx]
such
that gcd(v.,v.) 1, i .5, and fIT1
i=1
v.. Then f
1
Tik
i=1
=
gcd(
q
f,v.). El
large characteristic; it takes at most i gcd—computatiOfls n IF [Xl for each
q
trace—polynomial, and therefore, in the worst case c(p.f) gcd—computatiOfls.
Let B ••,&1}
€ F so that {S
1
B
0 forms a basis for F over For this reason we describe a third root—finding algorithm from RABIN [30]
Since f splits over IF into n different linear factors, we for which no a priori upper bound on the number of computation steps can be
q have
given, but which in practice will run quite fast.
— X a Omodf (Lemma 2.4). We assume first that the characteristic p is odd. Then we know that for
every non—zero e F either s
q
r
1 or
. r
where r= (q1)/ We say
.
2 = _, =
Applying Lemmas 3.1 and 3.2 we find that non—zero elements i and in F are of different types if s # s.
that q
f = Ti 3
gcd
X (f,T
)- s)r(S
, 0 .5 < L
LEMMA 3.3. Let s
1 and
2
be two non—zeros unequa 1 elements in IF
q
, then
SE/p
at random an element s c ]Fq and replace f(X) by f(X—s). According to Lemma by CANTOR and ZASSENHAUS [9], and finally we discuss the case that f has
3.3 the roots s + s and + s of f(X—s) have a probability of at least 1/2 equal degree factors.
2
to be of different types. If the shift s is “lucky”, that means s + s and The matrix Q, introduced in Section 2, appears to be very useful here,
i
+s are of different types, we can separate 5 and
2
s by computing and in particular the kernel of the matrix Q—I will be of vital importance,
2
gcd(f(X_s),Xr_1), otherwise we select another s € Fq and try
again. where I is the nxn identity matrix.
In the case that p = 2, we replace the polynomial xr — I in the above
algorithm by the trace—polynomial Tr(X). Again we have a probability of at THEOREM 4.1. Let v € Fq[X] deg(v) < n, then
least 1/2 to find a non—trivial factor of f by computing gcd(f(s.X), Tr(X)),
where s is a randomly chosen element of Fq This follows from = Tr(X)• a vmod f v’Q = v.
(Tr(X)— 1) (Lemma 3.1) and from a reasoning similar to the proof of Lemma
3.3. Notice that at most £ gcd—computations in ]F CX] are necessary, if we PROOF. Use Theorem 2.1. [I
choose s to run through a basis of Fq over 7Z/2.
Suppose we have a polynomial v a Fq [X], 0 < deg(v) < n, such that
Another way to deal with the case p = 2 is as follows. If £ > I is even
vQ = v, i.e. v is an element of the kernel of Q—I. Theorem 4.1 gives
(i.e. q a I mod 3) then we know that F contains a primitive third root of
2 q
unity c (so + r + I = 0), and that for every non—zero s a F either =
q fj v
r
5 r = 2
5 -
v-* (vmodg.)
,
1 v € Fq[X]/(f)
From these theorems it will be clear how we can factorize f completely
overlF.
Let q
q sEIFq
because 0 < )
2
deg(v < n, this gives a non—trivial factorization of f.
Since ) is a field, we have
1
[X]/(g If we find r factors of f in this way we are done. In the other case we
q
T
compute gcd(g,v_s) for all s e F, for all factors g of f discovered
t! = t. t. € IF so far and k = 3,...,r. Theorem 4.3 guarantees that we find all factors
1 1 1
of f in this way.
for i = 1,...,r, and therefore
McELIECE [22] describes an easy to program algorithm to determine a
(F)r. set of polynomials like {vi••Vr} which separates the factors of f, but
t € Ker(Q—I) )
1
(t €
which can be computed without matrix—diagonalization (this set consists of
=
f = 11 gcd(f,v—s),
scS — (—l)/2 — 1)12
v — = + 1) = f)
and therefore
(remark that we cannot have that both 1) = 1 and
+ 1)
2
’
1
gcd(f,v 1, since degree(v) < m). Now gcd(f ,v( D12
f fl (v-s) = 1) = f if
scS 2
(q—1)/ .
V and only if gIv —1 for i = 1,...,r, and this is the case if and only
So if t’
2 = I for i = I,.. .,r. The polynomial v was randomly chosen in the
kernel of Q— I, so that the probability that this occurs is ((q_1)/2q)r. The
(q—I)/2
f H (v) same reasoning holds for Prob(gcd(f,v + 1) = f), and therefore the
probability that a non—trivial factor of f will be obtained by computing
g(f (—l)/
÷
2
where I) and I) equals
Conversely, let fIG(v) with C € Eq [XL Substituting a common zero of f and for all r 2.
I3
v— s for X, we then find that C(s) 0, for all 5, Im the case that p = 2 amd q a Imod3 we compute gcd(f,v 1),
= 5 € 50 H divides C. This
(q—I)13 (q—I)13 . .
proves that H is the polynomial of minimal degree in Eq CX] for which gcd(f,v ) and gcd(f,v
— 1—c), where is a primitive third
—
fTH(v).
This enables us to compute H by looking for the first linear relatiom root of unity in Fq• If q E 2mod3 Camtor amd Zassenhaus suggest to apply
be
tween the powers 2
,
1
v°,v
, ...
v comsidered modulo f. Since H has degree #5 the method just decsribed to fimd the factorization of f over the quadratic
and #5 r we do not have to look beyond the r—th power of v. Once we have extension field F of F ; the factorization of f over F follows by com
q q q
H we can determine S by the methods from Section 3. bining factors which are conjugate over F. A much easier way to deal with
v
The third method comes from CANTOR and ZASSENHAUS [9]. Their algorithm the case p = 2, is to use the trace—polynomial (cf. Sectiom 3). Let v be a
makes use of a similar observation as Rabin’s probabilistic root—finding randomly chosem polynomial in the kernel of Q—I, and let Tr(v)
fJ_
v2i,
=
4i
algorithm from Section 3. Let v be an arbitrary mom—zero polynomial in the then = Tr(v).(Tr(v) —1), so that f
gcd(f,Tr(v)).gcd(f,Tr(v) —1).
=
1—r
2 —
kernel of Q—I, i.e. v is a ramdomly chosem mom—zero linear coipbimation It is straightforward to prove that we have a probability I (r 2)
over
Eq of the basis elements of the kernel of Q—I. We have seem in to find a mom—trivial factor of f by computing gcd(f,Tr(v)).
the proof of Theorem 4.2 that In the case that all factors of f have equal degree it is not necessary
to compute a basis of the kernel of Q—I to find the complete factorization.
vmodg = t. € F for i = 1,. ..,r, Cantor and Zassemhaus suggest the followimg algorithm. Let s = n/r be the
1 q
degree of the factors of f, amd let v 0 be an arbitrary polynomial of
180 181
The probability that a non—trivial factor of f will be obtained by computing Surprisingly, this test appears to be much slower than Test I, due to
1—r I .
these gcd s is > I 2 as is easily verified [9]. We have seen above
—
the computation of yq’
1 modulo f. This polynomial has to be computed if f is
how to extend this algorithm to the case that q is even. Remark that for
irreducible and in the case that the degrees of the factors of f do not
s = I we obtain another root—finding algorithm.
divide n.
Another, not very easy to program method comes from RABIN [30]. All fac Theorem 4.2 provides us with a third method.
tors of f have degree s, and therefore f has its roots in lFq5 Using a root—
finding algorithm from Section 3, we determine a root y of f in IFS. Then TEST 3. f is irreducible if and only if the rank of the kernel of Q—I equals
there exists an irreducible factor g of degree s of f over IF satisfying one.
g(y) = 0. But also g(y)q = g(yq) = 0, so the roots of g in IF s are
q It depends on the size (and factorization) of n and q which test should
1
q 5—l,
and g = nb
(x—y5 c Fq[X]
be used. In the first two methods the composition of
qk
modulo f for several
Several improvements on the algorithms given in this section are pos
values of k is the most time consuming part; the diagonalization of the ma
sible for special choices of q. See for instance CANTOR and ZASSENHAUS [9]
trix Q—I dominates the costs of Test 3. CALNETandLOOS [8] compared the asymp
and MOENCK [25] who gives also a detailed exposition of Berlekamp’s factori—
totic behaviour of Tests 2 and 3, and they show that the third test is slight
zation algorithm.
ly preferable. They also compared the practical behaviour of these two tests
in ‘Rabin’s probabilistic algorithm for generating irreducible polynomials
5. IRREDUCIBILITy IN IF [X]
over
(1) Generate a monic, random polynomial f of degree n over 2/ps.
In this section we discuss the problem of deciding whether a monic
(2) If f is irreducible then we are ready, else go back to step (1).
polynomial f of degree n > I is irreducible over IF. The polynomial f is
They used this algorithm to generate a number of small degree irreduc
square—free if and only if gcd(f,f’) = 1, which can be easily verified. None
ible polynomials and they concluded that Test 2 is slower than the test
of the irreducibility tests below require f to be square—free, but in the
based on Theorem 4.2.
average it appears to be time saving to apply the square—free test first.
Calmet and Loos didn’t pay any attention to Test I (with or without use
Our first irreducibility test follows directly from Lemma 2.4, as we
of the matrix Q). To generate large degree irreducible polynomials this test
noticed already in Section 2.
(without Q) is however considerably faster than Test 3. For small degrees
TEST 1. f is irreducible if and only if (and large q) the use of Q is advisable; in that case Test I and Test 3 are
approximately equally fast. The reason is of course that in the average case
i
gcd(f,X —X) I, for i one needs n choices in the above algorithm; only the last choice is irreduc
= = I,...,Ln/2J.
ible. Most of the wrong (reducible) choices have a small degree factor, and
If f is reducible this test is in general quite fast; for irreducible this will be detected very fast by the first irreducibility test. This more
f it becomes rather inefficient, because of the large number of gcd—computa— than compensates for the indeed rather slow behaviour at the last choice.
tions in Eq [x3. We can improve on this number of gcd—computations if we use A reasonable advice for large degrees therefore seems to be use Test
the following test, which is a lemma from RABIN [30]. I if you expect the polynomial to be reducible, otherwise use Test 3 (and
never use Test 2, certainly not if the degree n is prime).
182
183
6. FACTORIZATION IN (Wx(Pq))[X]
ALGORITHM 6.2. Given a, b, c, g., h. c Cx], such that a•g.+bh. (W
(
1 F)) =
over Wj(IFq)• The algorithm computes a,b c (Wj(Fq)) [xl such that g
1 +
In the previous sections we have seen several algorithms to
factorize
1
bh = c over Wj(Fq) and deg(a) < deg(h.) as follows.
a polynomial over a finite field ]Fq where q = p’. In Sections 7
and 8 it
Compute a,s c (Wj(Fq))[Xl such that ac = s.h.+a (with deg(’) <
appears to be very useful to be able to release the ‘modulo
p’ restriction
1 ), and take b
deg(h
) = bc+sg.. It is trivial to verify that a and b sat
of such a factorization over to a ‘modulo restrict ion.
q
T That is, we
isfy 5
ag
+ bh = c.
want to extend or lift a factorization over F to a factorization over a
q
ring containing q k elements, for a given value of k 1. We define this The first lift—algorithm follows from the proof of the following lemma.
ring, the so—called truncated Witt—ring
Wk(Fq) , as follows. To represent
the elements of ]Fq we usually take a monic polynomial C E
[T] of degree
LEMMA 6.1. (Hensel). Let f, g
,
1 and h
1 be as above. Then there exist c
1, that is irreducible modulo p, so that (Wk(Fq)) Cx] such that f = h over WkCFq)3 deg(h.) = deg(h
5
g. ) and g.
1 5
h ah overlF.
£7-I k I q
1
a.6 j a. c i =
q PROOF. Using Algorithm 6.1 we determine a,b c IF[x] such that a•g
1 +b•h
1 1.
= i=O =
and h
.
2 satisfy the conditions above. f, so we can construct the square—free decomposition of f using
a factor of
Let r a (Wj(]Fq)) [x] such that a.g
.
2 + .
2
b..h I + p
.r over
3 .(IF).
2
W an algorithm similar to the algorithm from Section 2, if we are able to per
Compute a,b E (W. (IF)) LX] such that •g. +b.h = r over Wj(Fq) Define form gcd—computations in 72[X].
.
2
a = a. and b
.
2 = b. —p
.b, then a
3 b a (W
2 j(Fq)) [X] and
2 Therefore, we concentrate first on gcd—computations of polynomials over
. 1 and f
Suppose we want to compute the gcd g of two polynomials f 2 in
.+b
a
.
.
2
. •g
.h = -p.).g
1
(a
2 + .).h
3
(b.-p
.
2 [X]. It is a we’ll—known fact that g is also a polynomial in [X]. However,
1 and f
if we apply Euclid’s algorithm to f 2 1 mod f.,
, we have to compute f.÷
= . +b.h
2
a.g .
2 - (.g +b.h
3
p
.
2 .)
2 i = 2,3,..., until f.÷
1 = 0, and in general the coefficients of the polyno
1 will not be in FZ,
mials f.÷ but in U. This is in many cases unacceptable,
=1 overW .(IF). 0 and therefore we have to find a way to remain in [X]. One way to deal with
2j q
this problem is to use pseudo—division in Euclid’s algorithm, i.e.
Surprisingly MIOLA and YUN [24] showed that the quadratic lift—algorithm
)—deg(f.)+I
1
deg(f.
1
based on the proof of this lemma is usually slower than the linear
lift— = (e(f.) 1
.f)modf
algorithm. Fortunately, ZASSENHAUS [42] indicated, in response to Miola
and
Yun, how to interpret his own paper [41], and he presented a modified Now is certainly in [X], but in practice this so—called EPRS—algorithm
ver
sion of the quadratic lift—algorithm which is indeed substantially (Euclidean Polynomial Remainder Sequence) is completely useless because of
faster
than the linear method. We give a brief description of his algorithm; the exponential coefficient growth. There are several improvements on the
for
proofs and details see [42]. EPRS—algorithm which keep the coefficient growth linear, or almost always
linear, like Primitive PRS (PPRS), Subresultant PRS (SPRS) and Improved SPRS
ALGORITHM 6.3. (Quadratic lift—algorithm). Let f a k(IFq)) LX], f monic,
2
(W
(ISPRS), see [5,6,7,11,12,13,18], but we will leave the PRS—algorithmsand
and 0
,h
a,b,g E IF[X] such that f .h and 0
g
0 +b.h
ag I over IF.
= = The
we take another approach.
algorithm computes a k(F)) LX] such that f
2
(W = .hk over W
k(IFq)
2
(1) j := 0, v
0 , w
0
ag 0 := 0.(v
v
— I) modulo f. THEOREM 7.1. Let f
1 f g a SEX],
, 2
, 2
,
1
) f. For all primes
gcd(f such
g = p,
(2) Let ej be the largest exponent for which e3
f over
1w.. If w. = 0 or j = k or that )
2
)
1 we have deg(g)
p%Lc(f
.c(f deg(g), where g = 2
,
1
gcd(f
)
k
e 2 then Vk := v., j k and go. to step (4). 72/pFZ, and there are only finitely many p such that deg(g) > deg(g).
186
187
PROOF. The first assertion is trivial, the second assertion Now let us return to the factorization of f over 72. In view of the
follows when we
look at the leading coefficients of the polynomials f.
1 in the EPRS—algo— above gcd—algorithm we assume f to be square—free. A classical method to
rithm. A larger degree for the gcd g can only occur if p divides factorize f was given by KRONEKER (see for instance VANDERWAERDEN [32]).
one of
these leading coefficients, and this can only happen for finitely To find a factor g of degree m, choose m+ I distinct integers a
,... ,am.
0
many
primes. U Then g(a)If(a) for i = 0,...,m, because g is a divisor of f. Now test for
all choices of divisors d. of f(a.), for i = 0,.. .,m, whether the unique
Combining this theorem with the well—known Chinese Remainder
Theorem, polynomial g of degree m, satisfying g(a) = d., i 0,... ,m, divides f.
we get the so—called modular cd—aZgorithm (MODGcD).
Although several improvements are possible, this remains a very inefficient
ALGORITHM 7.1. algorithm, even for reasonably small values of m. Using a similar approach,
(MOrXCD). Let f
2
,
1 f E 72[X], 1 and f
f 2 primitive, this algo
rithm computes ) ADLEMAN and ODLYZKO [I] prove (on hypothesis) that the problems of irreduc
2
,
1
gcd(f
f in 72[x].
(1) Choose a large prime p, such that ibility testing and factorization of polynomials over 72 are polynomial time
2
)
1
ptAc(f
) •c(f
, g := gcd(f
modp,
1
modp) e (72/pZZ)[X] (with g monic), product := p.
2
f reducible to the problem of integer primality testing and factorization re
(2) Test whether or not g will lead to the gcd of f spectively; the practical importance of their method is questionable.
1 and f
2 over 72:
take h = £c(f
).g modulo product.
1 The following method, which makes use of the results from Sections 4
and 6, appears to be very useful in practice. First we present this algorithm,
if hIec(f
).f and pp(h)
1 2 then pp(h)
If = 2
,
1
gcd(f
) f
else go to step (3). next we give an explanation.
p 1 Zc(f). Since f is square—free over 72 we have that discr(f) 0 0. It fol degrees of the factors modulo the different primes to reduce the possibil
lows that a prime p satisfying both conditions can be ities for the degrees of the factors over 72. For example, if f factors
found.
In practice we can always find a small prime, so that
we can apply 1 in 3 factors of degree 2, and f factors modulo p
modulo p 2 in 2 factors
Berlekamp’s factorization algorithm to factorize f modulo of degree 3, then f is irreducible over 72.
p. For largen it
might be preferable to compute the partial factorization — lift from 72/p72 to 721
72 for some k > k, and do not try combinations
k
of f first. This
saves the diagonalization of a large matrix, even if which do not satisfy the given bound.
f has only equal degree
factors (use in that case the second Cantor—Zassenhaus There are two obvious ways to implement the last step of Algorithm 7.2.
algorithm).
The irreducible factors of f over 72
are also factors modulo p, for The first is the so—called cardinality procedure: take combinations of s fac
every prime p, but they are not necessarily irreducible tors at a time, for s = 1,...,Lr/2J; the second is the degree procedure: take
modulo p. This im
plies that we have to look at combinations of irreducible combinations of total degree s, for s = 1,.. .,Ln/2J. If all partitions of n
factors modulo p
to find the irreducible factors over 72. But the absolute consisting of the degrees of the irreducible factors of f over 72 are chosen
values of the co
efficients of these combinations are bounded fron above to be equally likely, then COLLINS [14] gives some evidence that the mean
by L/2i; this bound gen
erally does not hold for the coefficients of the number of combinations formed before finding an irreducible factor is domi
factors over 72. Therefore
we first have to lift the factorization modulo 2 if the cardinality procedure is used and that it is exponential
nated by n
p to the factorization modulo
where k is chosen in such a way that k 12
is greater than the largest if the degree procedure is used. The cardinality procedure is therefore
possible coefficient of a factor of f over 72. A bound preferable.
on the coefficients
of the factors of f over 72 is given by MIGNOTTE Algorithm 7.2 is a widely used algorithm to factorize polynomials over
123]; let g = Zf0 gX’ be
a factor of f = Z f.X’ over 72, then the integers, and in practice it appears to be reasonably efficient. There
1
are some other, generally less efficient or even very inefficient algorithms
().v4’ f? , = o,... ,z. which might however, in special cases, be preferable to Algorithm 7.2. For
instance the multi—dimensional continued fraction algorithm of FERGUSON and
Now remark that in fact we are looking for factors FORCADE [15] (see also BBENTJES [4])can be used to determine a factor or
of Zc(f).f (due to the
mechanism to restore the leading coefficient, like in
Algorithm 7.1 step
prove irreducibility of the polynomial f over 72. Let a e YR be a real root
(2)), and that we can restrict ourselves to factors of f, then the algorithm of Ferguson and Forcade decides whether there exists
of degree [n/2i, so
that (*) follows. a factor g of degree £ of f, such that g(ct) = 0. If g exists the algorithm
Presently there is in general no way to see which finds a 72—linear relation among ,
2
,
0
a
,
1 .. .,c/, thus giving the coeffi
c*
ct
of the irreducible
factors modulo k together form an irreducible factor cients of g; otherwise, it gives a lower bound for the height of such a 72—
over 72, so we have
to test for all possible combinations of degree linear relation which will prove, together with the bounds of MIGNOTTE [23],
[n/2J whether they lead
to a factor over 72. If f is irreducible none of these that g cannot exist (some modifications are necessary if a c €\]R). For small
division—tests will
be successful; in that case the number of tests is
exponential in r, the £ this is a reasonably efficient method; a drawback is that to implement it
number of factors modulo k KALTOFEN et al. [17] a high—precision floating—point arithmetic is needed.
constructed a class of
irreducible polynomials over 72, for which r is linear Another way to discover factors of f was suggested by LENSTRA [19]. Let
in the degree, for
,lc
any prime p; this implies that the number of h.K be a monic irreducible factor of f modulo where p discr(f), and let
combinations can become expo
nential in the degree. In general it is often possible
of division tests in 72[X] considerably:
to reduce the number
g
=
modulo
4= 1 c 72 IX] be an irreducible factor of f over 72
g.X
In [19] it is proven that if v = 1
v.X E
such that h..Ig
Z[X] is an arbi
— first try the constant coefficient. trary polynomial such that gcd(g,v) = I over 72 and such that hklv modulop’,
— factorize f modulo a number of primes. Use a prime then
with the smallest num
ber of factors in step (2) and (3), and combine
the information about the
190
191
kdeg(h) I m
g
)
2 15 2.( 2 be adapted to (ç(a))[X]. We will not give a description of this algorithm.
p v) (**)
Factorization in (i1(a))[x] introduces the problem of choosing a denomi
From (**) and the Mignotte bounds it follows that, if k is chosen sufficient nator. The first thing we remark is that there is an integer d such that
f c (- 72[a])[x]. However, even in the case that d = I (i.e. f c (72[a])[x])
ly large, g is the shortest—length non—zero vector in the (1+1)—dimensional
lattice it is possible that the irreducible factors of f over ‘Q(a) have a non—triv
ial denominator, i.e. new denominators can occur when factoring over Q(o).
With the help of the following two lemmas we determine an integer fl such that
Lk = {qh+ pk.r I q,r C 72 [xl, deg(q) 1— deg(h.) ,deg(r)
f and all monic factors of f over Q(a) lie in
(k 72 [c*])[x].
< deg(h,)} c LEMMA 8.1. Let f c ( R)[X], f monic, and g and h monic polynomials in
(ugafl[x] such that f = g.h, then g,h c ( R)[x], where R is the ring of in
where the polynomials q.h,+pk.r are regarded as (1+1)—dimensional vectors.
tegers of U(a). II
The polynomial g can therefore be found by looking for the shortest—length
vector in L.K or by looking for a sufficiently orthogonal basis of LEMMA 8.2. Let b = max{d c U such that 2
d
l discr(F)), then defect(a)Ib, and
LK.
L. Lovász proved that such a basis can be determined in polynomial time, so therefore R c 72 [a], where defect(n) = min{d c 14 such that R c 72 [a]). U
that the latter approach leads to a polynomial—time algorithm for factoring
primitive polynomials over 72. This algorithm is described in detail in [201.
If f E (-- 72[a])[X] then certainly f C ( R)[x]. Applying Lemma 8.1, we
see that every monic factor of f over Q(a) will be an element of ( R)[x].
In Section 8 we will see another important application of (**).
But we can also find c € 14 such that R c 72 [a]; we take c = defect(a) if
We conclude this section with a short remark on tests for irreducibility
of polynomials over 72. The test suggested above, based on the comparison defect(a) is known, else we use the b from Lemma 8.2. Combining these results
we obtain the P we wanted to have: U = dCc.
of the degrees of the factors modulo p, for several values of p,was analysed
Having determined a value for U, let us return to the problem of find
by MUSSER [28]. As we have seen this method does not work for all irreduc
ing the complete factorization of f over Q(a). If a prime p can be found
ible polynomials [171 (for instance X+ 1), but Musser’s test results show
4
such that the minimal polynomial F remains irreducible over 72/p72, and such
that the mean nuniber of primes needed to prove the irreducibility of a ran
that a few other, more trivial, donditions are met, the factorization algo
domly chosen irreducible polynomial grows very slowly with the degree, and
rithm is similar to Algorithm 7.2 (Factorization in 72[x]).
is in fact 5 for degrees 200.
192 193
and lift the factorization of f over IF to the factorization over ThEOREM 8.1. Let f e (Q(a))[X], such that Norm(f) € Q[X] is square—free where
q
WkOFq): Norm(f) = n? f(X,ct.) is the product of f(X,ct.) over the m conjugates of c
k (so Norm(f) has degree n•m and is in Q[Xi). Let 1
TTf be the complete fcc—
(d modp ).(d.f)ii! h. over Wk(]F) g
(remark that 72 [cz]/(p
)
1 Wk(IF)). torisation ofNorm(f) over Q, then T1!I gcd(f,g.) is the complete factoriza—
(4) Compute the polynomial h = ((D•fl.s h.) over Wk(IF)) for all subsets tion off over Q(c). U
S c {1,...,r} such that deg(h) Ln/2j, and test whether h is a divisor
To implement the factorization algorithm based on Theorem 8.1, we need,
of f over 72 [ci.
besides an algorithm to factorize in 72 [Xi, an algorithm to compute the norm
This algorithm can only be applied if a prime p can be found such that of f and an algorithm to transform f, if necessary, to a polynomial with a
(i) p 1 D,
(ii) the minimal polynomial F remains irreducible modulo p, and square—free norm. The norm can be calculated using an algorithm of COLLINS
(iii) f remains square—free over IF. In step (2) we take a prime satisfy [13], and Trager proves that there is only a finite number of elements
ing these conditions. An upper bound for the coefficients (in 72 [ci) of s € Q such that Norm(f(X—scO) is not a square—free. For further details and
the factors of f over Q(ct) is given in WEINBE1CER and ROTHSCHILD [381; from proofs see [31].
their bound follows the value for k in step (3). In practice this value for Another approach was proposed by WEINBESGER and ROThSCHILD [381. The
k is almost always much too large, and therefore we often use a heuristic complete factorization F . modulo p of the minimal polynomial over
1
F
=
bound (see for instance WANG [34]). Remark that we apply the lift algorithm 72/pZZ defines a number (0 of finite fields. Namely, let n. denote a zero
to the monic polynomial (dmodpk).(d.f) c (72[a])[X]. The denominator of of Fji, i = 1,.. then we have the following t finite fields: Fq. =
:‘‘
{z:g’1)—l
the trial—divisors im step (4) is constructed in the obvious way: multiply a.a. a. € 72/p72, j = O,...,deg(F
)
1 1}, i = 1,. ..,t. Now we
—
k, choose p such that F is square—free modulo p and such that f remains square—
by D modulo and attach the denominator 0 to each of the coefficients.
Now that we have seen how to handle the denominator D, we take for simplic free over IFq for i = 1,...,t (clearly this is possible), and we take k as
ity 0 = I in the sequel. in step (2) of Algorithm 8.1. Then we are able to calculate the complete
72
k
721
Difficulties arise in the case that Algorithm 8.1 cannot be applied factorizations of f over W(IFq) = (z ga’k—l a.c. a. € =
because a suitable prime cannot be found. This means that either F is ir ,deg(F) 1}, where F = modulo k and denotes a zero of
—
Fki ctk Fki,
reducible over 72/p2 and f has repeated factors over IFq or F reduces mod— for i = 1,...,t (remark that 72[n]f(Fki,pk) W(IFq)). Let g € (72[a])[X]
ulo p. The first can only be true for a finite number of primes, so we con be an irreducible factor of f over Q(u), then g modulo and Fki (i.e. g
reduced to (W(IFq)) [Xi) is a combination of irreducible factors of f over
clude that F reduces modulo p. Since
J
3 a. c 721p72, i = 0,... ,m—1}
a.c
(k,
is not a finite field in this case, we cannot apply our usual factorization for i = 1,. ..,t. Furthermore g can be reconstructed from gmod
scheme of factoring over a finite field, extending this to the factorization Fki), i = 1,. ..,t, with the help of the Chinese Remainder Algorithm [21].
over a large enough ring, and finding the true factors. There are several Therefore we can find the irreducible factors of f over Q(ct) by applying
ways out of this problem. the Chinese Remainder Algorithm to each possible t—tuple of equal degree
The first solution comes from VAN DER WAERDEN [321 (see also WANG [34]). factors over W(]Fq), i = 1,...,t. For large t this last step is the most
He reduces the problem of factoring f over Q(a) to the problem of factoring time consuming part of the factorization algorithm. For instance, to prove
a polynomial in two variables over the integers. As the degree of this poly the irreducibility of an irreducible polynomial over QQi) that factors over
Lr/2Jrt
in r equal degree factors for i = 1,...,t, we must perform Z
nomial is n•m in each variable, this is not a very efficient method, and we
12
r
2
( t1/v/E)(_L)(t_l)h (r-’-=)
Y
will not discuss it here. An improvement of Van der Waerden’s algorithm was [29, p. 42] trial—divisions. But also in the
given by TRAGER [311. Instead of the factorization of a multivariate poly case that f is irreducible over Q(a) and we are unlucky, the number of trials
nomial we now get the factorization of a univariate polynomial of degree can become exponential in nt. This algorithm is therefore only practically
nm over 72. Trager’s method is based on the following theorem. applicable if the number of factors of the minimal polynomial modulo p is
194
195
reasonably small (i.e. 3). Remark that the Weinberger and Rothschild algo 9. FACTORIZATION OF MULTIVARIATE POLYNOMIALS
rithm poses the problem of an efficient implementation of the last step, mini
mizing the number of multiplications in 1
(W(Pq
) ) [Xl, the number of applica In the previous sections we restricted ourselves to the factorization
tions of the Chinese Remainder Algorithm, and with fast update facilities in of univariate polynomials. There are several methods to extend these algo
the case that a factor is found. rithms to multivariate polynomials [27,33,34,36,39]. We given an outline of
The last method we discuss was suggested by H.W. Lenstra Jr. He made Wang’s algorithm for factoring in 72[Xi,...,X]; for the numerous details we
the observation that the use of the Chinese Remainder Algorithm in the above refer to his paper [36].
algorithm is not necessary; the factorization of f over one truncated Witt— Let f 7.1 1
[X
, ,X] be the square—free polynomial to be factored (see
€ . ..
ring W(]Fq) is sufficient to construct the factors of f over (c), if k is [35, 37] for the square—free decomposition of multivariate polynomials).First
chosen sufficiently large. Let Fk be an irreducible non—trivial factor of we evaluate f in the point (X a
,
2 ... ,X
2 = = at) for some choice of integers
the minimal polynomial modulo k, and suppose that we have computed the com a
,
2 . ..,at. The resulting univariate polynomial 2
,..
1
f(X
, a .,at) E 72 [X ] is
1
plete (square—free) factorization of f over Wk(]Fq) the truncated Witt—ring then completely factored over 72. Next we apply a generalization of the al—
generated by and If f has an irreducible factor g € (72 ta])EX] of de gorithins from Section 6 to lift the factorization of f(Xl,...,X1,a.+l,...,a)
k
7
gree t over Q(a), then clearly a gmod (WkOFq)) [X] is one of over 72 [X
€ ,...,X] to a factorization over 72 1
1 ,...,X.÷
[X
] , for i = 1,...,t—1.
the (not necessarily irreducible) factors of f over Wk(]Fq) Let v e 71 [a] After each application of the lift—algorithm we determine the true factors
be the i—th coefficient of g (regarded as polynomial in a), for some i € of ,
2
,
1
f(X...,a) over 1
...,X.+i,a±+ ,...,X
72[X
]
÷ . This can be done for in
0,... ,Z}, and let vk = vmod (Fk,p’) S W(]F) the i—th coefficient of stance by a combinatorial search, like in step (3) of Algorithm 7.2. For
kbe
Define the rn—dimensional lattice L.K = {q.F+p •r q,r € FlEa], deg(q) < i = t—1 this gives the complete factorization of £ in 72
m_deg(F), deg(r) < deg(F)) c m (regard the polynomials q.F + pk.r as A completely different approach to the factorization of multivariate
rn—dimensional vectors), then clearly v and vk are congruent modulo L.K. It polynomials is given in CLAYBROOK [10] and ZIPPEL [43]. In their algorithms
is not difficult to derive from (**), Section 7, that for all B > 0, there the sparseness of the polynomial to be factored, and of its factors, is
is an integer k
0 = k
(
0 B), such that all elements 0 of L. have length B essential.
for k . Since we can give an a priori upper bound for the length of v
0
k
(Algorithm 8.1, step (3)), we conclude that v is the shortest—length vector REFERENCES
congruent to v modulo LK, if k is chosen sufficiently large. An algorithm
of L. LOVASZ [20] enables us to construct in polynomial time a sufficiently [1] ADLEMAN, L.M. & A.M. ODLYZKO, Irreducibility testing and factorization
orthogonal basis of Lk, so that we can compute v by reducing vk modulo this of polynomials (extended abstract), Proc. 22nd Annual IEEE Symp.
basis. Experiments showed that this so—called lattice—algorithm is quite Found. Comp. Sci., 409—418.
useful, and not only in the case of the reducing minimal polynomial; look
[2] BERLEKAMP, E.R., Algebraic Coding Theory, McGraw—Hill, New York, 1968.
ing for a prime such that the minimal polynomial reduces and applying the
lattice algorithm appeared to be faster than using Algorithm 8.1. For a com [3] BERLEKAMP, E.R., Factoring polynomials over large finite fields, Math.
plete description and some computer timings we refer to [19]. The approach Comp. 24 (1970), 713—735.
from Section 7, where we viewed factors as shortest—length vectors in a cer [4] BRENTJES, A.J., Multi—dimensional continued fraction algorithms, Doc
tain lattice, will even lead to a polynomial—time algorithm for factoring toral thesis, Mathematical Centre Tract 145/81 (see also this
univariate polynomials over algebraic number fields.
volume).
[6] BROWN, W.S. & J.F. TRAUB, On Euclid’s algorithm and the theory of sub—
[21] LIPSON, J.D., Chinese remainder and interpolation algorithms, Proceed
resultants, J. ACM 18 (1971), 505—514. ings of the 1971 ACM Symposium on symbolic and algebraic manipu
[7] BROWN, W.S., The subresultant PRS algorithm, ACM Transactions on Mathe lation, 372—391.
matical Software 4 (1978), 237—249. [22] McELIECE, R.J., Factorization of polynomials over finite fields, Math.
[8] CALMET, J. & R. LOOS, An improvement of Rabin’s probabilistic algorithm Comp. 23 (1969), 861—867.
for generating irreducible polynomials over GF(p), Information [23] MIGNOTTE, N., An inequality about factors of polynomials, Math. Comp.
Processing Letters 11 (1980), 94—95. 28 (1974), 1153—1157.
[9] CANTOR, D.C. & H. ZASSENHAUS, A new algorithm for factoring polynomials
[24] MIOLA, A. & D.Y .Y. Y1JN, Computational aspects of Hensel—type univariate
over finite fields, Math. Comp. 36 (1981), 587—592.
polynomial greatest common divisor algorithms, Proceedings of
[10] CLAYBROOK, B.C., A new approach to the symbolic factorization of multi— EUROSAN ‘74 (ACM SIGSAN Bull. No. 31), 46—54.
variate polynomials, Artificial Intelligence 7 (1976), 203—241. [25] MOENCK, R.T., On the efficiency of algorithms for polynomial factoring,
[11] COLLINS, G.E., Polynomial remainder sequences and deterqninants, Amer. Math. Comp. 31 (1977), 235—250.
Math. Monthly 73 (1966), 708—712.
[26] MOSES, J. & D.Y.Y. YUN, The EZGCD algorithm, Proceedings of the ACM
[12] COLLINS, G.E., Subresultants and reduced polynomial remainder sequences, Annual Conference, August 1973, Atlanta, 159—166.
J. ACM 14 (1967), 128—142.
[27] MUSSER, D.R., Multivariate polynomial factorization, J. ACM 22 (1975)
[13] COLLINS, G.E., The calculation of multivariate polynomial resultants, 291—308.
J. ACM 18 (1971), 515—532. [28] MUSSER, D.R., On the efficiency of a polynomial irreducibility test,
[14] COLLINS, G.E., Factoring univariate integral polynomials in polynomial J. ACM 25 (1978), 271—282.
average time, Proceedings of EUROSAM ‘79, 317—329.
[29] POLYA, C. & C. SZEGO, Aufgaben und LehrsHtze aus der Analysis, (2 Vols),
[15] FERGUSON, H.R.P. & R.W. FORCADE, Generalization of the Euclidean algo Springer, 1964 (3rd ed.).
rithm for real numbers to all dimensions higher than two, Bull. [30] RABIN, M.O., Probabilistic algorithms in finite fields, SIAM J. Comput.
AMS 1 (1979), 912—914.
9 (1980), 273—280.
[16] GUNJI, H. & D. ARNON, On polynomial factorization over finite fields,
[31] TRAGER, B .M., Algebraic factoring and rational function integration,
Math. Comp. 36 (1981), 281—287.
Proceedings of the 1976 ACM Symposium on Symbolic and algebraic
[17] KALTOFEN, E. & D.R. MUSSER & B.D. SAUNDERS, A generalized class of computation, 219—226.
polynomials that are hard to factor, Proceedings of the 1981 ACM [32] VAN DER WAERDEN, B.L., Moderne algebra, Springer, Berlin, 1931.
Symposium on Symbolic and Algebraic Computation.
[33] WANG, P.S. & L.P. ROTHSCHILD, Factoring multivariate polynomials over
[182 KNUTH, D.E., The art of computer programming, Vol. 2, second edition,
the integers, Math. Comp. 29 (1975), 935—950.
Addison—Wesley, Reading, Mass. 1981.
[34] WANG, P.S., Factoring multivariate polynomials over algebraic number
[19] LENSTRA, A.K., Lattices and factorization of polynomials, Mathematisch
fields, Math. Comp., 30 (1976), 324—336.
Centrum, Amsterdam, 1W 190/81.
[35] WANG, P.S., An efficient square—free decomposition algorithm, ACM SIC—
[20] LENSTRA, A.K. & H.W. LENSTRA Jr. & L. LOVSZ, Factoring polynomials
SAN Bull. 11 (1977), 4—6.
with rational coefficients, Univ. of Amsterdam, Dept. of Math.,
Report 82—05.
198
[37] WANG, P.S. & B.M. TRAGER, New algorithms for polynomial square—free de
composition over the integers, SIAN J. Comput. 8 (1979), 300—305.
[38] WEINBERGER, P.J. & L.P. ROTHSCHILD, Factoring polynomials over alge
braic number fields, ACM Transactions on Mathematical Software
2 (1976), 335—350.
[42] ZASSENHAUS, H., A remark in the Hensel factorization method, Math. Comp.
32 (1978), 287—292.