---
title: "Polynomial Factorization"
canonical: "https://docs.magma-maths.org/v2.30-1/LocalFields/GeneralPAdicExtensions/poly_fact.html"
source: "https://docs.magma-maths.org/v2.30-1/LocalFields/GeneralPAdicExtensions/poly_fact.md"
part: "Local Fields"
chapter: "General $p$-Adic Extensions"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Local Fields", "source": "https://docs.magma-maths.org/v2.30-1/LocalFields/index-local-fields.md"}
  - {"title": "General $p$-Adic Extensions", "source": "https://docs.magma-maths.org/v2.30-1/LocalFields/GeneralPAdicExtensions/index-general-padic-extensions.md"}
prev: {"title": "Elements Operations", "source": "https://docs.magma-maths.org/v2.30-1/LocalFields/GeneralPAdicExtensions/elements.md"}
next: {"title": "Power, Laurent, and Puiseux Series", "source": "https://docs.magma-maths.org/v2.30-1/LocalFields/PowerLaurentAndPuiseuxSeries/index-power-laurent-and-puiseux-series.md"}
intrinsics:
  - {"name": "Factorization", "signature": "Factorization(f): RngUPolElt[RngLocA] -> SeqEnum, RngElt, Any"}
  - {"name": "SuggestedPrecision", "signature": "SuggestedPrecision(f): RngUPolElt[RngLocA] -> RngIntElt"}
  - {"name": "Roots", "signature": "Roots(f): RngUPolElt[RngLocA] -> SeqEnum"}
  - {"name": "Roots", "signature": "Roots(f, R): RngUPolElt, RngLocA -> SeqEnum"}
examples:
  - "ex-579903"
---

# Polynomial Factorization

Polynomials over local fields can be factored and their roots computed.

<a id="function-factorization-rngupolelt-rngloca"></a>
## `Factorization(f): RngUPolElt[RngLocA] -> SeqEnum, RngElt, Any`

```magma
Certificates: BoolElt                    Default: false
```

The factorization of the polynomial $f$ over a local field defined by an arbitrary polynomial. The factorization is returned as a sequence of tuples of prime polynomials and exponents along with a scalar factor. If the parameter `Certificates` is `true` then certificates proving the primality of each prime are also returned.

<a id="function-suggestedprecision-rngupolelt-rngloca"></a>
## `SuggestedPrecision(f): RngUPolElt[RngLocA] -> RngIntElt`

For a polynomial $f$ over a general local field, return a precision at which the factorization of $f$ as given by `Factorization(f)` will be Hensel liftable to the correct factorization.

The precision returned is not guaranteed to be enough to obtain a factorization of the polynomial. It may be that a correct factorization cannot be found at that precision but may be possible with a little more precision.

<a id="function-roots-rngupolelt-rngloca"></a>
## `Roots(f): RngUPolElt[RngLocA] -> SeqEnum`

<a id="function-roots-rngupolelt-rngloca-2"></a>
## `Roots(f, R): RngUPolElt, RngLocA -> SeqEnum`

The roots of the polynomial $f$ over the general local field $R$ where $R$ is taken to be the coefficient ring of $f$ if it is not given.

<a id="example-ex-579903"></a>
## `Example: Factorization over a Local Field (ex-579903)`

```magma
> Q3:=pAdicField(3,40);
> Q3X<x>:=PolynomialRing(Q3);
> L<a>:=LocalField(Q3,x^6-6*x^4+9*x^2-27);
> Factorization(Polynomial(L,x^6-6*x^4+9*x^2-27));
[
    <(O(3^38)*a^5 + O(3^38)*a^4 + O(3^39)*a^3 + O(3^39)*a^2 + O(3^40)*a + (1 +
        O(3^40)))*$.1 + (5*3^35 + O(3^38))*a^5 + O(3^38)*a^4 - (10*3^36 +
        O(3^39))*a^3 + O(3^39)*a^2 + (2701703435345984179 + O(3^40))*a +
        O(3^40), 1>,
    <(O(3^38)*a^5 + O(3^38)*a^4 + O(3^39)*a^3 + O(3^39)*a^2 + O(3^40)*a + (1 +
        O(3^40)))*$.1 + -(29642867960*3^-1 + O(3^23))*a^5 + O(3^24)*a^4 +
        (148214339800*3^-1 + O(3^24))*a^3 + O(3^25)*a^2 - (116512378274*3 +
        O(3^25))*a + O(3^26), 1>,
    <(O(3^38)*a^5 + O(3^38)*a^4 + O(3^39)*a^3 + O(3^39)*a^2 + O(3^40)*a + (1 +
        O(3^40)))*$.1 + -(29642867960*3^-1 + O(3^23))*a^5 + O(3^24)*a^4 +
        (148214339800*3^-1 + O(3^24))*a^3 + O(3^25)*a^2 - (349537134821 +
        O(3^25))*a + O(3^26), 1>,
    <(O(3^38)*a^5 + O(3^38)*a^4 + O(3^39)*a^3 + O(3^39)*a^2 + O(3^40)*a + (1 +
        O(3^40)))*$.1 + -(5*3^35 + O(3^38))*a^5 + O(3^38)*a^4 + (10*3^36 +
        O(3^39))*a^3 + O(3^39)*a^2 - (2701703435345984179 + O(3^40))*a +
        O(3^40), 1>,
    <(O(3^38)*a^5 + O(3^38)*a^4 + O(3^39)*a^3 + O(3^39)*a^2 + O(3^40)*a + (1 +
        O(3^40)))*$.1 + (29642867960*3^-1 + O(3^23))*a^5 + O(3^24)*a^4 -
        (148214339800*3^-1 + O(3^24))*a^3 + O(3^25)*a^2 + (116512378274*3 +
        O(3^25))*a + O(3^26), 1>,
    <(O(3^38)*a^5 + O(3^38)*a^4 + O(3^39)*a^3 + O(3^39)*a^2 + O(3^40)*a + (1 +
        O(3^40)))*$.1 + (29642867960*3^-1 + O(3^23))*a^5 + O(3^24)*a^4 -
        (148214339800*3^-1 + O(3^24))*a^3 + O(3^25)*a^2 + (349537134821 +
        O(3^25))*a + O(3^26), 1>
]
O(3^38)*a^5 + O(3^38)*a^4 + O(3^39)*a^3 + O(3^39)*a^2 + O(3^40)*a + 1 + O(3^40)
```
