View all blog posts
Code

Ramanujan’s tau function

From a remarkable sequence to a formal proof

Srinivasa Ramanujan
Srinivasa Ramanujan, 1887–1920

A letter from India

In 1913, a 25-year-old clerk in Madras, India, sent G. H. Hardy a letter filled with extraordinary mathematical formulas. Srinivasa Ramanujan had taught himself much of his mathematics, working far from the principal European research centers. Hardy recognized an exceptional talent, and he invited Ramanujan to study with him in Cambridge. Their collaboration would transform number theory. Ramanujan died in 1920, aged only 32, leaving ideas that mathematicians still study today [1].

His work with Hardy on partitions, the ways of writing a positive integer as a sum of positive integers without regard to order, helped shape modern analytic number theory. His mock theta functions, described near the end of his life, inspired a theory with applications reaching into mathematical physics [2]. And a sequence he studied in 1916 became a guiding example in the development of modular forms, Galois representations, and the relationship between arithmetic and geometry.

This is the story of that sequence, and of Axiom Math’s formalization of the Ramanujan–Petersson Conjecture, now known as Deligne’s Theorem. Using Axiom Prover and the Lean proof assistant, we have brought its arithmetic and geometric ingredients together in a computer-checked proof, building on our earlier Stacks and Weil developments.

Meet Ramanujan’s tau function

The sequence begins

$$1,\quad -24,\quad 252,\quad -1472,\quad 4830,\quad -6048,\quad \dots$$

These are integers born from a simple procedure. Multiply out

$$q(1-q)^{24}(1-q^2)^{24}(1-q^3)^{24}\cdots = q - 24q^2 + 252q^3 - 1472q^4 + 4830q^5 - 6048q^6 + \cdots.$$

After combining like terms, the number multiplying $q^n$ is Ramanujan's $\tau(n)$, pronounced "tau of $n$." It's the $n$th coefficient of this infinite power series. For now, think of $q$ as a bookkeeping symbol: the exponent tells us which entry we are computing. Although the product goes on forever, only finitely many factors can affect any particular entry.

We can do the first few by hand. The first two factors expand as

$$(1-q)^{24} = 1 - 24q + 276q^2 + \cdots, \qquad (1-q^2)^{24} = 1 - 24q^2 + \cdots.$$

In the 24 copies of $(1-q)$, there are 24 ways to choose one $-q$, and $24\cdot 23/2 = 276$ ways to choose two. After multiplying by the initial $q$, we obtain $\tau(1) = 1$, $\tau(2) = -24$, and $\tau(3) = 276 - 24 = 252$. Later factors cannot change these three answers.

Why should this recipe, which seems like the stuff of high school algebra, matter? After a standard change of variable, the product defines a *modular form*, a function with remarkable symmetries. Those symmetries impose arithmetic laws on the coefficients. Ramanujan saw some of these laws long before the surrounding theory had reached its modern form [3].

Three predictions and a mysterious prime

Ramanujan proposed three properties. The first says that multiplication of inputs can become multiplication of outputs:

$$\tau(mn) = \tau(m)\,\tau(n) \qquad \text{if } m \text{ and } n \text{ have no common factor greater than } 1.$$

For example, $\tau(6) = \tau(2)\,\tau(3) = (-24)\cdot 252 = -6048$. The qualification matters: $\tau(4)$ is certainly not $\tau(2)^2$. Instead, the second property tells us how to handle repeated prime factors. For a prime $p$, he proposed the recursion

$$\tau(p^{r+1}) = \tau(p)\,\tau(p^r) - p^{11}\,\tau(p^{r-1}) \qquad (r \ge 1).$$

At $p = 2$ and $r = 1$, this gives $\tau(4) = (-24)^2 - 2^{11} = -1472$. Together, the two rules say that knowing the values at primes determines the whole sequence.

The third prediction constrains the absolute values of the prime values:

$$|\tau(p)| \le 2p^{11/2} \qquad \text{for every prime } p.$$

Ramanujan was predicting a universal limit on the size of these seemingly erratic numbers. Louis Mordell proved the first two properties in 1917. The third resisted proof for nearly six decades [4].

