---
title: "Structure of Congruence Subgroups"
canonical: "https://docs.magma-maths.org/v2.30-1/ModularArithmeticGeometry/CongruenceSubgroupsOfPSL2R/structure-of-congruence-groups.html"
source: "https://docs.magma-maths.org/v2.30-1/ModularArithmeticGeometry/CongruenceSubgroupsOfPSL2R/structure-of-congruence-groups.md"
part: "Modular Arithmetic Geometry"
chapter: "Congruence Subgroups of ${\\operatorname{PSL}}_2({\\mathbb{R}})$"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Modular Arithmetic Geometry", "source": "https://docs.magma-maths.org/v2.30-1/ModularArithmeticGeometry/index-modular-arithmetic-geometry.md"}
  - {"title": "Congruence Subgroups of ${\\operatorname{PSL}}_2({\\mathbb{R}})$", "source": "https://docs.magma-maths.org/v2.30-1/ModularArithmeticGeometry/CongruenceSubgroupsOfPSL2R/index-congruence-subgroups-of-psl2-r.md"}
prev: {"title": "Congruence Subgroups", "source": "https://docs.magma-maths.org/v2.30-1/ModularArithmeticGeometry/CongruenceSubgroupsOfPSL2R/Congruence-subgroups.md"}
next: {"title": "Elements of ${\\operatorname{PSL}}_2({\\mathbb{R}})$", "source": "https://docs.magma-maths.org/v2.30-1/ModularArithmeticGeometry/CongruenceSubgroupsOfPSL2R/GrpPSL2Elt.md"}
intrinsics:
  - {"name": "CosetRepresentatives", "signature": "CosetRepresentatives(G): GrpPSL2 -> SeqEnum"}
  - {"name": "Generators", "signature": "Generators(G): GrpPSL2 -> SeqEnum"}
  - {"name": "FindWord", "signature": "FindWord(G, g): GrpPSL2, GrpPSL2Elt -> SeqEnum"}
  - {"name": "Genus", "signature": "Genus(G): GrpPSL2 -> RngIntElt"}
  - {"name": "FundamentalDomain", "signature": "FundamentalDomain(G): GrpPSL2 -> SeqEnum"}
  - {"name": "Cusps", "signature": "Cusps(G): GrpPSL2 -> SeqEnum"}
  - {"name": "CuspWidth", "signature": "CuspWidth(G, x): GrpPSL2, SetCspElt -> RngIntElt"}
  - {"name": "EllipticPoints", "signature": "EllipticPoints(G): GrpPSL2 -> [SpcHypElt]"}
  - {"name": "EllipticPoints", "signature": "EllipticPoints(G, H): GrpPSL2, SpcHyp -> [SpcHypElt]"}
examples:
  - "ex-5c2d72"
  - "ex-15bd49"
  - "ex-f5387a"
---

# Structure of Congruence Subgroups

<a id="function-cosetrepresentatives-grppsl2"></a>
## `CosetRepresentatives(G): GrpPSL2 -> SeqEnum`

If $G$ is a subgroup of finite index in ${\operatorname{PSL}}_2({\mathbb{Z}})$, then returns a sequence of coset representatives of $G$ in ${\operatorname{PSL}}_2({\mathbb{Z}})$.

<a id="function-generators-grppsl2"></a>
## `Generators(G): GrpPSL2 -> SeqEnum`

Returns a sequence of generators of the congruence subgroup $G$.

<a id="function-findword-grppsl2-grppsl2elt"></a>
## `FindWord(G, g): GrpPSL2, GrpPSL2Elt -> SeqEnum`

For a congruence subgroup $G$, and an element $g$ of $G$, this function returns a sequence of integers corresponding to an expression for $g$ in terms of a fixed set of generators for $G$. Let $L$ be the list of generators for $G$ output by the function `Generators`. Then the return sequence $[e_1n_1,e_2n_2,\dots,e_m n_m]$, where $n_i$ are positive integers, and $e_i=1$ or $-1$, means that $g=L[n_1]^{e_1}L[n_2]^{e_2}\dots L[n_m]^{e_m}$. Note that since the computation is in $PSL_2({\mathbb{R}})$, this equality only holds up to multiplication by $\pm 1$.

<a id="function-genus-grppsl2"></a>
## `Genus(G): GrpPSL2 -> RngIntElt`

The genus of the upper half plane quotiented by the congruence subgroup G.

