Factorization of polynomials


In mathematics and computer algebra, factorization of polynomials or polynomial factorization expresses a polynomial with coefficients in a given field or in the integers as the product of irreducible factors with coefficients in the same domain. Polynomial factorization is one of the fundamental components of computer algebra systems.
The first polynomial factorization algorithm was published by Theodor von Schubert in 1793. Leopold Kronecker rediscovered Schubert's algorithm in 1882 and extended it to multivariate polynomials and coefficients in an algebraic extension. But most of the knowledge on this topic is not older than circa 1965 and the first computer algebra systems:

When the long-known finite step algorithms were first put on computers, they turned out to be highly inefficient. The fact that almost any uni- or multivariate polynomial of degree up to 100 and with coefficients of a moderate size can be factored by modern algorithms in a few minutes of computer time indicates how successfully this problem has been attacked during the past fifteen years.

Nowadays, modern algorithms and computers can quickly factor [|univariate polynomials] of degree more than 1000 having coefficients with thousands of digits.

Formulation of the question

s over the integers or over a field are unique factorization domains. This means that every element of these rings is a product of a constant and a product of irreducible polynomials. Moreover, this decomposition is unique up to multiplication of the factors by invertible constants.
Factorization depends on the base field. For example, the fundamental theorem of algebra, which states that every polynomial with complex coefficients has complex roots, implies that a polynomial with integer coefficients can be factored into linear factors over the complex field C. Similarly, over the field of reals, the irreducible factors have degree at most two, while there are polynomials of any degree that are irreducible over the field of rationals Q.
The question of polynomial factorization makes sense only for coefficients in a computable field whose every element may be represented in a computer and for which there are algorithms for the arithmetic operations. Fröhlich and Shepherson give examples of such fields for which no factorization algorithm can exist.
The fields of coefficients for which factorization algorithms are known include prime fields and their finitely generated field extensions. Integer coefficients are also tractable. Kronecker's classical method is interesting only from a historical point of view; modern algorithms proceed by a succession of:
and reductions:
In this section, we show that factoring over Q and over Z is essentially the same problem.
The content of a polynomial pZ, denoted "cont", is, up to its sign, the greatest common divisor of its coefficients. The primitive part of p is primpart=p/cont, which is a primitive polynomial with integer coefficients. This defines a factorization of p into the product of an integer and a primitive polynomial. This factorization is unique up to the sign of the content. It is a usual convention to choose the sign of the content such that the leading coefficient of the primitive part is positive.
For example,
is a factorization into content and primitive part.
Every polynomial q with rational coefficients may be written
where pZ and cZ: it suffices to take for c a multiple of all denominators of the coefficients of q and p = cq. The content of q is defined as:
and the primitive part of q is that of p. As for the polynomials with integer coefficients, this defines a factorization into a rational number and a primitive polynomial with integer coefficients. This factorization is also unique up to the choice of a sign.
For example,
is a factorization into content and primitive part.
Gauss proved that the product of two primitive polynomials is also primitive. This implies that a primitive polynomial is irreducible over the rationals if and only if it is irreducible over the integers. This implies also that the factorization over the rationals of a polynomial with rational coefficients is the same as the factorization over the integers of its primitive part. Similarly, the factorization over the integers of a polynomial with integer coefficients is the product of the factorization of its primitive part by the factorization of its content.
In other words, an integer GCD computation reduces the factorization of a polynomial over the rationals to the factorization of a primitive polynomial with integer coefficients, and the factorization over the integers to the factorization of an integer and a primitive polynomial.
Everything that precedes remains true if Z is replaced by a polynomial ring over a field F and Q is replaced by a field of rational functions over F in the same variables, with the only difference that "up to a sign" must be replaced by "up to the multiplication by an invertible constant in F". This reduces the factorization over a purely transcendental field extension of F to the factorization of multivariate polynomials over F.

Square-free factorization

If two or more factors of a polynomial are identical, then the polynomial is a multiple of the square of this factor. In the case of univariate polynomials, this results in multiple roots. In this case, then the multiple factor is also a factor of the polynomial's derivative. In the case of univariate polynomials over the rationals, Yun's algorithm exploits this to efficiently factorize the polynomial into [|square-free] factors, that is, factors that are not a multiple of a square. To factorize the initial polynomial, it suffices to factorize each square-free factor. Square-free factorization is therefore the first step in most polynomial factorization algorithms.
Yun's algorithm extends this to the multivariate case by considering a multivariate polynomial as a univariate polynomial over a polynomial ring.
In the case of a polynomial over a finite field, Yun's algorithm applies only if the degree is smaller than the characteristic, because, otherwise, the derivative of a non-zero polynomial may be zero. Nevertheless, a succession of GCD computations, starting from the polynomial and its derivative, allows one to compute the square-free decomposition; see Polynomial factorization over finite fields#Square-free factorization.

