factor - Maple Programming Help

factor

factor a multivariate polynomial

 Calling Sequence factor(a) factor(a, K) factor(f, method="Wang")

Parameters

 a - expression K - field extension over which to factor f - multivariate polynomial with rational coefficients method - (optional) equation method="Wang"

Description

 • The factor function computes the factorization of a multivariate polynomial with integer, rational, (complex) numeric, or algebraic number coefficients.
 • The factor function does NOT factor integers. Nor does it factor integer coefficients in a polynomial. Use the ifactor function to factor integers.
 • For multivariate polynomials with integer coefficients, the factor command offers two algorithms: Wang's algorithm (see [Wang78]) and the algorithm by Monagan and Tuncer ([MT16]). The default is the latter, since it is faster on most examples. To explicitly request Wang's algorithm, which was the default in Maple 2018 and earlier versions, use the option method="Wang".
 • If the second argument K is not given, the polynomial is factored over the field implied by the coefficients.  For example, if the coefficients are all integers then factor computes all irreducible factors with integer coefficients.  Thus factor does not necessarily factor into linear factors. Note that any integer content (see first example below) is not factored.
 • If the input, a, is a rational expression, then it is first normalized (see normal) and the numerator and denominator of the resulting expression are then factored. This provides a fully-factored form which can be used to simplify an expression in the same way the normal function is used. However, it is more expensive to compute.
 • If the input, a, is a list, set, equation, range, series, relation, or function, then factor is applied recursively to the components of a.
 • If the second argument K is the keyword real or complex, a floating-point factorization is performed over the reals and complexes respectively.  At present this is only implemented for univariate polynomials.
 • If the second argument K is a single RootOf, a list or set of RootOfs, a single radical, or a list or set of radicals, then the expression is factored over the algebraic number field defined by K.

Examples

 > $\mathrm{factor}\left(6{x}^{2}+18x-24\right)$
 ${6}{}\left({x}{+}{4}\right){}\left({x}{-}{1}\right)$ (1)
 > $\mathrm{factor}\left(6\right)$
 ${6}$ (2)
 > $\mathrm{ifactor}\left(6\right)$
 $\left({2}\right){}\left({3}\right)$ (3)
 > $\mathrm{factor}\left(\frac{{x}^{3}-{y}^{3}}{{x}^{4}-{y}^{4}}\right)$
 $\frac{{{x}}^{{2}}{+}{x}{}{y}{+}{{y}}^{{2}}}{\left({x}{+}{y}\right){}\left({{x}}^{{2}}{+}{{y}}^{{2}}\right)}$ (4)
 > $\mathrm{factor}\left(\frac{1}{{x}^{2}-1}+\frac{1}{{x}^{2}+3x+2}\right)$
 $\frac{{2}{}{x}{+}{1}}{\left({x}{+}{2}\right){}\left({x}{+}{1}\right){}\left({x}{-}{1}\right)}$ (5)
 > $\mathrm{factor}\left({x}^{3}+5\right)$
 ${{x}}^{{3}}{+}{5}$ (6)
 > $\mathrm{factor}\left({x}^{3}+5,{5}^{\frac{1}{3}}\right)$
 $\left({{5}}^{{2}}{{3}}}{-}{{5}}^{{1}}{{3}}}{}{x}{+}{{x}}^{{2}}\right){}\left({x}{+}{{5}}^{{1}}{{3}}}\right)$ (7)
 > $\mathrm{factor}\left({x}^{3}+5,\left\{{5}^{\frac{1}{3}},{\left(-3\right)}^{\frac{1}{2}}\right\}\right)$
 ${-}\frac{\left({{5}}^{{1}}{{3}}}{}\sqrt{{-3}}{+}{{5}}^{{1}}{{3}}}{-}{2}{}{x}\right){}\left({{5}}^{{1}}{{3}}}{}\sqrt{{-3}}{+}{2}{}{x}{-}{{5}}^{{1}}{{3}}}\right){}\left({x}{+}{{5}}^{{1}}{{3}}}\right)}{{4}}$ (8)
 > $\mathrm{factor}\left({x}^{3}+5.0\right)$
 $\left({x}{+}{1.70997594667670}\right){}\left({{x}}^{{2}}{-}{1.70997594667670}{}{x}{+}{2.92401773821287}\right)$ (9)
 > $\mathrm{factor}\left({x}^{3}+5,\mathrm{complex}\right)$
 $\left({x}{+}{1.70997594667670}\right){}\left({x}{-}{0.854987973338349}{+}{1.48088260968236}{}{I}\right){}\left({x}{-}{0.854987973338349}{-}{1.48088260968236}{}{I}\right)$ (10)
 > $\mathrm{factor}\left({y}^{4}-2,\sqrt{2}\right)$
 ${-}\left({-}{{y}}^{{2}}{+}\sqrt{{2}}\right){}\left({{y}}^{{2}}{+}\sqrt{{2}}\right)$ (11)
 > $\mathrm{alias}\left(\mathrm{α}=\mathrm{RootOf}\left({x}^{2}-2\right)\right):$
 > $\mathrm{factor}\left({y}^{4}-2,\mathrm{α}\right)$
 ${-}\left({-}{{y}}^{{2}}{+}{\mathrm{\alpha }}\right){}\left({{y}}^{{2}}{+}{\mathrm{\alpha }}\right)$ (12)
 > $\mathrm{factor}\left({x}^{3}+{y}^{3}\right)$
 $\left({x}{+}{y}\right){}\left({{x}}^{{2}}{-}{x}{}{y}{+}{{y}}^{{2}}\right)$ (13)
 > $\mathrm{factor}\left({x}^{3}+{y}^{3},{\left(-3\right)}^{\frac{1}{2}}\right)$
 ${-}\frac{\left({x}{+}{y}\right){}\left({y}{}\sqrt{{-3}}{+}{2}{}{x}{-}{y}\right){}\left({y}{}\sqrt{{-3}}{-}{2}{}{x}{+}{y}\right)}{{4}}$ (14)

