# Units and Unit Groups

Let $S$ be a definite quaternion order over ${\mathbb{Z}}$, ${\mathbb{F}}_q[X]$ with $q$ odd, or a number ring. In the first two cases, the unit group of $S$ is finite and can be read off any reduced Gram matrix of $S$. If the base ring of $S$ is some number ring $R$, then an explicit description of the finite quotient $S^*/R^*$ is given in [[Vignéras, 1976](../../references.md#cite-vigneras76)].

## `NormOneGroup(S): AlgAssVOrd -> GrpPerm, Map`

## `NormOneGroup(S): AlgQuatOrd -> GrpAb, Map`

```magma
ModScalars: BoolElt                    Default: false
```

Returns a group $G$ isomorphic to the group $S_1$ of elements in $S$ with reduced norm $1$ (unless `ModScalars` is set, in which case $G$ is isomorphic to $S_1$ modulo $\{\pm 1\}$).

The second object returned is a map from $G$ to $S$ expressing the isomorphism.

## `Units(S): AlgQuatOrd -> SeqEnum`

## `Units(S): AlgAssVOrd -> SeqEnum`

This intrinsic computes the set of units $S^*$ for the definite order $S$. When the base ring of $S$ is $Z$ or ${\mathbb{F}}_q[X]$, the returned sequence contains all units of $S$; when the base field is a number field, the returned sequence contains representatives modulo the unit group of the base ring (since the unit group is infinite in general).

## `MultiplicativeGroup(S): AlgQuatOrd[RngInt] -> GrpPerm, Map`

## `UnitGroup(S): AlgQuatOrd[RngInt] -> GrpPerm, Map`

## `MultiplicativeGroup(S): AlgQuatOrd[RngUPol] -> GrpAb, Map`

## `UnitGroup(S): AlgQuatOrd[RngUPol] -> GrpAb, Map`

## `MultiplicativeGroup(S): AlgAssVOrd[RngOrd] -> GrpPerm, Map`

## `UnitGroup(S): AlgAssVOrd[RngOrd] -> GrpPerm, Map`

This intrinsic computes the unit group $S^*$ of the definite quaternion order $S$. The function returns an abstract group $G$, and a map from $G$ to $S$. When the base ring of $S$ is $Z$ or ${\mathbb{F}}_q[X]$, $G$ represents the full group of units of $S$; when the base field is a number field, $G$ represents the unit group of $S$ modulo the unit group of the base ring (since the unit group is infinite in general).

## `Example: Unit Group (ex-410b55)`

The following example illustrates the unit group computation for an order in a definite quaternion algebra over ${\mathbb{Q}}$.

```magma
> A := QuaternionAlgebra< RationalField() | -1, -1 >;
> S1 := MaximalOrder(A);
> S2 := QuaternionOrder(A,2);
> G1, h1 := UnitGroup(S1);
> #G1;
24
> [ A | h1(g) : g in G1 ];
[ 1, -1, -j, -k, i, -1/2 + 1/2*i - 1/2*j - 1/2*k, 1/2 + 1/2*i - 1/2*j + 1/2*k,
-1/2 - 1/2*i - 1/2*j + 1/2*k, -1/2 + 1/2*i + 1/2*j + 1/2*k, 1/2 - 1/2*i - 1/2*j
- 1/2*k, 1/2 + 1/2*i + 1/2*j - 1/2*k, 1/2 - 1/2*i + 1/2*j + 1/2*k, -1/2 - 1/2*i
+ 1/2*j - 1/2*k, 1/2 - 1/2*i + 1/2*j - 1/2*k, -1/2 + 1/2*i + 1/2*j - 1/2*k, 1/2
+ 1/2*i - 1/2*j - 1/2*k, -1/2 - 1/2*i - 1/2*j - 1/2*k, 1/2 + 1/2*i + 1/2*j +
1/2*k, -1/2 - 1/2*i + 1/2*j + 1/2*k, -1/2 + 1/2*i - 1/2*j + 1/2*k, 1/2 - 1/2*i -
1/2*j + 1/2*k, k, -i, j ]
> G2, h2 := UnitGroup(S2);
> #G2;
8
> [ A | h2(g) : g in G2 ];
[ 1, -1, -j, j, k, -k, -i, i ]

```

The unit groups of orders in indefinite quaternion algebras $A$ are infinite arithmetic groups, which are twisted analogues of the groups ${\operatorname{SL}}_2({\mathbb{Z}})$ and their families of subgroups. These are studied in relation to their actions on the upper half complex plane, via an embedding in ${\operatorname{GL}}_2({\mathbb{R}})$ provided by some isomorphism $A\otimes{\mathbb{R}}\cong M_2({\mathbb{R}})$.

## `Example: Unit Group NumberRing (ex-b816c0)`

Now we exhibit unit group computations over a number ring.

```magma
> P<x> := PolynomialRing(Rationals());
> F := NumberField(x^3-3*x-1);
> Z_F := MaximalOrder(F);
> Foo := InfinitePlaces(F);

```

We use `SetSeed` since the following line makes random choices.

```magma
> SetSeed(1);
> A := QuaternionAlgebra(ideal<Z_F | 2>, Foo);
> IsDefinite(A);
true
> O := MaximalOrder(A);
> U, h := UnitGroup(O);
> U;
Permutation group U acting on a set of cardinality 12
Order = 12 = 2^2 * 3
    Id(U)
    (1, 2, 4)(3, 6, 7)(5, 9, 10)(8, 12, 11)
    (1, 3)(2, 5)(4, 8)(6, 11)(7, 9)(10, 12)
> #Units(O);
12

```
