# Is there no proof of Dirichlet's results on quadratic residues without analysis?

Wikipedia states that all known proofs of Dirichlet's results

$$L(1) = -\frac{\pi}{\sqrt q}\sum_{n=1}^{q-1} \frac{n}{q} \left(\frac{n}{q}\right) \gt 0$$

and

$$L(1) = \frac{\pi}{\left(2-\left(\frac{2}{q}\right)\right)\!\sqrt q}\sum_{n=1}^\frac{q-1}{2}\left(\frac{n}{q}\right) \gt 0\;,$$

both valid for primes $q\equiv3\bmod4$, rely on analysis and that no "simple or direct" proof has ever been published. It cites the third edition of Davenport's Multiplicative Number Theory from $2000$, but the second edition from $1980$ that's available online (at archive.org and at Google Books) only contains the "simple and direct" claim and doesn't mention analysis (though it gives Dirichlet's proof, which uses a moderate amount of analysis).

Since these inequalities correspond to the rather basic number-theoretic facts that for primes $q\equiv3\bmod4$ the sum of the quadratic residues in $[1,q-1]$ is less than the sum of the non-residues and there are more quadratic residues than non-residues in $[1,(q-1)/2]$, respectively, I found this rather surprising and am wondering whether this claim is correct and up to date.

At Evaluate a character sum $\sum\limits_{r = 1}^{(p - 1)/2}r \left( \frac{r}{p} \right) = 0$ for a prime $p \equiv 7 \pmod 8$, David Speyer gives an elementary proof of the equation in the title, i.e. of the fact that the sums of the quadratic residues and non-residues in $[1,(q-1)/2]$ are equal for $q\equiv7\bmod8$. His proof also yields an elementary proof of the equality of Dirichlet's two expressions for that case (which means an elementary proof of either inequality would also yield a proof of the other for that case), but I don't see how to turn it into a proof of their positivity, even for that case. But the elementary character of his proof of a directly related result adds to my feeling that one shouldn't need analysis to prove the other results.

I also found this comment by Terry Tao on MO from 2011 saying that "a proof that $L(1,\chi)\ne0$ [...] seems to require some nontrivial machinery at some point" (where $\chi$ is a quadratic character), linking to On elementary proofs of the Prime Number Theorem for arithmetic progressions, without characters by Andrew Granville and apparently referring to the remark at the bottom of the second page.

So is it true that there is no proof of these inequalities that doesn't use analysis? Are there new developments in this regard? Or could you provide some insight to someone with a limited number-theoretical background why one might expect these proofs to require analysis?

By Kronecker's formula, the value at $s=1$ of $L(s,\chi)$ functions associated with quadratic characters depends on a class number, so there actually is an algebraic counterpart dealing with reduced binary quadratic forms. The basic problem is to find the sign of a Gauss sum, where $G(\chi)^2 = p$ is almost trivial. However, I am not so sure that "the algebraic way" is actually more elementary than the analytic one, and that is probably the meaning of Granville's remark.