The surprises did not end there. Ramanujan also discovered congruences, equations about remainders after division. One of the most celebrated involves the prime 691:

$$\tau(n) \equiv \sum_{d \mid n} d^{11} \pmod{691}.$$

On the right, take every positive divisor of $n$, raise it to the eleventh power, and add. The claim is that the difference between this sum and $\tau(n)$ is always divisible by 691. For $n = 2$, the divisor sum is $1 + 2^{11} = 2049$, and indeed

$$2049 - (-24) = 2073 = 3 \cdot 691.$$

An elaborate infinite product and a simple sum over divisors give the same remainder, for every positive integer. Why?

Congruences like this helped motivate Jean-Pierre Serre's predictions of Galois representations attached to modular forms, which Deligne constructed. These representations encode symmetries of algebraic numbers in matrices, connecting the coefficients of modular forms with the arithmetic of equations. The broader theory of modularity and congruences became central to Andrew Wiles's proof of Fermat's Last Theorem, completed with Richard Taylor's collaboration. The 691 congruence was an early glimpse of this relationship. Tau had become a prototype for connections now studied throughout the Langlands program, a far-reaching effort to relate the symmetries of equations to those of functions [5].

Chasing the bound

The bound itself first invited an analytic attack: study the modular form as a function and estimate its coefficients. Hardy and others made progress. Robert Rankin and Fields medalist Atle Selberg independently developed a powerful method involving averages of squared coefficients. It sharpened the known bounds and became part of the standard equipment of number theory. Yet the sharp bound at every prime remained out of reach [6].

Meanwhile, Erich Hecke built a theory explaining the arithmetic structure of modular forms, and Hans Petersson formulated a broader version of Ramanujan’s prediction. The problem had become a test of how well mathematicians understood an entire family of highly symmetric functions [7, 8].

The decisive advance came from geometry. Martin Eichler and Goro Shimura connected modular forms with the geometry of modular curves, which organize families of elliptic curves. Michio Kuga, Mikio Sato, and Yasutaka Ihara helped develop the higher-dimensional picture needed for forms such as Ramanujan’s. Families of elliptic curves, rather than a single curve, could carry the arithmetic information hidden in the coefficients [9, 10].

How counting points can bound a coefficient

Geometry here means studying equations, including equations in finite number systems. Modulo 5, for example, we calculate with the remainders $0, 1, 2, 3, 4$. The equation $x^2 = 1$ has two solutions, 1 and 4, because $4^2 = 16$ leaves remainder 1. With two variables, each solution is a point, and we can ask how many points an equation has.

For elliptic curves, described by suitable cubic equations, Helmut Hasse proved a striking estimate. Over the field with $p$ elements, the number of points, including a point at infinity, differs from $p + 1$ by at most $2\sqrt{p}$. A curve cannot have arbitrarily many or arbitrarily few points: its geometry constrains the count.

In 1949, André Weil proposed a vast extension of this phenomenon. Weil asked what happens when we count solutions in a finite number system and in larger finite systems containing it. These are towers of finite fields with fixed characteristic. The answers can be packaged into a generating function called a *zeta function*. Weil predicted that this infinite collection of counts has a finite algebraic description, obeys a symmetry, and reflects the underlying geometry. Most difficult was a precise constraint on the sizes of the numbers governing those counts, an analogue of the Riemann hypothesis [11].

Bernard Dwork proved that the zeta function is a *rational function*, namely a simple ratio of two polynomials. Alexander Grothendieck, Michael Artin, and their collaborators developed the geometric machinery that established other parts of Weil's vision. The remaining size constraint would require Deligne's breakthrough [12].

Here is where Ramanujan's sequence reappears. In 1969, Deligne showed how the Weil conjectures would imply Ramanujan's bound. His construction places the information governing $\tau(p)$ inside geometry to which those conjectures apply. In that setting, $\tau(p)$ is the sum of two numbers whose absolute sizes the Weil conjectures predict to be $p^{11/2}$. Their sum could then have absolute size at most $2p^{11/2}$. The final inequality is elementary. However, finding the geometry that makes it available is the extraordinary achievement! In 1974, Deligne published the proof of the missing Weil conjecture, completing the argument [12, 13].

