---
title: "Congruence Subgroups"
canonical: "https://docs.magma-maths.org/v2.30-1/ModularArithmeticGeometry/CongruenceSubgroupsOfPSL2R/Congruence-subgroups.html"
source: "https://docs.magma-maths.org/v2.30-1/ModularArithmeticGeometry/CongruenceSubgroupsOfPSL2R/Congruence-subgroups.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": "Introduction", "source": "https://docs.magma-maths.org/v2.30-1/ModularArithmeticGeometry/CongruenceSubgroupsOfPSL2R/introduction.md"}
next: {"title": "Structure of Congruence Subgroups", "source": "https://docs.magma-maths.org/v2.30-1/ModularArithmeticGeometry/CongruenceSubgroupsOfPSL2R/structure-of-congruence-groups.md"}
intrinsics:
  - {"name": "PSL2", "signature": "PSL2(R): Rng -> GrpPSL2"}
  - {"name": "Gamma0", "signature": "Gamma0(N): RngIntElt -> GrpPSL2"}
  - {"name": "Gamma1", "signature": "Gamma1(N): RngIntElt -> GrpPSL2"}
  - {"name": "GammaUpper0", "signature": "GammaUpper0(N): RngIntElt -> GrpPSL2"}
  - {"name": "GammaUpper1", "signature": "GammaUpper1(N): RngIntElt -> GrpPSL2"}
  - {"name": "CongruenceSubgroup", "signature": "CongruenceSubgroup(N): RngIntElt -> GrpPSL2"}
  - {"name": "CongruenceSubgroup", "signature": "CongruenceSubgroup(i, N): RngIntElt, RngIntElt -> GrpPSL2"}
  - {"name": "CongruenceSubgroup", "signature": "CongruenceSubgroup([N,M,P]): SeqEnum -> GrpPSL2"}
  - {"name": "Intersection", "signature": "Intersection(G, H): GrpPSL2, GrpPSL2 -> GrpPSL2"}
  - {"name": "meet", "signature": "G meet H: GrpPSL2, GrpPSL2 -> GrpPSL2"}
  - {"name": "eq", "signature": "G eq H: GrpPSL2, GrpPSL2 -> BoolElt"}
  - {"name": "subset", "signature": "H subset G: GrpPSL2, GrpPSL2 -> BoolElt"}
  - {"name": "Index", "signature": "Index(G, H): GrpPSL2, GrpPSL2 -> RngIntElt"}
  - {"name": "Index", "signature": "Index(G): GrpPSL2 -> RngIntElt"}
  - {"name": "Level", "signature": "Level(G): GrpPSL2 -> RngIntElt"}
  - {"name": "IsCongruence", "signature": "IsCongruence(G): GrpPSL2 -> BoolElt"}
  - {"name": "IsGamma0", "signature": "IsGamma0(G): GrpPSL2 -> BoolElt"}
  - {"name": "IsGamma1", "signature": "IsGamma1(G): GrpPSL2 -> BoolElt"}
  - {"name": "BaseRing", "signature": "BaseRing(G): GrpPSL2 -> Rng"}
  - {"name": "Identity", "signature": "Identity(G): GrpPSL2 -> GrpPSL2Elt"}
examples:
  - "ex-5fb4fb"
---

# Congruence Subgroups

We denote by ${\operatorname{SL}}_2({\mathbb{Z}})$ the group of $2$ by $2$ matrices with integer coefficients and determinant $1$. The group ${\operatorname{PSL}}_2({\mathbb{Z}})$ is the projectivization of ${\operatorname{SL}}_2({\mathbb{Z}})$. For any integer $N$ we have groups

$$
\Gamma_0(N)=\left\{\begin{pmatrix}a & b\\ c & d\end{pmatrix}\in{\operatorname{SL}}_2({\mathbb{Z}}) \ \Big|
\begin{pmatrix}a & b\\ c & d\end{pmatrix} \equiv
\begin{pmatrix}* & *\\ 0 & *\end{pmatrix} \bmod N\right\}
$$

$$
\Gamma_1(N)=\left\{\begin{pmatrix}a & b\\ c & d\end{pmatrix}\in{\operatorname{SL}}_2({\mathbb{Z}}) \ \Big|
\begin{pmatrix}a & b\\ c & d\end{pmatrix} \equiv
\begin{pmatrix}1 & *\\ 0 & 1\end{pmatrix} \bmod N\right\}
$$

$$
\Gamma(N)=\left\{\begin{pmatrix}a & b\\ c & d\end{pmatrix}\in{\operatorname{SL}}_2({\mathbb{Z}}) \ \Big|
\begin{pmatrix}a & b\\ c & d\end{pmatrix} \equiv
\begin{pmatrix}1 & 0\\ 0 & 1\end{pmatrix} \bmod N\right\}
$$

$$
\Gamma^1(N)=\left\{\begin{pmatrix}a & b\\ c & d\end{pmatrix}\in{\operatorname{SL}}_2({\mathbb{Z}}) \ \Big|
\begin{pmatrix}a & b\\ c & d\end{pmatrix} \equiv
\begin{pmatrix}1 & 0\\ * & 1\end{pmatrix} \bmod N\right\}
$$

$$
\Gamma^0(N)=\left\{\begin{pmatrix}a & b\\ c & d\end{pmatrix}\in{\operatorname{SL}}_2({\mathbb{Z}}) \ \Big|
\begin{pmatrix}a & b\\ c & d\end{pmatrix} \equiv
\begin{pmatrix}* & 0\\ * & *\end{pmatrix} \bmod N\right\}
$$

