I am interested in studying equidistribution of Hecke eigenvalues and proving statistical properties of arithmetical objects. On the road, I face the following problem: how to express sums of the form


$$\sum\_{c(\pi)<X} a\_n(\pi)$$


where $a\_n(\pi)$ is the $n$-th coefficient of the Dirichlet series defining $L(s, \pi)$, and $c(\pi)<X$ is some truncating condition. The sum is over irreducible representations of a totally definite quaternion algebra $Z\backslash B^\times$. We know that those coefficients can be read as Hecke eigenvalues $\lambda\_n(\pi)$, so I am thinking in applying trace formulas to Hecke operators in order to reach such a sum, as in [Serre's article](http://www.ams.org/journals/jams/1997-10-01/S0894-0347-97-00220-8/S0894-0347-97-00220-8.pdf) on equidistribution.


In simple cases, such as compact groups, I can use the Selberg's trace formula, and it remains to find a suitable test-function in order to reach those coefficients/eigenvalues. Is there a standard approach, and if so are there easy ways to make those eigenvalues appear in the spectral side of the trace formula ? 


More generally, what are the common relations between trace formulas and Hecke operators (I suppose it is a fertile ground, for both Hecke eigenvalues and trace formulas are powerful tools, and both are "spectral" objects) ?


Any idea or reference would be of great help !



Reaching Hecke eigenvalues from a trace formula
Yes, this is a standard thing to do. If you want to look at traces of Hecke operators on a definite quaternion algebra, this is the same as what are known as "traces of Brandt matrices." These have been studied with trace formulas classically by Eichler, Shimizu, etc. E.g., see the notes



> 
> [The basis problem for modular forms and the traces of Hecke operators, by Eichler](http://link.springer.com/chapter/10.1007%2F978-3-540-38509-7_4) ([MR](http://www.ams.org/mathscinet-getitem?mr=485698))
> 
> 
> 


I think the cleanest way to do it is adelically, though this may be personal bias. I can't think of a reference off the top of my head that puts everything together precisely, but I can give you a couple of references that deal with the necessary components. An adelic approach to the trace formula for GL(2) and the precise connection with Hecke operators is described in detail in the book



> 
> [Traces of Hecke Operators, by Knightly and Li](http://www.ams.org/books/surv/133) ([MR](http://www.ams.org/mathscinet-getitem?mr=2273356))
> 
> 
> 


Basically, say you want the trace for $T\_n$. You choose a test function $f = \prod f\_v$ such that $f\_p$ gives you the local Hecke operator for $p \mid N$ and $f\_\infty$ gives you the desired weight of the representation.


To modify this for a definite quaternion algebra $B$, you just need to modify the test functions $f\_v$ at the places where $B$ ramifies. E.g., if you want weight 2 and squarefree level, just take $f\_\infty=1$ and $f\_p$ to be the characteristic function of the unit group of a local maximal order at a finite place $p$ where $B$ ramifies (so $p | N$).


Similar calculations have been done several places, e.g. in the context of the relative trace formula in the paper 



> 
> [Averages of central L-values of Hilbert modular forms with an application to subconvexity, by Feigon and Whitehouse](http://projecteuclid.org/euclid.dmj/1248182809) ([MR](http://www.ams.org/mathscinet-getitem?mr=2541706)),
> 
> 
> 


which computes sums of $L$-values weighted by Hecke eigenvalues.