An analytic statement about the coefficients of a function had yielded to a theorem about geometry over finite fields, a phenomenon which is now quite common in the field of *arithmetic geometry*. There is a lovely further connection: Rankin's analytic ideas helped inspire part of Deligne's geometric proof. In 1978, Deligne received the Fields Medal, with his proof of the Weil conjectures central to the recognition [10].

Pierre Deligne

Pierre Deligne. Born in Belgium in 1944, Deligne worked alongside Alexander Grothendieck at the IHÉS near Paris before joining the Institute for Advanced Study in Princeton in 1984. His work revealed profound connections between algebraic geometry and number theory. He received the Fields Medal in 1978 and the Abel Prize in 2013 [19].

Making the connections explicit

Following this proof from beginning to end is something like a gauntlet that travels through several branches of mathematics. Deligne’s original accounts compress substantial constructions. His 1974 paper states the Ramanujan–Petersson theorem, an extensive generalization of Ramanujan’s conjecture for τ(p), cites a construction under more restrictive hypotheses, and indicates that the general case follows by extending it. Later treatments, notably Anthony Scholl’s work, supply important further detail [12, 14].

For a reader, the challenge is to assemble the connections across demanding papers and theories. Specialists can reconstruct steps that a newcomer would not know how to begin. Deligne himself later simplified part of the geometric argument. Bringing its many ingredients together in a fully explicit account remains a substantial undertaking [15].

This is one reason we formalize. In Lean, each definition and argument must fit together precisely. The conclusion of one theorem must satisfy the hypotheses of the next, even when the two come from different mathematical subjects. Making those connections explicit can require substantial mathematics, and leaves a record that others can inspect and reuse.

From Stacks to Weil to Ramanujan–Petersson

Axiom’s work on this theorem rests on earlier formalization projects. Our Stacks development formalizes the mathematical foundations recorded in the Stacks Project, the collaborative reference work on algebraic geometry, curated by Aise Johan de Jong (Columbia University). This means building a large body of definitions and proofs that can support further mathematics, including the geometric tools needed here.

On that foundation, our Weil development formalizes the Weil conjectures and the refined bounds needed for the next stage. Ramanujan–Petersson then connects those geometric results to modular forms. Formalizing each stage is a technical achievement; making them work together is another. A theorem in geometry becomes useful here only after the arithmetic objects have been connected to it with all the necessary hypotheses checked [16, 17].

Axiom Prover, our AI system for developing formal proofs, carried out the Lean formalization using these foundations together with Mathlib, the community’s Lean mathematics library, and the Tau Ceti elliptic-curve development. Axiom Prover constructs arguments, and Lean’s kernel checks that the formal conclusions follow from their definitions and assumptions accordingly. Mathematicians must still review whether those formal statements express the intended mathematics.

A somewhat different route

To our surprise, the formalization led to a somewhat different route through part of the argument. It compares formulas for modular forms with counts drawn from whole families of elliptic curves. Deligne's bounds control the geometric side, and a further argument extracts the desired bound for each modular form. Our technical report explains the details (see [18]).

The ingredients draw on classical work, including Ihara's comparisons and Deligne's later refinements. To our knowledge, the particular way they are assembled here represents a modest departure from standard presentations$^{1}$ [9, 15]. Making every connection explicit can lead to a fresh route through established mathematics.

Far beyond one sequence

Ramanujan's tau function is the prototype, and Deligne's Theorem, formalized here, bounds the coefficients of an entire class of *integer-weight holomorphic cusp forms*. These are modular forms that vanish at special boundary points called cusps. Their weight describe the symmetries, which is 12 in the case of Ramanujan's $\tau(n)$. For the basic building blocks called normalized Hecke eigenforms, the bound is

$$|a(p)| \le 2p^{(k-1)/2}.$$

Here $a(p)$ is the coefficient at a prime $p$, and $k$ is the weight. The formalization covers every integer weight $k \ge 2$, every level, and every character, at primes not dividing the level.$^{2}$ Our technical report gives the exact statement and proof [16, 18].

Such bounds reach far beyond the sequences that first suggested them. Ramanujan–Petersson and its generalizations enter analytic number theory, the study of $L$-functions, counting solutions to equations, the distribution of arithmetic points, and the geometry and dynamics of arithmetic spaces [20]. One especially tangible connection is to *Ramanujan graphs*: networks that combine few connections per vertex with exceptionally strong connectivity. Alex Lubotzky, Ralph Phillips, and Peter Sarnak used the classical theorem to construct such graphs. This connects the story to combinatorics and theoretical computer science, where expander graphs help turn sparse connections into efficient communication and computation [21].

The next horizon

Even this broader theorem is one part of a much larger family of predictions, the *generalized Ramanujan conjectures*, within the Langlands program. Modular forms have higher-dimensional relatives called automorphic forms. Think of them as mathematical waves constrained by arithmetic symmetries. Ramanujan's question becomes: how large can the numbers describing those waves be? The conjectures predict sharp limits on the arithmetic data carried by these waves.$^{3}$ Many cases over number fields remain open. Tau's bound is an early glimpse of the order they predict [20].

Selberg’s eigenvalue conjecture expresses a closely related prediction about the possible vibration frequencies of certain curved arithmetic surfaces. Arthur’s conjectures describe how the possible families of waves fit together for more general symmetries, allowing behavior that the simplest version of Ramanujan’s prediction would miss. These are related parts of a larger picture, rather than interchangeable versions of a single inequality [20].

For us, formalizing Ramanujan–Petersson brings a new kind of completion to one of mathematics’ most beautiful stories. The numbers 1,−24,252,−1472,… led generations of mathematicians from a calculation to a meeting of analysis, algebra, and geometry. We can now give that journey an explicit, computer-checked form, with foundations others can inspect, reuse, and extend. Ramanujan’s sequence has carried us a long way, and it’s still pointing the way at the frontier of research.

Peter Sarnak

Peter Sarnak. South African-born Sarnak is a leading figure in the study of the generalized Ramanujan conjectures and their applications. A professor at Princeton and professor emeritus at the Institute for Advanced Study, he has connected number theory with analysis, geometry, and combinatorics. He received the Wolf Prize in 2014. His influential survey, Notes on the Generalized Ramanujan Conjectures, offers a guide to the larger landscape for readers ready to explore further [22, 20].

---

¹ The distinction concerns the explicit arithmetic–geometric trace comparison and the extraction of the individual bound. Deligne's own Weil II, §3.7.1, already avoids the higher-dimensional compactification used in his earlier route; avoiding that construction is not itself a new contribution.

² The level and character specify the modular symmetry conditions. The first coefficient is normalized to 1.

³ For unitary cuspidal automorphic representations of $\mathrm{GL}_n$, the unramified part of the generalized Ramanujan conjecture says that the normalized local parameters have absolute value 1.

Sources and further reading

[1] E. Embleton, Revisiting Ramanujan, Royal Society, 1 October 2018, $\href{https://royalsociety.org/blog/2018/10/revisiting-ramanujan/}{\text{royalsociety.org/blog/2018/10/revisiting-ramanujan}}$.

[2] G. H. Hardy and S. Ramanujan, Asymptotic formulae in combinatory analysis, Proceedings of the London Mathematical Society (2) 17 (1918), 75–115; A. Folsom, K. Ono, and R. C. Rhoades, Mock theta functions and quantum modular forms, Forum of Mathematics, Pi 1 (2013), e2, 27 pp.

[3] S. Ramanujan, On certain arithmetical functions, Transactions of the Cambridge Philosophical Society 22 (1916), 159–184.

[4] L. J. Mordell, On Mr. Ramanujan's empirical expansions of modular functions, Proceedings of the Cambridge Philosophical Society 19 (1917), 117–124.

[5] J. A. Thorne, Congruences between modular forms, Proceedings of the Indian Academy of Sciences, Mathematical Sciences 134 (2024), no. 1, Paper No. 9, 31 pp., $\href{https://www.dpmms.cam.ac.uk/~jat58/congruences.pdf}{\text{dpmms.cam.ac.uk/\textasciitilde jat58/congruences.pdf}}$.

[6] R. A. Rankin, Contributions to the theory of Ramanujan's function $\tau(n)$ and similar arithmetical functions. II. The order of the Fourier coefficients of integral modular forms, Proceedings of the Cambridge Philosophical Society 35 (1939), 357–372; A. Selberg, Bemerkungen über eine Dirichletsche Reihe, die mit der Theorie der Modulformen nahe verbunden ist, Archiv for Mathematik og Naturvidenskab 43 (1940), no. 4, 47–50.

[7] E. Hecke, Analytische Arithmetik der positiven quadratischen Formen, Det Kongelige Danske Videnskabernes Selskab, Mat.-Fys. Meddelelser 17, no. 12 (1940); reprinted in Mathematische Werke, Vandenhoeck & Ruprecht (1959), 789–918.

[8] H. Petersson, Über die lineare Zerlegung der den ganzen Modulformen von höherer Stufe entsprechenden Dirichletreihen in vollständige Eulersche Produkte, Acta Mathematica 80 (1948), 191–221.

[9] Y. Ihara, Hecke polynomials as congruence zeta functions in elliptic modular case, Annals of Mathematics 85 (1967), 267–295.

[10] N. M. Katz, The work of Pierre Deligne, in Proceedings of the International Congress of Mathematicians, Helsinki 1978, vol. 1 (1980), 47–52.

[11] J. S. Milne, The Riemann Hypothesis over Finite Fields: From Weil to the Present Day (2015), $\href{https://arxiv.org/abs/1509.00797}{\text{arxiv.org/abs/1509.00797}}$.

[12] P. Deligne, La conjecture de Weil I, Publications Mathématiques de l'IHÉS 43 (1974), 273–307.

[13] P. Deligne, Formes modulaires et représentations $\ell$-adiques, Bourbaki exposé 355 (1969), Lecture Notes in Mathematics 179 (1971), 139–172.

[14] A. J. Scholl, Motives for modular forms, Inventiones Mathematicae 100 (1990), 419–430.

[15] P. Deligne, La conjecture de Weil II, Publications Mathématiques de l'IHÉS 52 (1980), 137–252, especially §3.7.1.

[16] AxiomMath, RamanujanPetersson, GitHub repository, $\href{https://github.com/AxiomMath/RamanujanPetersson}{\text{github.com/AxiomMath/RamanujanPetersson}}$.

[17] AxiomMath, Stacks, $\href{https://github.com/AxiomMath/Stacks}{\text{github.com/AxiomMath/Stacks}}$; AxiomMath, Weil, $\href{https://github.com/AxiomMath/Weil}{\text{github.com/AxiomMath/Weil}}$.

[18] Axiom Math, A proof of the Ramanujan–Petersson conjecture, formalized in Lean, accompanying technical report, especially "Comparing arithmetic and geometric traces" and "The general theorem."

[19] The Abel Prize, Pierre Deligne: biography (2013), $\href{https://www.mathunion.org/fileadmin/IMU/Prizes/Abel/2013/Abelprize_2013_Deligne_Bio.pdf}{\text{mathunion.org/.../Abelprize\_2013\_Deligne\_Bio.pdf}}$.

[20] P. Sarnak, Notes on the Generalized Ramanujan Conjectures, in Harmonic Analysis, the Trace Formula, and Shimura Varieties, Clay Mathematics Proceedings 4 (2005), 659–685, $\href{https://publications.ias.edu/sites/default/files/FieldNotesCurrent.pdf}{\text{publications.ias.edu/.../FieldNotesCurrent.pdf}}$.

[21] A. Lubotzky, R. Phillips, and P. Sarnak, Ramanujan graphs, Combinatorica 8 (1988), 261–277.

[22] Institute for Advanced Study, Peter Sarnak, faculty biography and curriculum vitae, $\href{https://www.ias.edu/scholars/sarnak}{\text{ias.edu/scholars/sarnak}}$.