A *congruence subgroup* is any discrete subgroup $\Gamma$ of ${\operatorname{SL}}_2({\mathbb{R}})$ which is commensurable with ${\operatorname{SL}}_2({\mathbb{Z}})$, that is, $\Gamma\cap{\operatorname{SL}}_2({\mathbb{Z}})$ has finite index in $\Gamma$ and in ${\operatorname{SL}}_2({\mathbb{Z}})$, and such that $\Gamma(N)$ is contained in $G$ for some $N$. The *level* $N$ of a congruence subgroup $G$ is the greatest integer $N$ such that $\Gamma(N)$ is contained in $\Gamma$. We will abuse notation and also refer to the projectivizations of these groups by the same names.

<a id="creation-of-subgroups-of-operatorname-psl-2-mathbb-r"></a>
## Creation of Subgroups of ${\operatorname{PSL}}_2({\mathbb{R}})$

<a id="function-psl2-rng"></a>
### `PSL2(R): Rng -> GrpPSL2`

Returns ${\operatorname{PSL}}_2(R)$, the projective linear group over the ring $R$.

<a id="function-gamma0-rngintelt"></a>
### `Gamma0(N): RngIntElt -> GrpPSL2`

The group $\Gamma_0(N)$ for any positive integer $N$.

<a id="function-gamma1-rngintelt"></a>
### `Gamma1(N): RngIntElt -> GrpPSL2`

The group $\Gamma_1(N)$ for any positive integer $N$.

<a id="function-gammaupper0-rngintelt"></a>
### `GammaUpper0(N): RngIntElt -> GrpPSL2`

The group $\Gamma^0(N)$ for any positive integer $N$.

<a id="function-gammaupper1-rngintelt"></a>
### `GammaUpper1(N): RngIntElt -> GrpPSL2`

The group $\Gamma^1(N)$ for any positive integer $N$.

<a id="function-congruencesubgroup-rngintelt"></a>
### `CongruenceSubgroup(N): RngIntElt -> GrpPSL2`

The group $\Gamma(N)$ for any positive integer $N$.

<a id="function-congruencesubgroup-rngintelt-rngintelt"></a>
### `CongruenceSubgroup(i, N): RngIntElt, RngIntElt -> GrpPSL2`

For a positive integer $N$ and $i=0,1,2,3,$ or $4$, this is the group $\Gamma_0(N)$, $\Gamma_1(N)$, $\Gamma(N)$, $\Gamma^1(N)$, or $\Gamma^0(N)$ respectively.

<a id="function-congruencesubgroup-seqenum"></a>
### `CongruenceSubgroup([N,M,P]): SeqEnum -> GrpPSL2`

This is the congruence subgroup consisting of 2 by 2 matrices with integer coefficients $[a,b,c,d]$ with $b = 0 \pmod P$, $c = 0 \pmod N$, and $a = d = 1 \pmod M$. It is required that $M$ divides $NP$.

<a id="function-intersection-grppsl2-grppsl2"></a>
### `Intersection(G, H): GrpPSL2, GrpPSL2 -> GrpPSL2`

<a id="operation-op-meet-grppsl2-grppsl2"></a>
### `G meet H: GrpPSL2, GrpPSL2 -> GrpPSL2`

The intersection of congruence subgroups $G$ and $H$.

<a id="example-ex-5fb4fb"></a>
### `Example: Defining Congruence Subgroups (ex-5fb4fb)`

Examples of defining different congruence subgroups:

```magma
> G := PSL2(Integers());
> H := CongruenceSubgroup([2,3,6]);
> H;
Gamma_0(2) intersection Gamma^1(3) intersection Gamma^0(2)
> K := CongruenceSubgroup(0,5);
> K meet H;
Gamma_0(10) intersection Gamma^1(3) intersection Gamma^0(2)
```

## Relations

<a id="operation-op-eq-grppsl2-grppsl2"></a>
### `G eq H: GrpPSL2, GrpPSL2 -> BoolElt`

Returns `true` if and only if the congruence subgroups $G$ and $H$ are equal.

<a id="operation-op-subset-grppsl2-grppsl2"></a>
### `H subset G: GrpPSL2, GrpPSL2 -> BoolElt`

For congruence subgroups $G$ and $H$ contained in ${\operatorname{PSL}}_2({\mathbb{Z}})$, returns `true` if and only if $H$ is a subgroup of $G$.

<a id="function-index-grppsl2-grppsl2"></a>
### `Index(G, H): GrpPSL2, GrpPSL2 -> RngIntElt`

For congruence subgroups $G$ and $H$, returns the index of $G$ in $H$ provided $G$ is a subgroup of $H$.

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

For $G$ a congruence subgroup in ${\operatorname{PSL}}_2({\mathbb{Z}})$, returns the index in ${\operatorname{PSL}}_2({\mathbb{Z}})$.

## Basic Attributes

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

The level of a congruence subgroup $G$.

<a id="function-iscongruence-grppsl2"></a>
### `IsCongruence(G): GrpPSL2 -> BoolElt`

Returns `true` if and only if $G$ is a congruence subgroup.

<a id="function-isgamma0-grppsl2"></a>
### `IsGamma0(G): GrpPSL2 -> BoolElt`

Returns `true` if and only if $G$ is equal to $\Gamma_0(N)$ for some integer $N$.

<a id="function-isgamma1-grppsl2"></a>
### `IsGamma1(G): GrpPSL2 -> BoolElt`

Returns `true` if and only if $G$ is equal to $\Gamma_1(N)$ for some integer $N$.

<a id="function-basering-grppsl2"></a>
### `BaseRing(G): GrpPSL2 -> Rng`

Returns the base ring over which matrices of the congruence subgroup $G$ are defined.

<a id="function-identity-grppsl2"></a>
### `Identity(G): GrpPSL2 -> GrpPSL2Elt`

Returns the identity matrix in the congruence subgroup $G$.
