Polynomials over Algebraic Number Fields

Functions like (RefLink[Factor, paclet:ref/Factor]) usually assume that all coefficients in the polynomials they produce must involve only rational numbers. But by setting the option (RefLink[Extension, paclet:ref/Extension]) you can extend the domain of coefficients that will be allowed.

Factoring polynomials over algebraic number fields.

Allowing only rational number coefficients, this polynomial cannot be factored:

Factor[1+x^4]

With coefficients that can involve (Sqrt[2]), the polynomial can now be factored:

Factor[1+x^4,Extension->{Sqrt[2]}]

The polynomial can also be factored if one allows coefficients involving (Sqrt[-1]):

Factor[1+x^4,Extension->{Sqrt[-1]}]

(RefLink[GaussianIntegers, paclet:ref/GaussianIntegers])->(RefLink[True, paclet:ref/True]) is equivalent to (RefLink[Extension, paclet:ref/Extension])->(RefLink[Sqrt, paclet:ref/Sqrt])[-1]:

Factor[1+x^4,GaussianIntegers->True]

If one allows coefficients that involve both (Sqrt[2]) and (Sqrt[-1]) the polynomial can be factored completely:

Factor[1+x^4,Extension->{Sqrt[2],Sqrt[-1]}]

(RefLink[Expand, paclet:ref/Expand]) gives the original polynomial back again:

Expand[%]

Factoring polynomials with algebraic number coefficients.

Here is a polynomial with a coefficient involving (Sqrt[2]):

t=Expand[(Sqrt[2]+x)^2]

By default, (RefLink[Factor, paclet:ref/Factor]) will not factor this polynomial:

Factor[t]

But now the field of coefficients is extended by including (Sqrt[2]), and the polynomial is factored:

Factor[t,Extension->Automatic]

Other polynomial functions work much like (RefLink[Factor, paclet:ref/Factor]). By default, they treat algebraic number coefficients just like independent symbolic variables. But with the option (RefLink[Extension, paclet:ref/Extension])->(RefLink[Automatic, paclet:ref/Automatic]) they perform operations on these coefficients.

By default, (RefLink[Cancel, paclet:ref/Cancel]) does not reduce these polynomials:

Cancel[t/(x^2-2)]

But now it does:

Cancel[t/(x^2-2),Extension->Automatic]

By default, (RefLink[PolynomialLCM, paclet:ref/PolynomialLCM]) pulls out no common factors:

PolynomialLCM[t,x^2-2]

But now it does:

PolynomialLCM[t,x^2-2,Extension->Automatic]

Irreducibility testing.

A polynomial is irreducible over a field F if it cannot be represented as a product of two nonconstant polynomials with coefficients in F.

By default, algebraic numbers are treated as independent variables:

IrreduciblePolynomialQ[x^2+2 Sqrt[2]x+2]

Over the rationals extended by (RefLink[Sqrt, paclet:ref/Sqrt])[2], the polynomial is reducible:

IrreduciblePolynomialQ[x^2+2 Sqrt[2]x+2,Extension->Automatic]

This polynomial is irreducible over the rationals:

IrreduciblePolynomialQ[x^2-3]

Over the rationals extended by (RefLink[Sqrt, paclet:ref/Sqrt])[3], the polynomial is reducible:

IrreduciblePolynomialQ[x^2-3,Extension->{Sqrt[3]}]

This polynomial is irreducible over the field of all complex numbers:

IrreduciblePolynomialQ[x^3-5x y+7,Extension->All]