1.5 Factoring polynomials

The following results help in deciding whether a polynomial is reducible, and in finding its factors.

Proposition 1.11

Let rr\in\mathbb{Q}{} be a root of a polynomial

amXm+am1Xm1++a0,ai,a_{m}X^{m}+a_{m-1}X^{m-1}+\cdots+a_{0},\quad a_{i}\in\mathbb{Z},

and write r=c/dr=c/d, c,dc,d\in\mathbb{Z}, gcd(c,d)=1\gcd(c,d)=1. Then c|a0c|a_{0} and d|am.d|a_{m}.

Proof.

It is clear from the equation

amcm+am1cm1d++a0dm=0a_{m}c^{m}+a_{m-1}c^{m-1}d+\cdots+a_{0}d^{m}=0

that d|amcmd|a_{m}c^{m}, and therefore, d|am.d|a_{m}. Similarly, c|a0c|a_{0}.

Example 1.12

The polynomial f(X)=X33X1f(X)=X^{3}-3X-1 is irreducible in [X]\mathbb{Q}[X] because its only possible roots are ±1\pm 1, and f(1)0f(1)f(1)\neq 0\neq f(-1).

Proposition 1.13 (Gauss’s Lemma)

Let f(X)[X]f(X)\in\mathbb{Z}[X]. If f(X)f(X) factors nontrivially in [X]\mathbb{Q}[X], then it factors nontrivially in [X]\mathbb{Z}{}[X].

Proof.

Let f=ghf=gh in [X]\mathbb{Q}{}[X] with g,hg,h nonconstant. For suitable integers mm and nn, g1=defmgg_{1}\overset{\smash{\lower 1.31395pt\hbox{{def}}}}{=}mg and h1=defnhh_{1}\overset{\smash{\lower 1.31395pt\hbox{{def}}}}{=}nh have coefficients in \mathbb{Z}{}, and so we have a factorization

mnf=g1h1 in [X].mnf=g_{1}\cdot h_{1}\text{ in }\mathbb{Z}{}[X]\text{.}

If a prime pp divides mnmn, then, looking modulo pp, we obtain an equation

0=g1¯h1¯ in 𝔽[X]p.0=\overline{g_{1}}\cdot\overline{h_{1}}\text{ in }\mathbb{F}{}_{p}[X]\text{.}

Since 𝔽p[X]\mathbb{F}_{p}[X] is an integral domain, this implies that pp divides all the coefficients of at least one of the polynomials g1,h1g_{1},h_{1}, say g1g_{1}, so that g1=pg2g_{1}=pg_{2} for some g2[X]g_{2}\in\mathbb{Z}[X]. Thus, we have a factorization

(mn/p)f=g2h1 in [X].(mn/p)f=g_{2}\cdot h_{1}\text{ in }\mathbb{Z}{}[X]\text{.}

Continuing in this fashion, we eventually remove all the prime factors of mnmn, and so obtain a nontrivial factorization of ff in [X]\mathbb{Z}{}[X].

Proposition 1.14

If f[X]f\in\mathbb{Z}[X] is monic, then every monic factor of ff in [X]\mathbb{Q}[X] lies in [X]\mathbb{Z}[X].

Proof.

Let gg be a monic factor of ff in [X]\mathbb{Q}{}[X], so that f=ghf=gh with h[X]h\in\mathbb{Q}{}[X] also monic. Let m,nm,n be the positive integers with the fewest prime factors such that mg,nh[X]mg,nh\in\mathbb{Z}{}[X]. As in the proof of Gauss’s Lemma, if a prime pp divides mnmn, then it divides all the coefficients of at least one of the polynomials mg,nhmg,nh, say mgmg, in which case it divides mm because gg is monic. Now mpg[X]\frac{m}{p}g\in\mathbb{Z}[X], which contradicts the definition of mm.

Aside 1.15

