The *theta function* is the analytic function $\theta:U\to\mathbb{C}$ defined on the (open) right half-plane $U\subset\mathbb{C}$ by $\theta(\tau)=\sum_{n\in\mathbb{Z}}e^{-\pi n^2 \tau}$. It has the following important transformation property.

Theta reciprocity: $\theta(\tau)=\frac{1}{\sqrt{\tau}}\theta\left(\frac{1}{\tau}\right)$.

This theorem, while fundamentally analytic—the proof is just Poisson summation coupled with the fact that a Gaussian is its own Fourier transform—has serious arithmetic significance.

It is the key ingredient in the proof of the functional equation of the Riemann zeta function.

It expresses the

*automorphy*of the theta function.

Theta reciprocity also provides an analytic proof (actually, the *only* proof, as far as I know) of the Landsberg-Schaar relation

$$\frac{1}{\sqrt{p}}\sum_{n=0}^{p-1}\exp\left(\frac{2\pi i n^2 q}{p}\right)=\frac{e^{\pi i/4}}{\sqrt{2q}}\sum_{n=0}^{2q-1}\exp\left(-\frac{\pi i n^2 p}{2q}\right)$$

where $p$ and $q$ are arbitrary positive integers. To prove it, apply theta reciprocity to $\tau=2iq/p+\epsilon$, $\epsilon>0$, and then let $\epsilon\to 0$.

This reduces to the formula for the quadratic Gauss sum when $q=1$:

$$\sum_{n=0}^{p-1} e^{2 \pi i n^2 / p} = \begin{cases} \sqrt{p} & \textrm{if } \; p\equiv 1\mod 4 \\\ i\sqrt{p} & \textrm{if } \; p\equiv 3\mod 4 \end{cases}$$

(where $p$ is an odd prime). From this, it's not hard to deduce Gauss's "golden theorem".

Quadratic reciprocity: $\left(\frac{p}{q}\right)\left(\frac{q}{p}\right)=(-1)^{(p-1)(q-1)/4}$ for odd primes $p$ and $q$.

For reference, this is worked out in detail in the paper "Applications of heat kernels on abelian groups: $\zeta(2n)$, quadratic reciprocity, Bessel integrals" by Anders Karlsson.

I feel like there is some deep mathematics going on behind the scenes here, but I don't know what.

Why should we expect theta reciprocity to be related to quadratic reciprocity? Is there a high-concept explanation of this phenomenon? If there is, can it be generalized to other reciprocity laws (like Artin reciprocity)?

Hopefully some wise number theorist can shed some light on this!