Misplaced Pages

Factorization of polynomials

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
(Redirected from Polynomial factorization) Computational method This article is about factorization algorithms. For paper-and-pencil methods, see Factorization § 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 (up to 100 bits) 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. (Erich Kaltofen, 1982)

Modern algorithms and computers can quickly factor univariate polynomials of degree more than 1000 having coefficients with thousands of digits. For this purpose, even for factoring over the rational numbers and number fields, a fundamental step is a factorization of a polynomial over a finite field.

Formulation of the question

Polynomial rings 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 (those that are not the product of two non-constant 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 (with root-finding algorithms) 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. However, this is not a sufficient condition: Fröhlich and Shepherdson 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 (that is, the field of the rational number and the fields of the integers modulo a prime number) 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:

  • Square-free factorization
  • Factorization over finite fields

and reductions:

  • From the multivariate case to the univariate case.
  • From coefficients in a purely transcendental extension to the multivariate case over the ground field (see below).
  • From coefficients in an algebraic extension to coefficients in the ground field (see below).
  • From rational coefficients to integer coefficients (see below).
  • From integer coefficients to coefficients in a prime field with p elements, for a well chosen p (see below).

Primitive part–content factorization

See also: Content (algebra) and Gauss's lemma (polynomial)

In this section, we show that factoring over Q (the rational numbers) and over Z (the integers) is essentially the same problem.

The content of a polynomial pZ, denoted "cont(p)", is, up to its sign, the greatest common divisor of its coefficients. The primitive part of p is primpart(p) = p/cont(p), 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,

10 x 2 + 5 x + 5 = ( 5 ) ( 2 x 2 x 1 ) {\displaystyle -10x^{2}+5x+5=(-5)(2x^{2}-x-1)\,}

is a factorization into content and primitive part.

Every polynomial q with rational coefficients may be written

q = p c , {\displaystyle q={\frac {p}{c}},}

where pZ and cZ: it suffices to take for c a multiple of all denominators of the coefficients of q (for example their product) and p = cq. The content of q is defined as:

cont ( q ) = cont ( p ) c , {\displaystyle {\text{cont}}(q)={\frac {{\text{cont}}(p)}{c}},}

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,

x 5 3 + 7 x 2 2 + 2 x + 1 = 2 x 5 + 21 x 2 + 12 x + 6 6 {\displaystyle {\frac {x^{5}}{3}}+{\frac {7x^{2}}{2}}+2x+1={\frac {2x^{5}+21x^{2}+12x+6}{6}}}

is a factorization into content and primitive part.

Gauss proved that the product of two primitive polynomials is also primitive (Gauss's lemma). 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

Main article: Square-free polynomial

If two or more factors of a polynomial are identical, then the polynomial is a multiple of the square of this factor. The multiple factor is also a factor of the polynomial's derivative (with respect to any of the variables, if several).

For univariate polynomials, multiple factors are equivalent to multiple roots (over a suitable extension field). For univariate polynomials over the rationals (or more generally over a field of characteristic zero), 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, performing a sequence of GCD computations starting with gcd(f(x), f '(x)). 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 (over the field with p elements, the derivative of a polynomial in x is always 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.

The two methods that follow start from a univariate polynomial with integer coefficients for finding factors that are also polynomials with integer coefficients.

Obtaining linear factors

All linear factors with rational coefficients can be found using the rational root test. If the polynomial to be factored is a n x n + a n 1 x n 1 + + a 1 x + a 0 {\displaystyle a_{n}x^{n}+a_{n-1}x^{n-1}+\cdots +a_{1}x+a_{0}} , then all possible linear factors are of the form b 1 x b 0 {\displaystyle b_{1}x-b_{0}} , where b 1 {\displaystyle b_{1}} is an integer factor of a n {\displaystyle a_{n}} and b 0 {\displaystyle b_{0}} is an integer factor of a 0 {\displaystyle a_{0}} . 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

Kronecker's method is aimed to factor univariate polynomials with integer coefficients into polynomials with integer coefficients.

The method uses the fact that evaluating integer polynomials at integer values must produce integers. That is, if f ( x ) {\displaystyle f(x)} is a polynomial with integer coefficients, then f ( a ) {\displaystyle f(a)} is an integer as soon as a is an integer. There are only a finite number of possible integer values for a factor of a. So, if g ( x ) {\displaystyle g(x)} is a factor of f ( x ) , {\displaystyle f(x),} the value of g ( a ) {\displaystyle g(a)} must be one of the factors of f ( a ) . {\displaystyle f(a).}

If one searches for all factors of a given degree d, one can consider d + 1 {\displaystyle d+1} values, a 0 , , a d {\displaystyle a_{0},\ldots ,a_{d}} for a, which give a finite number of possibilities for the tuple ( f ( a 0 ) , , f ( a d ) ) . {\displaystyle (f(a_{0}),\ldots ,f(a_{d})).} Each f ( a i ) {\displaystyle f(a_{i})} has a finite number of divisors b i , 0 , , b i , k i {\displaystyle b_{i,0},\ldots ,b_{i,k_{i}}} , and, each ( d + 1 ) {\displaystyle (d+1)} -tuple where the i th {\displaystyle i^{\text{th}}} entry is a divisor of f ( a i ) {\displaystyle f(a_{i})} , that is, a tuple of the form ( b 0 , j 1 , , b d , j d ) {\displaystyle (b_{0,j_{1}},\ldots ,b_{d,j_{d}})} , produces a unique polynomial of degree at most d {\displaystyle d} , which can be computed by polynomial interpolation. Each of these polynomials can be tested for being a factor by polynomial division. Since there were finitely many a i {\displaystyle a_{i}} and each f ( a i ) {\displaystyle f(a_{i})} has finitely many divisors, there are finitely many such tuples. So, an exhaustive search allows finding all factors of degree at most d.

For example, consider

f ( x ) = x 5 + x 4 + x 2 + x + 2 {\displaystyle f(x)=x^{5}+x^{4}+x^{2}+x+2} .

If this polynomial factors over Z, then at least one of its factors p ( x ) {\displaystyle p(x)} must be of degree two or less, so p ( x ) {\displaystyle p(x)} is uniquely determined by three values. Thus, we compute three values f ( 0 ) = 2 {\displaystyle f(0)=2} , f ( 1 ) = 6 {\displaystyle f(1)=6} and f ( 1 ) = 2 {\displaystyle f(-1)=2} . If one of these values is 0, we have a linear factor. If the values are nonzero, we can list the possible factorizations for each. Now, 2 can only factor as

1×2, 2×1, (−1)×(−2), or (−2)×(−1).

Therefore, if a second degree integer polynomial factor exists, it must take one of the values

p(0) = 1, 2, −1, or −2

and likewise for p(1). There are eight factorizations of 6 (four each for 1×6 and 2×3), making a total of 4×4×8 = 128 possible triples (p(0), p(1), p(−1)), of which half can be discarded as the negatives of the other half. Thus, we must check 64 explicit integer polynomials p ( x ) = a x 2 + b x + c {\displaystyle p(x)=ax^{2}+bx+c} as possible factors of f ( x ) {\displaystyle f(x)} . Testing them exhaustively reveals that

p ( x ) = x 2 + x + 1 {\displaystyle p(x)=x^{2}+x+1}

constructed from (g(0), g(1), g(−1)) = (1,3,1) factors f ( x ) {\displaystyle f(x)} .

Dividing f(x) by p(x) gives the other factor q ( x ) = x 3 x + 2 {\displaystyle q(x)=x^{3}-x+2} , so that f ( x ) = p ( x ) q ( x ) {\displaystyle f(x)=p(x)q(x)} . Now one can test recursively to find factors of p(x) and q(x), in this case using the rational root test. It turns out they are both irreducible, so the irreducible factorization of f(x) is:

f ( x ) = p ( x ) q ( x ) = ( x 2 + x + 1 ) ( x 3 x + 2 ) . {\displaystyle f(x)=p(x)q(x)=(x^{2}+x+1)(x^{3}-x+2).}

Modern methods

Factoring over finite fields

Main articles: Factorization of polynomials over finite fields, Berlekamp's algorithm, and Cantor–Zassenhaus algorithm

Factoring univariate polynomials over the integers

If f ( x ) {\displaystyle f(x)} is a univariate polynomial over the integers, assumed to be content-free and square-free, one starts by computing a bound B {\displaystyle B} such that any factor g ( x ) {\displaystyle g(x)} has coefficients of absolute value bounded by B {\displaystyle B} . This way, if m {\displaystyle m} is an integer larger than 2 B {\displaystyle 2B} , and if g ( x ) {\displaystyle g(x)} is known modulo m {\displaystyle m} , then g ( x ) {\displaystyle g(x)} can be reconstructed from its image mod m {\displaystyle m} .

The Zassenhaus algorithm proceeds as follows. First, choose a prime number p {\displaystyle p} such that the image of f ( x ) mod p {\displaystyle f(x){\bmod {p}}} remains square-free, and of the same degree as f ( x ) {\displaystyle f(x)} . Then factor f ( x ) mod p {\displaystyle f(x){\bmod {p}}} . This produces integer polynomials f 1 ( x ) , , f r ( x ) {\displaystyle f_{1}(x),\ldots ,f_{r}(x)} whose product matches f ( x ) mod p {\displaystyle f(x){\bmod {p}}} . Next, apply Hensel lifting; this updates the f i ( x ) {\displaystyle f_{i}(x)} in such a way that their product matches f ( x ) mod p a {\displaystyle f(x){\bmod {p}}^{a}} , where a {\displaystyle a} is large enough that p a {\displaystyle p^{a}} exceeds 2 B {\displaystyle 2B} : thus each f i ( x ) {\displaystyle f_{i}(x)} corresponds to a well-defined integer polynomial. Modulo p a {\displaystyle p^{a}} , the polynomial f ( x ) {\displaystyle f(x)} has 2 r {\displaystyle 2^{r}} factors (up to units): the products of all subsets of { f 1 ( x ) , , f r ( x ) } mod p a {\displaystyle \{f_{1}(x),\ldots ,f_{r}(x)\}{\bmod {p}}^{a}} . These factors modulo p a {\displaystyle p^{a}} need not correspond to "true" factors of f ( x ) {\displaystyle f(x)} in Z [ x ] {\displaystyle \mathbb {Z} } , but we can easily test them by division in Z [ x ] {\displaystyle \mathbb {Z} } . This way, all irreducible true factors can be found by checking at most 2 r {\displaystyle 2^{r}} cases, reduced to 2 r 1 {\displaystyle 2^{r-1}} cases by skipping complements. If f ( x ) {\displaystyle f(x)} is reducible, the number of cases is reduced further by removing those f i ( x ) {\displaystyle f_{i}(x)} that appear in an already found true factor. The Zassenhaus algorithm processes each case (each subset) 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 the Lenstra–Lenstra–Lovász lattice basis reduction (LLL) algorithm (Lenstra, Lenstra & Lovász 1982). A simplified version of the LLL factorization algorithm is as follows: calculate a complex (or p-adic) root α of the polynomial f ( x ) {\displaystyle f(x)} to high precision, then use the Lenstra–Lenstra–Lovász lattice basis reduction algorithm to find an approximate linear relation between 1, α, α, α, . . . with integer coefficients, which might be an exact linear relation and a polynomial factor of f ( x ) {\displaystyle f(x)} . One can determine a bound for the precision that guarantees that this method produces either a factor, or an irreducibility proof. Although this method finishes in 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 Zassenhaus algorithm comes from a combinatorial problem: how to select the right subsets of f 1 ( x ) , , f r ( x ) {\displaystyle f_{1}(x),\ldots ,f_{r}(x)} . 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, but rather to compute vectors with r {\displaystyle r} entries in {0,1} that encode the subsets of f 1 ( x ) , , f r ( x ) {\displaystyle f_{1}(x),\ldots ,f_{r}(x)} corresponding to the irreducible true factors.

Factoring over algebraic extensions (Trager's method)

We can factor a polynomial p ( x ) K [ x ] {\displaystyle p(x)\in K} , where the field K {\displaystyle K} is a finite extension of Q {\displaystyle \mathbb {Q} } . First, using square-free factorization, we may suppose that the polynomial is square-free. Next we define the quotient ring L = K [ x ] / p ( x ) {\displaystyle L=K/p(x)} of degree n = [ L : Q ] = deg p ( x ) [ K : Q ] {\displaystyle n==\deg p(x)\,} ; this is not a field unless p ( x ) {\displaystyle p(x)} is irreducible, but it is a reduced ring since p ( x ) {\displaystyle p(x)} is square-free. Indeed, if

p ( x ) = i = 1 m p i ( x ) {\displaystyle p(x)=\prod _{i=1}^{m}p_{i}(x)}

is the desired factorization of p(x), the ring decomposes uniquely into fields as:

L = K [ x ] / p ( x ) i = 1 m K [ x ] / p i ( x ) . {\displaystyle L=K/p(x)\cong \prod _{i=1}^{m}K/p_{i}(x).}

We will find this decomposition without knowing the factorization. First, we write L explicitly as an algebra over Q {\displaystyle \mathbb {Q} } : we pick a random element α L {\displaystyle \alpha \in L} , which generates L {\displaystyle L} over Q {\displaystyle \mathbb {Q} } with high probability by the primitive element theorem. If this is the case, we can compute the minimal polynomial q ( y ) Q [ y ] {\displaystyle q(y)\in \mathbb {Q} } of α {\displaystyle \alpha } over Q {\displaystyle \mathbb {Q} } , by finding a Q {\displaystyle \mathbb {Q} } -linear relation among 1, α, . . . , α. Using a factoring algorithm for rational polyomials, we factor into irreducibles in Q [ y ] {\displaystyle \mathbb {Q} } :

q ( y ) = i = 1 n q i ( y ) . {\displaystyle q(y)=\prod _{i=1}^{n}q_{i}(y).}

Thus we have:

L Q [ y ] / q ( y ) i = 1 n Q [ y ] / q i ( y ) , {\displaystyle L\cong \mathbb {Q} /q(y)\cong \prod _{i=1}^{n}\mathbb {Q} /q_{i}(y),}

where α {\displaystyle \alpha } corresponds to y ( y , y , , y ) {\displaystyle y\leftrightarrow (y,y,\ldots ,y)} . This must be isomorphic to the previous decomposition of L {\displaystyle L} .

The generators of L are x along with the generators of K {\displaystyle K} over Q {\displaystyle \mathbb {Q} } ; writing these as a polynomials in α {\displaystyle \alpha } , we can determine the embeddings of x {\displaystyle x} and K {\displaystyle K} into each component Q [ y ] / q i ( y ) = K [ x ] / p i ( x ) {\displaystyle \mathbb {Q} /q_{i}(y)=K/p_{i}(x)} . By finding the minimal polynomial of x {\displaystyle x} in Q [ y ] / q i ( y ) {\displaystyle \mathbb {Q} /q_{i}(y)} , we compute p i ( x ) {\displaystyle p_{i}(x)} , and thus factor p ( x ) {\displaystyle p(x)} over K . {\displaystyle K.}

Numerical factorization

This section relies excessively on references to primary sources. Please improve this section by adding secondary or tertiary sources.
Find sources: "Factorization of polynomials" – news · newspapers · books · scholar · JSTOR (January 2023) (Learn how and when to remove this message)

"Numerical factorization" refers commonly to the factorization of polynomials with real or complex coefficients, whose coefficients are only approximately known, generally because they are represented as floating point numbers.

For univariate polynomials with complex coefficients, factorization can easily be reduced to numerical computation of polynomial roots and multiplicities.

In the multivariate case, a random infinitesimal perturbation of the coefficients produces with probability one an irreducible polynomial, even when starting from a polynomial with many factors. So, the very meaning of numerical factorization needs to be clarified precisely.

Let p {\displaystyle p} be a polynomial with complex coefficients with an irreducible factorization

p = α p 1 m 1 p k m k {\displaystyle p=\alpha p_{1}^{m_{1}}\cdots p_{k}^{m_{k}}}

where α C {\displaystyle \alpha \in C} and the factors p 1 , , p k {\displaystyle p_{1},\ldots ,p_{k}} are irreducible polynomials with complex coefficients. Assume that p {\displaystyle p} is approximated through a polynomial p ~ {\displaystyle {\tilde {p}}} whose coefficients are close to those of p {\displaystyle p} . The exact factorization of p ~ {\displaystyle {\tilde {p}}} is pointless, since it is generally irreducible. There are several possible definitions of what can be called a numerical factorization of p ~ . {\displaystyle {\tilde {p}}.}

If k {\displaystyle k} and m i {\displaystyle m_{i}} 's are known, an approximate factorization consists of finding a polynomial close to p ~ {\displaystyle {\tilde {p}}} that factors as above. If one does not know the factorization scheme, identifying m 1 , , m k {\displaystyle m_{1},\ldots ,m_{k}} becomes necessary. For example, the number of irreducible factors of a polynomial is the nullity of its Ruppert matrix. Thus the multiplicities m 1 , , m k {\displaystyle m_{1},\ldots ,m_{k}} can be identified by square-free factorization via numerical GCD computation and rank-revealing on Ruppert matrices.

Several algorithms have been developed and implemented for numerical factorization as an on-going subject of research.

See also

Bibliography

  1. FT Schubert: De Inventione Divisorum Nova Acta Academiae Scientiarum Petropolitanae v.11, pp. 172–182(1793)
  2. Kaltofen (1982)
  3. An example of degree 2401, taking 7.35 seconds, is found in Section 4 in: Hart, van Hoeij, Novocin: Practical Polynomial Factoring in Polynomial Time ISSAC'2011 Proceedings, pp. 163–170 (2011).
  4. Fröhlich, A.; Shepherdson, J. C. (1955). "On the factorisation of polynomials in a finite number of steps". Mathematische Zeitschrift. 62 (1): 331–334. doi:10.1007/bf01180640. ISSN 0025-5874. S2CID 119955899.
  5. Van der Waerden, Sections 5.4 and 5.6
  6. M. van Hoeij: Factoring polynomials and the knapsack problem. Journal of Number Theory, 95, 167–189, (2002).
  7. Ruppert, W. (1999). "Reducibility of polynomials f(x,y)". J. Number Theory. 77: 62–70. arXiv:math/9808021. doi:10.1006/jnth.1999.2381. S2CID 14316123.

    Shaker, H. (2009). "Topology and factorization of polynomials". Math. Scand. 104: 51–59. arXiv:0704.3363. doi:10.7146/math.scand.a-15084. S2CID 14121840.

  8. For example: W. Wu and Z. Zeng (2017). "The numerical factorization of polynomials". Foundations of Computational Mathematics. 17: 259–286. arXiv:2103.04888. doi:10.1007/s10208-015-9289-1. S2CID 254171366.
  9. E. Kaltofen, J.P. May, Z. Yang and L. Zhi (2008). "Approximate factorization of multivariate polynomials using singular value decomposition". J. Symbolic Comput. 43 (5): 359–376. doi:10.1016/j.jsc.2007.11.005.{{cite journal}}: CS1 maint: multiple names: authors list (link)

Further reading

  • Kaltofen, Erich (1990), "Polynomial Factorization 1982-1986", in D. V. Chudnovsky; R. D. Jenks (eds.), Computers in Mathematics, Lecture Notes in Pure and Applied Mathematics, vol. 125, Marcel Dekker, Inc., CiteSeerX 10.1.1.68.7461
  • Kaltofen, Erich (1992), "Polynomial Factorization 1987–1991" (PDF), Proceedings of Latin '92, Springer Lect. Notes Comput. Sci., vol. 583, Springer, retrieved October 14, 2012
  • Ivanyos, Gabor; Marek, Karpinski; Saxena, Nitin (2009). "Schemes for deterministic polynomial factoring". Proceedings of the 2009 international symposium on Symbolic and algebraic computation. pp. 191–198. arXiv:0804.1974. doi:10.1145/1576702.1576730. ISBN 9781605586090. S2CID 15895636.
Polynomials and polynomial functions
By degree
By properties
Tools and algorithms
Categories: