TITLE: Modular curves over finite fields
QUESTION [5 upvotes]: I'm looking for a detailed reference for modular curves over finite fields, such as $X(N)$, $X_1(N)$, and $X_0(N)$. There seems to be a lot of literature dealing with them over $\mathbb{C}$, but I'm specifically interested in them from the perspective of algebraic geometry. Also, do there exist tables of their point counts over $\mathbb{F}_q$ for some small (but hopefully at least up to $N=15$ or so) values of $N$, or algorithms (e.g. in Sage) for calculating such information? For genus 0 the Riemann hypothesis for curves over finite fields gives an exact formula, of course.

REPLY [3 votes]: The short answer is given by the Grothendieck-Lefschetz trace formula
$$ \#X(\mathbf F_p) = \sum (-1)^i \mathrm{Tr}(\mathrm{Frob}_p \mid H^i_c(X;\mathbf Q_\ell)).$$
For $X$ a compact modular curve associated with a congruence subgroup $\Gamma$, this means that you need to understand the Galois representation $H^1(X,\mathbf Q_\ell)$, as the trace on $H^0$ and $H^2$ just gives you $p+1$. For $p$ not dividing the level, the trace on $H^1$ is given by the Eichler-Shimura theorem. Specifically, $H^1(X)$ is (possibly after extending scalars) the direct sum of the $2$-dimensional Galois representations attached to Hecke eigenforms of weight 2 and level $\Gamma$, and the trace of $\mathrm{Frob}_p$ on $H^1(X)$ is the same as the trace of the Hecke operator $T_p$ acting on this space of cusp forms. This is the same as the sum of the $p$th Fourier coefficient of all normalized Hecke eigenforms. So you can indeed compute the number of $\mathbf F_p$-points in SAGE: this is equivalent to finding a list of all Hecke eigenforms of weight 2 for this level, and telling SAGE to spit out their Fourier coefficients.