We sketch an alternative proof of Proposition 1.14. A complex number α\alpha is said to be an algebraic integer if it is a root of a monic polynomial in [X]\mathbb{Z}{}[X]. Proposition 1.11 shows that every algebraic integer in \mathbb{Q}{} lies in \mathbb{Z}. The algebraic integers form a subring of \mathbb{C}{} — see Theorem 6.5 of my notes on Commutative Algebra. Now let α1,,αm\alpha_{1},\ldots,\alpha_{m} be the roots of ff in \mathbb{C}{}. By definition, they are algebraic integers, and the coefficients of any monic factor of ff are polynomials in (certain of) the αi\alpha_{i}, and therefore are algebraic integers. If they lie in \mathbb{Q}{}, then they lie in \mathbb{Z}{}.

Proposition 1.16 (Eisenstein’s criterion)

Let

f=amXm+am1Xm1++a0,ai;f=a_{m}X^{m}+a_{m-1}X^{m-1}+\cdots+a_{0},\quad a_{i}\in\mathbb{Z};

suppose that there is a prime pp such that:

  • \diamond  

    pp does not divide ama_{m},

  • \diamond  

    pp divides am1,,a0a_{m-1},...,a_{0},

  • \diamond  

    p2p^{2} does not divide a0a_{0}.

Then ff is irreducible in [X]\mathbb{Q}[X].

Proof.

If f(X)f(X) factors nontrivially in [X]\mathbb{Q}[X], then it factors nontrivially in [X]\mathbb{Z}[X], say,

amXm+am1Xm1++a0=(brXr++b0)(csXs++c0)a_{m}X^{m}+a_{m-1}X^{m-1}+\cdots+a_{0}=(b_{r}X^{r}+\cdots+b_{0})(c_{s}X^{s}+% \cdots+c_{0})

with bi,cib_{i},c_{i}\in\mathbb{Z} and r,s<mr,s<m. Since pp, but not p2p^{2}, divides a0=b0c0a_{0}=b_{0}c_{0}, pp must divide exactly one of b0b_{0}, c0c_{0}, say, b0b_{0}. Now from the equation

a1=b0c1+b1c0,a_{1}=b_{0}c_{1}+b_{1}c_{0},

we see that p|b1,p|b_{1}, and from the equation

a2=b0c2+b1c1+b2c0,a_{2}=b_{0}c_{2}+b_{1}c_{1}+b_{2}c_{0},

that p|b2p|b_{2}. By continuing in this way, we find that pp divides b0,b1,,brb_{0},b_{1},\ldots,b_{r}, which contradicts the condition that pp does not divide ama_{m}.

The last three propositions hold mutatis mutandis with \mathbb{Z} replaced by a unique factorization domain RR (replace \mathbb{Q}{} with the field of fractions of RR and pp with a prime element of RR).

Remark 1.17

There is an algorithm for factoring a polynomial in [X]\mathbb{Q}[X]. To see this, consider f[X]f\in\mathbb{Q}[X]. Multiply f(X)f(X) by a rational number so that it is monic, and then replace it by Ddeg(f)f(XD)D^{\deg(f)}f(\frac{X}{D}), with DD equal to a common denominator for the coefficients of ff, to obtain a monic polynomial with integer coefficients. Thus we need consider only polynomials

f(X)=Xm+a1Xm1++am,ai.f(X)=X^{m}+a_{1}X^{m-1}+\cdots+a_{m},\quad a_{i}\in\mathbb{Z}.

From the fundamental theorem of algebra (see LABEL:ag5 below), we know that ff splits completely in [X]\mathbb{C}[X]:

f(X)=i=1m(Xαi),αi.f(X)=\prod_{i=1}^{m}(X-\alpha_{i}),\quad\alpha_{i}\in\mathbb{C}.

From the equation

0=f(αi)=αim+a1αim1++am,0=f(\alpha_{i})=\alpha_{i}^{m}+a_{1}\alpha_{i}^{m-1}+\cdots+a_{m}\text{,}

it follows that |αi||\alpha_{i}| is less than some bound depending only on the degree and coefficients of ff; in fact,

|αi|max{1,mB}B=max|ai|.|\alpha_{i}|\leq\max\{1,mB\}\text{, }B=\max|a_{i}|\text{.}

