Number fields

Units

The units of a ring of integers are the elements of norm ±1\pm 1. Dirichlet's theorem says what the group looks like: finitely many roots of unity, times a free group whose rank is fixed by the number of real and complex embeddings. Finding generators is harder than knowing they exist.

Dirichlet's unit theorem

If KK has r1r_1 real embeddings and r2r_2 pairs of complex ones, then

OK×≅μw×Zr,r=r1+r2−1, \mathcal{O}_K^\times \cong \mu_w \times \mathbb{Z}^{r}, \qquad r = r_1 + r_2 - 1,

where μw\mu_w is the group of roots of unity in KK. A set of rr units generating the free part is a system of fundamental units.

import { NumberField, unitGroup } from "@ratmath/numtheory";

const U = unitGroup(NumberField.quadratic(2));
U.rank;                 // 1
U.torsionOrder;         // 2: the roots of unity are ±1
U.fundamentalUnits;     // [1 + √2]
U.regulator;            // 0.881373587019543 = ln(1 + √2)

unitGroup(NumberField.gaussian()).torsionOrder;        // 4: ±1, ±i, and rank 0
unitGroup(NumberField.quadratic(-3)).torsionOrder;     // 6

const V = unitGroup([-2n, 0n, 0n, 1n]);                // Q(∛2): r₁ = 1, r₂ = 1, rank 1
String(V.fundamentalUnits[0]);                         // "1 + α + α²"

const W = unitGroup([2n, 0n, -4n, 0n, 1n]);            // totally real quartic: rank 3
W.fundamentalUnits.map(String);     // ["1 − α", "3 + 4α − α² − α³", "1 + 2α − α³"]

For a real quadratic field the fundamental unit comes from the continued fraction of d\sqrt d, and it can be large: for Q(94)\mathbb{Q}(\sqrt{94}) it is 2143295+221064942143295 + 221064\sqrt{94}.

The regulator

Send a unit uu to the vector of log⁡∣σi(u)∣\log|\sigma_i(u)| over the embeddings (doubled at complex ones). The image of the unit group is a lattice of rank rr in the hyperplane where the coordinates sum to zero, and the regulator RR is the determinant of any r×rr \times r minor of the matrix of fundamental units. A sub-system of units of index mm has regulator mRmR, so a regulator certifies itself only together with a lower bound: this is how the units are proven fundamental, as described in Class groups.

regulator([-2n, 0n, 0n, 1n]);          // 1.347377348329384
regulator([1n, -3n, 0n, 1n]);          // 0.8492874506461925: the cubic field inside Q(ζ₉)
V.certificate;
// { method: "saturation", …, regulatorLowerBound: 0.2052, unitIndexBound: 6, primesChecked: 3 }

For Q(23)\mathbb{Q}(\sqrt[3]{2}): the unit found has regulator 1.347; if it were an mm-th power of a smaller unit, that one would have regulator 1.347/m≥0.20521.347/m \ge 0.2052, so m≤6m \le 6; and reductions modulo suitable primes show that it is not a square, a cube or a fifth power, up to sign. Hence it is fundamental.

Roots of unity

If KK has a real embedding the only roots of unity are ±1\pm 1. Otherwise ww divides N(q)−1N(\mathfrak{q}) - 1 for every prime q\mathfrak{q} not dividing ww, which leaves few candidates after a handful of primes; each candidate mm is settled by looking for a root of the cyclotomic polynomial Φm\Phi_m in KK, exactly.

const Z5 = unitGroup([1n, 1n, 1n, 1n, 1n]);     // Q(ζ₅)
Z5.torsionOrder;                // 10
String(Z5.rootOfUnity);         // "1 + α + α² + α³", which is −ζ₅⁴: a primitive tenth root
Z5.fundamentalUnits.map(String);   // ["α + α² + α³"], and its regulator is 2·ln((1 + √5)/2)

Writing a unit on the fundamental ones

Every unit is ζt∏εiei\zeta^t \prod \varepsilon_i^{e_i} in one way. The exponents come from solving a linear system in the logarithms and rounding; the answer is then checked exactly.

const K = new NumberField([-2n, 0n, 0n, 1n]);
const [eps] = V.fundamentalUnits;
V.exponents(eps.pow(7).neg());           // { torsion: 1, exponents: [7n] }: −ε⁷
V.exponents(K.of([[-1n, 1n], [1n, 1n]]));   // { torsion: 0, exponents: [-1n] }: α − 1 = 1/ε
V.isUnit(K.gen);                         // false: α has norm 2

Units are also what makes generators of principal ideals ambiguous: two generators differ by a unit. And they are the solutions of norm equations N(x)=±1N(x) = \pm 1, of which Pell's equation is the quadratic case.

Try itEdit the code and run it with @ratmath/numtheory and Core's Rational in scope. The last line's value is shown; PRINT(…) adds lines, TEX(…) typesets math.
Ctrl/⌘ + Enter runs