By default Mathematica
can factorize polynomials to lower order ones in terms of integers if it's possible. Extension
serves factorization over the rationals extended by a finite set of algebraic numbers, i.e. any element of the extension is a finite combination of rationals and algebraics $(a_1, a_2,...,a_n)$. The fundamental theorem of algebra states that in principle one can always factorize any polynomial of one variable by finding its roots, nevertheless there are fundamental limitations (Galois theorem, Abel's impossibility theorem, etc.) as well as technical problems (simplifying roots in terms of nested radicals, efficency, etc.).
This polynomial :
p[x_] := 8 x^3 - 7 x^2 + 10 x - 5
has three complex roots (only one real) :
s = Solve[ p[x] == 0, x]

involving irrational numbers and therefore it cannot be factorized by default nor using Extension->I
. The roots are algebraic numbers since p[x]
is a polynomial with integer coefficients :
Element[#, Algebraics] & /@ s[[All, 1, 2]]
{True, True, True}
so it implies we can factorize p[x]
using an appropriate Extension
.
In order to factor p[x]
completely one should use the field of the rationals numbers extended by the roots of the polynomial e.g.
Factor[ p[x], Extension -> {Root[p[x], 1], Root[p[x], 2], Root[p[x], 3]}]
However since this expression produces the output in terms of Root
objects, one would prefer it in terms of radicals, e.g.
Factor[ p[x], Extension -> ToRadicals @ {Root[p[x], 1], Root[p[x], 2], Root[p[x], 3]}] //
Together // TraditionalForm

We could also proceed along a different route, taking only terms that cause the roots are not rational numbers. Therefore we select these numbers :
{(2143 + 72 Sqrt[2230])^(1/3), Sqrt[3], I}
. We included I
because two of the roots are complex.
Factor[ p[x], Extension -> {(2143 + 72 Sqrt[2230])^(1/3), Sqrt[3], I}] // Together
// TraditionalForm

There is yet another (a bit more involved) way to factorize this polynomial using FactorList
, which results in this case in the simplest form :
Times @@ Simplify /@ Power @@@
FactorList[ p[x],
Extension -> ToRadicals @ { Root[p[x], 1], Root[p[x], 2], Root[p[x], 3]}]//
TraditionalForm

FactorList
made possible simplifying every factor instead of using Simplify
to the result of Factor
which produced expanded form of the polylomial. Although the last factorization is not much simpler than appropriate multiplying terms like (x - ToRadicals @ Root[ p[x], i] @ )
, there is an aspect which makes functions like Factor
really useful, e.g. when one encounters the problem of expressing roots in terms of radicals, consider a very simple example :
FullSimplify @ Solve[ MinimalPolynomial[Sqrt[3] + Sqrt[5]][x] == 0, x]

To overcome this problem one could use e.g. an appropriate ComplexityFunction
to simplify completely the radicals, but in general this is far from being obvious how one should proceed. Nevertheless if we know what the Extension
should be, then the answer is simple, e.g.
Factor[ 4 - 16 #1^2 + #1^4 &[x], Extension -> {Sqrt[3], Sqrt[5]}]

or
Factor[ - 27 Sqrt[3] + 189 x - 189 Sqrt[3] x^2 + 315 x^3
- 105 Sqrt[3] x^4 + 63 x^5 - 7 Sqrt[3] x^6 + x^7, Extension -> Automatic]