The following is a splitting field example. The polynomial a is a polynomial over the rationals.

 > $a≔{x}^{4}-{x}^{2}+1$
 ${a}{≔}{{x}}^{{4}}{-}{{x}}^{{2}}{+}{1}$ (15)

To factor a over the rationals, use the following.

 > $\mathrm{factor}\left({x}^{4}-{x}^{2}+1\right)$
 ${{x}}^{{4}}{-}{{x}}^{{2}}{+}{1}$ (16)

To factor a into linear factors, you must extend the field of coefficients using algebraic extensions.

 > $\mathrm{with}\left(\mathrm{PolynomialTools}\right):$
 > $\mathrm{a1}≔\mathrm{Split}\left(a,x\right)$
 ${\mathrm{a1}}{≔}\left({-}{{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{4}}{-}{{\mathrm{_Z}}}^{{2}}{+}{1}\right)}^{{3}}{+}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{4}}{-}{{\mathrm{_Z}}}^{{2}}{+}{1}\right){+}{x}\right){}\left({x}{+}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{4}}{-}{{\mathrm{_Z}}}^{{2}}{+}{1}\right)\right){}\left({x}{-}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{4}}{-}{{\mathrm{_Z}}}^{{2}}{+}{1}\right)\right){}\left({{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{4}}{-}{{\mathrm{_Z}}}^{{2}}{+}{1}\right)}^{{3}}{-}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{4}}{-}{{\mathrm{_Z}}}^{{2}}{+}{1}\right){+}{x}\right)$ (17)

 > $\mathrm{convert}\left(\mathrm{a1},\mathrm{radical}\right)$
 $\left({-}{\left(\frac{\sqrt{{3}}}{{2}}{+}\frac{{I}}{{2}}\right)}^{{3}}{+}\frac{\sqrt{{3}}}{{2}}{+}\frac{{I}}{{2}}{+}{x}\right){}\left({x}{+}\frac{\sqrt{{3}}}{{2}}{+}\frac{{I}}{{2}}\right){}\left({x}{-}\frac{\sqrt{{3}}}{{2}}{-}\frac{{I}}{{2}}\right){}\left({\left(\frac{\sqrt{{3}}}{{2}}{+}\frac{{I}}{{2}}\right)}^{{3}}{-}\frac{\sqrt{{3}}}{{2}}{-}\frac{{I}}{{2}}{+}{x}\right)$ (18)

Depending on the algebraic extension, this can factor in several different ways.

 > $\mathrm{factor}\left(a,\sqrt{2-2I\sqrt{3}}\right)$
 $\frac{\left({2}{}{x}{+}\sqrt{{3}}{+}{I}\right){}\left({2}{}{x}{-}{I}{+}\sqrt{{3}}\right){}\left({-}{2}{}{x}{+}\sqrt{{3}}{-}{I}\right){}\left({-}{2}{}{x}{+}{I}{+}\sqrt{{3}}\right)}{{16}}$ (19)

References

 [MT16] Michael Monagan and Baris Tuncer. Using Sparse Interpolation in Hensel Lifting. Proceedings of CASC 2016, Springer-Verlag LNCS 9890, 381-400 (2016).
 [Wang78] Wang, P.S. An improved Multivariate Polynomial Factoring Algorithm, Mathematics of Computation 32, (1978).

Compatibility

 • The factor command was updated in Maple 2019.