What is a good number theoretic interpretation of primitive geodesics on the modular surface?

Given $SL_2( \mathbb{Z})$, what interpretation is available for the hyperbolic elements? What is true, if we consider a congruence subgroup?

I heard that there is a connection with certain class numbers.

-

Conjugacy classes of hyperbolic elements in $SL(2,Z)$ are in bijection with units in rings of algebraic integers in real quadratic fields. This follows directly from looking at the characteristic polynomial. On the quotient of the upper half-plane by $SL(2,Z)$, the (hyperbolic) geodesics connecting images of points under such elements _close_up_, giving "closed geodesics" on the modular surface. The (hyperbolic) length is the log of the absolute value of the unit. All this is straightforward computation, once one conceives the idea of it. Iwaniec' "Spectral theory of automorphic forms"' first chapters treat such things.

For congruence subgroups, the corresponding congruence condition is inserted everywhere, and the relation of "conjugacy" must be adapted in the obvious way.

A subtler level involves Selberg's assemblage of the aggregate of the lengths of closed geodesics into his "zeta function", for which he could prove the analogue of the Riemann Hypothesis. Iwaniec' book addresses such things, also, at least in a preliminary fashion.

The most immediate connection with class numbers comes when periods along the corresponding adelized algebraic group $GL(1,k)\subset GL(2,Q)$ are computed, since the adelized $GL(1,k)$ "automatically" includes class groups (as in Iwasawa-Tate's rewrite of Hecke about GL(1) L-functions). For complex quadratic fields, instead of evaluation just at single points, such as $\sqrt{-5}$, one must take a weighted sum over representatives of points for all ideal classes. The analogous thing happens with real quadratic fields. That is, the "most natural" expression combines units and class numbers.

A little more sophisticatedly (also introduced in Iwaniec, for example) is that Selberg's "trace formula" expresses (for example) sums over closed geodesics in terms of a spectral "dual": the closed geodesics occur on the "geometric side" of the trace formula, and traces of representations occur on the "spectral side". Iwaniec' treatment is about as elementary as can be made.

-