Now if g(X)g(X) is a monic factor of f(X)f(X), then its roots in \mathbb{C} are certain of the αi\alpha_{i}, and its coefficients are symmetric polynomials in its roots (see p. LABEL:sympol). Therefore, the absolute values of the coefficients of g(X)g(X) are bounded in terms of the degree and coefficients of ff. Since they are also integers (by 1.14), we see that there are only finitely many possibilities for g(X)g(X). Thus, to find the factors of f(X)f(X) we (better PARI) have to do only a finite amount of checking.33 3 Of course, there are much faster methods than this. The Berlekamp–Zassenhaus algorithm factors the polynomial over certain suitable finite fields 𝔽p\mathbb{F}{}_{p}, lifts the factorizations to rings /pm\mathbb{Z}{}/p^{m}\mathbb{Z} for some mm, and then searches for factorizations in [X]\mathbb{Z}{}[X] with the correct form modulo pmp^{m}.

Therefore, we need not concern ourselves with the problem of factoring polynomials in the rings [X]\mathbb{Q}[X] or 𝔽p[X]\mathbb{F}_{p}[X] since PARI knows how to do it. For example, typing content(6*X^2+18*X-24) in PARI returns 6, and factor(6*X^2+18*X-24) returns X1X-1 and X+4X+4, showing that

6X2+18X24=6(X1)(X+4)6X^{2}+18X-24=6(X-1)(X+4)

in [X]\mathbb{Q}[X]. Typing factormod(X^2+3*X+3,7) returns X+4X+4 and X+6X+6, showing that

X2+3X+3=(X+4)(X+6)X^{2}+3X+3=(X+4)(X+6)

in 𝔽7[X]\mathbb{F}_{7}[X].

Remark 1.18

One other observation is useful. Let f[X]f\in\mathbb{Z}[X]. If the leading coefficient of ff is not divisible by a prime pp, then a nontrivial factorization f=ghf=gh in [X]\mathbb{Z}{}[X] will give a nontrivial factorization f¯=g¯h¯\bar{f}=\bar{g}\bar{h} in 𝔽[X]p\mathbb{F}{}_{p}[X]. Thus, if f(X)f(X) is irreducible in 𝔽p[X]\mathbb{F}_{p}[X] for some prime pp not dividing its leading coefficient, then it is irreducible in [X]\mathbb{Z}{}[X]. This test is very useful, but it is not always effective: for example, X410X2+1X^{4}-10X^{2}+1 is irreducible in [X]\mathbb{Z}{}[X] but it is reducible44 4 Here is a proof using only that the product of two nonsquares in 𝔽p×\mathbb{F}{}_{p}^{\times} is a square, which follows from the fact that 𝔽p×\mathbb{F}{}_{p}^{\times} is cyclic (see Exercise 1-3). If 22 is a square in 𝔽p\mathbb{F}{}_{p}, then X410X2+1=(X222X1)(X2+22X1).X^{4}-10X^{2}+1=(X^{2}-2\sqrt{2}X-1)(X^{2}+2\sqrt{2}X-1). If 33 is a square in 𝔽p\mathbb{F}{}_{p}, then X410X2+1=(X223X+1)(X2+23X+1).X^{4}-10X^{2}+1=(X^{2}-2\sqrt{3}X+1)(X^{2}+2\sqrt{3}X+1). If neither 22 nor 33 are squares, 66 will be a square in 𝔽p\mathbb{F}{}_{p}, and X410X2+1=(X2(5+26))(X2(526)).X^{4}-10X^{2}+1=(X^{2}-(5+2\sqrt{6}))(X^{2}-(5-2\sqrt{6})). The general study of such polynomials requires nonelementary methods. See, for example, the paper Brandl, AMM, 93 (1986), pp. 286–288, which proves that for every composite integer n1n\geq 1, there exists a polynomial in [X]\mathbb{Z}{}[X] of degree nn that is irreducible over \mathbb{Z} but reducible modulo all primes. modulo every prime pp.