<a id="function-fundamentaldomain-grppsl2"></a>
## `FundamentalDomain(G): GrpPSL2 -> SeqEnum`

For $G$ a subgroup of ${\operatorname{PSL}}_2({\mathbb{Z}})$ returns a sequence of points in the Upper Half plane which are the vertices of a fundamental domain for $G$.

<a id="example-ex-5c2d72"></a>
## `Example: Coset Representatives for Gamma0(12) (ex-5c2d72)`

In this example we compute a set of generators for $\Gamma_0(12)$.

```magma
> G := CongruenceSubgroup(0,12);
> Generators(G);
[
    [1 1]
    [0 1],

    [ 5 -1]
    [36 -7],

    [  5  -4]
    [ 24 -19],

    [  7  -5]
    [ 24 -17],

    [ 5 -3]
    [12 -7]
]
> C := CosetRepresentatives(G);
> H<i,r> := UpperHalfPlaneWithCusps();
> triangle := [H|Infinity(),r,r-1];
> translates := [g*triangle : g in C];
```

<a id="example-ex-15bd49"></a>
## `Example: Elements as Words in Generators (ex-15bd49)`

This example illustrates how any element of a congruence subgroup can be written in terms of the set of generators output by the `generators` function.

```magma
> N := 34;
> Chi := DirichletGroup(N, CyclotomicField(EulerPhi(N)));
> GaloisConjugacyRepresentatives(Chi);
[
    1,
    $.1,
    $.1^2,
    $.1^4,
    $.1^8
]
> char := Chi.1^8;
> G := CongruenceSubgroup([N,Conductor(char),1],char);
> G;
Gamma_0(2) intersection Gamma_1(17) with character $.1^8
> gens := Generators(G);
> #gens;
21
> g := G! [21, 4, 68, 13];
> // express g in terms of Generators(G)
> FindWord(G, g);
[ -8, 1 ]
> // This means that up to sign, g = gens[8]^(-1) * gens[1]
> gens[8]^(-1) * gens[1];
[-21  -4]
[-68 -13]
```

## Cusps and Elliptic Points of Congruence Subgroups

<a id="function-cusps-grppsl2"></a>
### `Cusps(G): GrpPSL2 -> SeqEnum`

Returns a sequence of inequivalent cusps of the congruence subgroup $G$.

<a id="function-cuspwidth-grppsl2-setcspelt"></a>
### `CuspWidth(G, x): GrpPSL2, SetCspElt -> RngIntElt`

Returns the width of $x$ as a cusp of the congruence subgroup $G$.

<a id="function-ellipticpoints-grppsl2"></a>
### `EllipticPoints(G): GrpPSL2 -> [SpcHypElt]`

<a id="function-ellipticpoints-grppsl2-spchyp"></a>
### `EllipticPoints(G, H): GrpPSL2, SpcHyp -> [SpcHypElt]`

Returns a list of inequivalent elliptic points for the congruence subgroup $G$. A second argument may be given to specify the upper half plane $H$ containing these elliptic points.

<a id="example-ex-f5387a"></a>
### `Example: Cusps and Their Widths (ex-f5387a)`

We can compute a set of representative cusps for $\Gamma_1(12)$, and their widths as follows:

```magma
> G := CongruenceSubgroup(0,12);
> Cusps(G);
[
    oo,
    0,
    1/6,
    1/4,
    1/3,
    1/2
]
> Widths(G);
[ 1, 12, 1, 3, 4, 3 ]
> // Note that the sum of the cusp widths is the same as the Index:
> &+Widths(G);
24
> Index(G);
24
```

In the following example we find which group $\Gamma_0(N)$ has the most elliptic points for $N$ less than 20, and list the elliptic points in this case.

```magma
> H := UpperHalfPlaneWithCusps();
> [#EllipticPoints(Gamma0(N),H) : N in [1..20]];
[ 2, 1, 1, 0, 2, 0, 2, 0, 0, 2, 0, 0, 4, 0, 0, 0, 2, 0, 2, 0 ]
> // find the index where the maximal number of elliptic points is attained:
> Max($1);
4 13
> // find the elliptic points for Gamma0(13):
> EllipticPoints(Gamma0(13));
[
    5/13 + (1/13)*root(-1),
    8/13 + (1/13)*root(-1),
    7/26 + (1/26)*root(-3),
    19/26 + (1/26)*root(-3)
]
```