Classical methods

This section describes textbook methods that can be convenient when computing by hand. These methods are not used for computer computations because they use integer factorization, which is currently slower than polynomial factorization.

Obtaining linear factors

All linear factors with rational coefficients can be found using the rational root test. If the polynomial to be factored is, then all possible linear factors are of the form, where is an integer factor of and is an integer factor of. All possible combinations of integer factors can be tested for validity, and each valid one can be factored out using polynomial long division. If the original polynomial is the product of factors at least two of which are of degree 2 or higher, this technique only provides a partial factorization; otherwise the factorization is complete. In particular, if there is exactly one non-linear factor, it will be the polynomial left after all linear factors have been factorized out. In the case of a cubic polynomial, if the cubic is factorizable at all, the rational root test gives a complete factorization, either into a linear factor and an irreducible quadratic factor, or into three linear factors.

Kronecker's method

Since integer polynomials must factor into integer polynomial factors, and evaluating integer polynomials at integer values must produce integers, the integer values of a polynomial can be factored in only a finite number of ways, and produce only a finite number of possible polynomial factors.
For example, consider
If this polynomial factors over Z, then at least one of its factors must be of degree two or less. We need three values to uniquely fit a second degree polynomial. We'll use, and. If one of those values is 0, then we have found a root. If none are 0, then each one has a finite number of divisors. Now, 2 can only factor as
Therefore, if a second degree integer polynomial factor exists, it must take one of the values
at, and likewise at. There are eight different ways to factor 6, so there are
possible combinations, of which half can be discarded as the negatives of the other half, corresponding to 64 possible second degree integer polynomials that must be checked. These are the only possible integer polynomial factors of. Testing them exhaustively reveals that
constructed from, and, factors.
Dividing by gives the other factor, so that.
Now one can test recursively to find factors of and. It turns out they both are irreducible over the integers, so that the irreducible factorization of is

Modern methods

Factoring over finite fields

Factoring univariate polynomials over the integers

If is a univariate polynomial over the integers, assumed
to be [|content-free]
and square-free, one starts by computing a bound
such that any factor has coefficients of
absolute value bounded by. This way, if is
an integer larger than, and if is known modulo
, then can be reconstructed from its image mod.
The Zassenhaus algorithm proceeds as follows. First, choose a prime
number such that the image of mod
remains square-free, and of the same degree as.
Then factor mod. This produces integer polynomials whose product matches mod. Next, apply Hensel lifting; this updates the in such a way that their product matches mod, where is chosen in such a way that is larger than. Modulo, the polynomial has factors: for each subset of, the product is a factor of mod. However, a factor modulo need not correspond to a so-called "true factor": a factor of in. For each factor mod, we can test if it corresponds to a "true" factor, and if so, find that "true" factor, provided that exceeds.
This way, all irreducible "true" factors can be found by checking at most cases. This is reduced to cases by skipping complements. If is reducible, the number of cases is reduced further by removing those that appear in an already found "true" factor. Zassenhaus algorithm processes each case quickly, however, in the worst case, it considers an exponential number of cases.
The first polynomial time algorithm for factoring rational polynomials was discovered by Lenstra, Lenstra and Lovász and is an application of Lenstra–Lenstra–Lovász lattice basis reduction algorithm, the "LLL algorithm".
A simplified version of the LLL factorization algorithm is as follows: calculate a complex root α of the polynomial to high precision, then use the Lenstra–Lenstra–Lovász lattice basis reduction algorithm to find an approximate linear relation between 1, α, α2, α3,... with integer coefficients, which might be an exact linear relation and a polynomial factor of. One can determine a bound for the precision that guarantees that this method produces either a factor, or an irreducibility proof. Although this method is polynomial time, it is not used in practice because the lattice has high dimension and huge entries, which makes the computation slow.
The exponential complexity in the algorithm of Zassenhaus comes from a combinatorial problem: how to select the right subsets of. State of the art factoring implementations work in a manner similar to Zassenhaus, except that the combinatorial problem is translated to a lattice problem that is then solved by LLL. In this approach, LLL is not used to compute coefficients of factors, instead, it is used to compute vectors with entries in that encode the subsets of that correspond to the irreducible "true" factors.

Factoring over algebraic extensions (Trager's method)

We can factor a polynomial, where the field is a finite extension of. First, using [|square-free factorization], we may suppose that the polynomial is square-free. Next we write explicitly as an algebra over. We next pick a random element. By the primitive element theorem, generates over with high probability. If this is the case, we can compute the minimal polynomial, of over. Factoring
over, we determine that
, where corresponds to the element. Note that this is the unique decomposition of as a product of fields. Hence this decomposition is the same as
where
is the factorization of over. By writing and generators of as a polynomials in, we can determine the embeddings of and into the components. By finding the minimal polynomial of in this ring, we have computed, and thus factored over