# Introduction

This chapter, which was written by William Stein (`wstein@gmail.com`) with the help of feedback from Kevin Buzzard, describes how to compute with modular symbols using Magma. Modular symbols provide a presentation for certain homology groups, and as such they can be used to compute an eigenform basis for spaces of cusp forms $S_k(N,\varepsilon)$, where $k\geq 2$ is an integer and $\varepsilon$ is an *arbitrary* Dirichlet character. Their generality makes modular symbols a natural tool in applications ranging from verification of modularity of Galois representations to elliptic curve computations.

Our implementation of modular symbols algorithms in Magma was deeply influenced by [[Cremona, 1992](../../references.md#cite-cremona-gammaone), [Cremona, 1997](../../references.md#cite-cremona-algs), [Merel, 1994](../../references.md#cite-merel1585)]. The algorithms for computing arithmetic invariants of modular abelian varieties are based on [[Stein, 2000](../../references.md#cite-stein-phd)]. Those unfamiliar with modular symbols might wish to consult [[Stein, 2008](../../references.md#cite-stein-modsyms)] and the references contained therein and peruse [[Frey and Muller, 1999](../../references.md#cite-frey-muller)].

## Modular Symbols

The *modular group* ${\operatorname{SL}}_2({\mathbb{Z}})$ is the group of $2\times 2$ integer matrices with determinant $1$. For each positive integer $N$ let $\Gamma_0(N)$ denote the subgroup of ${\operatorname{SL}}_2({\mathbb{Z}})$ of matrices that are upper triangular modulo $N$. As explained in the survey paper [[Diamond and Im, 1995](../../references.md#cite-diamond-im)], there is an algebraic curve $X_0(N)$ over ${\mathbb{Q}}$ attached to $\Gamma_0(N)$. The Riemann surface attached to $X_0(N)$ is a compactified quotient of the upper half plane by the action of $\Gamma_0(N)$ via linear fractional transformations. Modular symbols provide an explicit computable presentation for certain “(co-)homology groups” attached to modular curves $X_0(N)$.

Let $\bf P^1({\mathbb{Q}})$ denote the set ${\mathbb{Q}}\cup \{\infty\}$, and fix a field $F$. Let $\bf M$ denote the $F$-vector space generated by the formal symbols $\{a,b\}$, with $a,b \in \bf P^1({\mathbb{Q}})$, modulo the relations $\{a,b\} + \{b,c\} + \{c,a\}=0$ for all $a,b,c\in {\mathbb{Q}}$. (The symbol $\{a,b\}$ can be visualized as the homology class of a geodesic path from $a$ to $b$ in the upper half plane.) Fix a positive integer $k$. A weight-$k$ symbol is a formal product $X^iY^{k-2-i}\{a,b\}$, where $X^iY^{k-2-i}\in F[X,Y]$. Denote by $\bf M_k$ the formal $F$-vector space with basis the set of all weight-$k$ modular symbols (thus $\bf M_k \approx \bf M\otimes {\rm Sym}^{k-2}(F\times F)$). The group ${\operatorname{GL}}_2({\mathbb{Q}})$ acts on the left on $\bf M_k$; the matrix $g=\begin{pmatrix}u&v\\ w&z\end{pmatrix}$ in ${\rm GL}_2({\mathbb{Q}})$ acts by

$$
g(X^iY^{k-2-i}\{a, b\}) =
       (zX-vY)^i(-wX+uY)^{k-2-i}
      \left\{{ua+v\over wa+z}, {ub+v\over wb+z}\right\}.
$$

A *mod* $N$ *Dirichlet character* $\varepsilon$ is a homomorphism $\varepsilon:({\mathbb{Z}}/N{\mathbb{Z}})^*\rightarrow F^*.$ The vector space $\bf M_k(N,\varepsilon;F)$ of *modular symbols of weight* $k$*, level* $N$ *and character* $\varepsilon$ *over* $F$ is the quotient of $\bf M_k$ by the subspace generated by all $x - \varepsilon(u)g(x)$, for $x$ in  $\bf M_k$ and $g=\begin{pmatrix}u&v\\ w&z\end{pmatrix}\in \Gamma_0(N)$. We denote the equivalence class that defines a modular symbol by giving a representative element.

The space of modular symbols is a finite-dimensional vector space, and there is a natural finite presentation for it in terms of Manin symbols.
