Bipot
Factoring Polynomials with Rational Coefficients
AK. Lensta!, HLW. Lenstra,J:2, and L. Lovisa?
1 Mata Cet, Kran 415, NL SI Ameria Th Neate
2 Matern oot Une Nasedan Rein #8 NCO WB Anstey,
Sot sitte, A, Se Uae, Aral rank tee 1,20 Seep Hany
To this paper we present & polynomiaisime algorithm to sole the following
problem: given a nonzero polynomial fe@[X) in one variable with rational
Eoefcets, id the decompostion off into reducible factors n QU, eis well
own that thsi eqivalet to faconng prime polynomias fe 2X) into
ireducblefctors in 20}. Here we call fea] pam d the greatest commen
Alivisor of ts eons he contnt of 7)
‘Oor algorithm pertcms wellin practice, (8) Is runing tm, measured in
bit operations is Otn"*+ yng fD?) Hore feBLN] is the polynomial to be
factored, n= ded) i the degree off. 2nd
(Beata
for & polynomial Sa." with cel coetiients a,
An outline of the algorithm i as follows. First we find, for 2 suitable small
prime number p. a padi itreducble fiorh off (0 certain precsion. This s
{one with Berlekamp's algorithm fr faecoring polynomials over smal ints elds
combined with Hease's lemma. Next we look faethe reducible fast hy of fn
{LX that i ivsiie by The condition that hy i visible by # mean that hy
belongs to 4 cern lative, ard the coation that hy divides implies that the
coefficients of hy ate flatly smal. It follows that we must look for a “small”
element in that late, and this is done by means ofa basis redction algorithm. I
turns out that this enables us co detenmize hy The algorithm is repeated unt all
ieradusible factors of {have been found
“The basis reduction algorithm that we employ is new, and it described and
analysed in Sect. fT improves the algorithm given ina preliminary version of [,
Sect]. At the ead of Sect. | we briefly mention two applications of the new
algorithm to diephantie approxanation
“The connection between factors off and reduced bases of latices rented in
decal in Sect. 2. The theory presented here extends a result appearing in [8
“Theorem 2). It should be remarked that the latter result whichis Smet (o grove
would in principle have sufficed for our purpose,
125-3831/82/0261/9515/805.00,Section 3, fray, contains the description and theanalysis of ou algorithm for
factoring polynomial.
1 may be expected that other ireducbiity tests and factoring methods that
Aepend on diophantine approximation (Cantor (3), Ferguson and Foreade [5],
Brenjes (2, eet. 4A], and Zasionhaus [16] can also bs made into palynoms
lime algoits withthe help ofthe basis reduction algovithan presented in Sec.
Spliting on arbivary non-or0 polysomial feZ[X) into its content and its
printte part, we deduce rom out main result hat the problem of factoring such &
Dalynomial t polynomial-time reducble to the problem of faclring postive
Integers The same fact was proved by Adleman and Odlyzko [1] under the
‘assumption of several deep and unproved hypotheses om number ibeory
“The generalization ofour result to algebeate aumber fields and to poiyrorials
in several variables the subjet of farare publications
1. Reduced Buses for Lats
‘Let bea positive inter. A subse of the dimensional real vector space Ris
calla fatice there existe a basis ,, by. of R such that
{oamemesiza
In thie sation we sy tha ys By oem
cal the rank of L The determinant dL) of
asi for Lor that hoy span L.We
‘defined by
wn AL) =e by.)
‘hed, being written as column vectors This ib a positive eal number that does not
have now tote replaced. Thsis done hy formilae hat we give below. The
‘os important one of these changes is that by isreplced by Bray ae gs 30
{he aow valae of if? is es than} nes the ad one. These changes Geng made,
swe replace k by k— 1. Then we are inthe situation deseibed by (1.16) and (17
and we proceed with the algoethm from there.
(Case 2 Suppose that §=1 o¢
20) Dt ie
Te this case we rst achieve that
020 Injs¥ for 1sjsk—1
[For jek 1 this is steady tuo, by (1.18) If (121) does not ol, tI be the
largest index 4, let» be the integer nearest 0 pus and seplace bby
PERE.2 AK Lisi eta
Donn, The numbers, with 0, we ean interpret das the square ofthe
dlterminant of the lattice of rank f spanned by bso nthe vector space
Rb, By 4 Chap. b Lemma 4and Chap. H.Theorem I], this tice contains a
non-zero vector x with [xlPS(4/3}"- 7d)". Therefore 4,204)" mir}, as
requited
‘We shall now analyse the running time of te algorithm under the added
hypothesis that be” for [Stn By an aritimesc operation we mean an
addition, subtraction, multiplication or division of two imegers. Let the binary
Feng of an integer be the numbee of Binary digit ofl
(1.26) Proposition. Let LCB* be @ lattice with bass Bybynsby and let BET
BZ, be such thar |S for 15:0. Then the number of arithmetic operations
scl by the basis rocton algortim described in (115) 6 O(log. and the
Inegers on which these operations ar performed each hace binary length OinlogB)
ARenurk. Using the classical algorithms forthe arithmetic operations we find that
te number of bit operations needed by the. basis reduction algorithm is
Olnélog BP), Tis canbe reduced to Ofr? logBI*") forevery «>0.itwe employ
fast multiplication techniques.
Proof of (26) We ist estimate the number of tines that we pas through ses 1
‘ae 2. the begining ofthe algorithm we have d= B, by (125), so Ds BY"
‘Throughout the algorithm we have D2, since die by (2) and d,>0 by (1.25).
So by the argument in (1.23) the number of times that we puss through ease
(fn? Logi and the same applies to case 2
‘The initialization ofthe algorithm takes O(n?) arithmetic operations with
rational numbers; Below we shall sv how they cam be replaced by operations with
integers
For 18) we need Oty arithmetic operations, snd thiss also tre for case I. In
case? we have to deal with Oj) vies ofthat each require Oy) arithmetic
Sperations Since we pas though these cases On log) times we arive ata total
‘of Or TogB) arithmetic operations
Te order to represent all numbers that appeat inthe course ofthe algorithm by
means of intyers we also Keep track of the numbers d, defined by (128) In the
‘nization stage these can be calelated by (1.25) Aer that they are only
‘hanged in cae, that ase, dy i eplaced By dg lef NOE Pd
lef Lin the notation of (.2)] whereas the other dave unchanged. By (1.34),Poppe wih Raton Cotte so
the dyace integers, and we shall now se that they canbe used ss denominators for
all numbers that pete
a2 usisa,
(128) 4 MeLcE (sign,
(129) Apek (Vgi,
OM) ISP for Lspek, AP eens
Here (1.30, for 1k, is teva from (1.32, sad (131) follows fom (1.4), Using that
1135) HESS =, bh, sB- BP
se 8 that (133 fllows frm (20), and (32) isthe sme (1.16 Tans to
rove (for 7>kand a prove 1.4 At the eganing of he slgrthm we even
have Ils Band jz by (135), so ic sullees to comider the situation atheend of eases | and 2, Taking into account that k changes in thes cases, we se that
invease 1 the st of vectors fiyc/-PK) is wnchanged, nd that iy case 2 the se
{ori k} is replaced by a subset Hence the inequalities (1.30 are preserved. At
the end of ease 2 the new values for j, Gf kan I) ae the old vales of) 50
hete 1.3 follows fromm the inequality (133) 2 the previous stage. To prove (34)
st the end of case 1 we assume tha it valid atthe previous stage, and we follow
‘what happens 10 J, To achieve (18) iis, for j0
“This proves (1.39)
Another application of our reduction algorithm ito the problem of finding
{Quinear relations among given real umber, ay-r oe For this we take the
lataice Zt be 2 embedded in Re by
trams mente Em
here cis a large constant anda, is 2 good rational approximation toa, The fis:
bass vector ofa reduced basis of Zl give rise to iteget mmy vty hat ate
sot too large such that mya is very small
‘Applying thistoo,=1 we see that our algorithn can be wed tote a given
‘eal number afr algebrsicty, tnd to determi its ireducible polynomial. Taking
fora a zeo of a polynomial fez[X], f0, and generalizing the agoritim to
complex one ads in this way an eivcbe factor off in Z[X1, Its likey that
{his yes actually a polynomial-time algorithm to factor fin QL], an algorithm
‘ha is diferent fom the p-adic method described in Soot. 3
Ins simi: way we can test given teal numbers fy. for algebraic
‘Sependene, taking the a tobe the monomials inf, ~ up toa given depree2. Factors 04 Lats
To this section we denote by p a prime number and by & a posite integer.
We wets 2/p' for the tig’ of teers modulo ps and B, for the field
Bike For g= Sua'eBDXT we denote by (ymedp) the polyno
Lla,modp\X'et@/pZILX)
We fix a polynomial feZ[X} of degree m with n>0, and a polynomial he ZX]
that has the folowing properties
an ‘kas leading coefcent 1,
ey hmodp) divides (f mode?) in AHA,
ea (hmod) is iredueiblein FEI,
ea) (meds) doesnot divide (fmodp) in F,{X]
We put depth: s0 0
(25) Proposition. The polynomial f has an reduce factor hn BLN} for whch
(mod p)'deider (homodp), and this factor & uniquely determined p00 sign
Further. g divides fin BUX], then the following three assertions ar equoalet
Ai) thie) ees (geod) i FLX],
(i) (reso) aides tg modpy m Z/e°ZIX).
i) fy ides in BEX].
1m pardcuar henodp) divides (by 089) (2/PM2IX0.
Proof, The existence of hy follows fom (22) and (2.3, and the uniqueness, up £0
1, from (2a), The implications i) > () and (i) (i) are abvious. Now
ssime (i); We prove i and (i, From () and (2 i flows that (top) does
tot divide Jigenody) im F,[X]. Thortore hy does not divide fig in Z[X]. x0
Inust divide g This proves (i By (3) the polynomials (rmodp) and (f;amodp)
ae relatively prime in F,[X1, 0 i F(¥] we have
(6 modp-(hmodp) Hu, mos Slo mod
for certin AseBLX]. Therefore 1,h+y,flgmt—pre for some »,€Z1X]
Muiipiving ths by -rpe, FpPet tat and By 9 we obtain
Agha P= 9mod AEX
for certin iy. :¢2X) Since the eft hand side, when taken modulo pis divisible
by Urinodp the same is true forthe Fight hand side. This proves (i
‘The final assertion of (25) follows if we take gh. This proves (25)
£26) Inthe resaander ofthis section wef an integer m with mand we et L be
the collection ofall polynomials ia ZX) of degree Sm that when taken modulo
ace divisible by (hod ')in (2) P22], This oa subset ofthe (m+ 1-aimensional
Feal vector spice R+RX +... 4X", This ecto space s Wentied with RO"
by ideatiping Fa! with (aya. dq) Notice that he feng |$ aA of aPoms wth Raton Coins @
Polynomial, as defined in the ineroduction, is equal to the ordinary Euetidean
length of (oy dg) Wis easy to see that Ze atice in Rand sing (2D,
that a basis of i piten by
(eX :01<9UIAN!:05)5m—H.
From (1.1 it fellows that d(Z) =p
Ta the following proposition fc asin (25.
(27) Proposition. Let bet satisfy
es) Pile
‘Then i dcsble by hy ZX). and in portcalar ged 0).
Remark. A weaker version of (27), which could also be used to oblain a
polynomial-time factoring algorithia for polynomials, asserts that god( 6) 1
‘under the same conditions. The proof ofthis version ir les complicated than the
proat gien below, se0[8, Theorem 2]
Pronf of (27). We may asume that b¢0. Lat g= ged 8). Ry (25) it suoes to
show that (mod) divides (gmedpl. Suppose that this it not the case. Then by
(23) we have
9)
Pu e=dexlg) ana)
Ma HUF +b: Ane BLN), dog) m, andthe nigorahm stops. 1f yl
Sigh 1/1 thea by (2.13) and (216) we have degth]ssm and.
y= Body Bo nk)
with ¢ asin (2.16, This god can be calculated by repeated application of the
subresultant algorithm described in [7,Set 461] This finishes the deserption of
algrith (3.1.
(0.2) Proposition. The munde of ariehmerc operations needed by algorth (3.1) 5
Ov logph, and th integers on which these operation are performed ch hove
binary fnath Oimkloge)
Proof. We apply (1.26) with m+ Lin the role of wand with B— 1 lp}, From Is
and (2.18) we see shat m= O(log), 50 logl< 1m implies that log B= Otk log
‘This lads to the estimates in (32) tis stiaightforwara to verify thatthe god
compatation atthe end eisties the sams estimates This proves (32)
G3) Nex suppose that, in addition tof and n a prime number p and a
pelyoial he 2(X ] are given such tht (2.122), (23). (24) are satised with
[Eceplaced by 1 Assome thatthe coeficiats of are reduced modulo p. We
Sescrbe an algorithm tht determines hy the itreducble factor off for which
Inmodp) divides (hamodp ef 251
death) If =n then hy =f, and the algorithm stops. Let now l=. We
culate the fast postive integer for which (214) holds wih m replaced by
DP penne
Pu(6.4) Propostion. Denote by m=degth) the degrov of the ireducible factor hy of
F that 8 found by algorithm (3.3). Then the number of zrithmetc operations
ceded by algcrthon (33) 18 Olns? +n" loglf | logp), and the meyers on
Which hese operations are performed eack have binary length O(n? =n loaf
‘ralogp
Proof. From
it follows that
logp=(k~1logp +logp=0(0?+alogl f+ logp)
Let m, te the largest valu of for which algorithm (1.1) is performed. From the
‘hoe of values for mi follows that m, < 2p, and that every other value form
{ht tried of the form m2), with 12. Thezeore we have Lom = Of).
sing (32) we conetude that the total namber of arithmetic operations needed bs
the applications of algorithm (3.1) is Olmglogp, which 3
Omg? + og] +1o9p))
and thatthe integers involved each have binary length Ok log), which is
Oimgir? +nloal/I+loge
‘With some cae it cam be shown thatthe same estimates ate valid foe a suitable
version of Hensel lemma. But itis simpler, and sulfiient for our purpose
‘ple the above estimates by the estimates stazedin (3 using that my Sr then
fvety crude estimate for Hers lemma will do, Tae struightforward verieation
‘sel othe reader, This proves (4,
(35) We now describe an algorithm that factors a given primitive polyeomial
feE{X] of degree n>0 into ireduible factors in 2X]
“The st step is (oeaeslae the resultant RU, of ands derivative fusing
the subrevleant algorthe [7, Sect. 4611 IF UG P}=0 thea f and f have a
areaest common divisor gin Z[X] of positive degree, and gis also caeuated by
‘the subresultent algorithm. This case wil be discussed atthe end ofthe algorithe.
‘Assome now that RULF)#0,
Tn the second step we determine the smatlest prime number p not dividing
(J, and we decompase(f mod into irtedueibe factors in T,[X] by means of
Berkdkam’s lgorihe [7 Set 462}. Notice that Rf. is, upto sgh, equal to
the product of the leading cceffcient of f und the discrimimant of { So
RULf')+0modp ‘implies that (f modp sill bas degsee n, and that it has no
‘muliple factors in F,{X] Therefore (24) is valid for every reducible facie
(hmodp of (F moa) In F, CX
a the thd sep we aufune that we know a decomposition f= ff, in ZIX]
sch thatthe compete fatorizations ff, in LX] and (f,modp) in P,(X] are
known. At the start we can take fy-l, f;—f In this stuation we proceed as
follows If f,~ £1 then f-e +f, iscompleiely factored in BUX], and the algorithm
ops Suppose ow that fy Is postive depree, and choose an iredueilefacior(hmodp) of mod) in F,LX9. We may assume thatthe coefficients of hase
Fede modulo pand that Khas leading coeficient |. The weare i the situation
described atthe start of algorithm (33), with , in the cle off, and we wse that
algoviim to find the iredueiblefictor hy off ZLA for ich (henodp) divides
{homodp). We now replace fy and fs by Fp and fhy respectively, and from the
list ofireducible factors off, modp] we delete those that divide (, modp) After
this we return to the beginning ofthe thd step,
‘This finishes the description of the algorithm in the case that ROG f)40.
Suppose now that Rif. F)=0, let be te goa of f and f in FLX, an put f= 9.
“Then f has no multiple factors in F[XT.s0 Rf, +0, and wea factor fy sing
the main part ofthe algorithm, Since each inedible factor of gn ZL] divide fg
Wwe can now complete the factorization of f= fo bY Tew til divisions This
finishes the desription of algorithm G5)
(8.6 Theorem. The above slgcriton factors any primitive polynomial Fe2LX2 of
postive degree w into Wreducble factors in ZIX). The mamber of arithmetic
operations needed by the algeithn is Otn*-+n* lagi. and the integers on which
these operations are performed eack have binary length Ow +n og\ fl Here | 8
defined tn the introduction,
Using the classical algorithms for the arithmetic operations we now arrive at
the bound O(a'*+n*log/") forthe sumber of bit operations that was ani
‘ed inthe intzoduction. This ean be reduced to Ofn?*-+n? "logl f°) foe cvety
1220; i we employ fast mulipleation techniques
Proof of (36) The comcetnss ofthe egorit is lea fom ity description. To
prove the estimates we first assime that RY f)-0. We begin bs deriving an uppst
bound for p. Since pis the least prime not dividing RUS") we have
an TL asienri
eis not ical to prove tat there i @ positive constant sch that
oa Tae
for all p>2, see (6, Sect. 222): by [12] we cam take A084 for p> 101, From
Hiadamard’s inequality (10) we easly obta
bus Pismisem
‘Combining this with (87) and (3:8) we conde
eo) P