Hello, 


I've been working deriving the orthogonality relation for quadratic Dirichlet characters $\chi\_d(n)$ (or real primitive characters). The statement I'm trying to prove is 


$$\lim\_{X \rightarrow \infty} \frac{1}{D} \sum\_{0 < |d| \leq X} \chi\_d(n)= \begin{cases}
 \prod\_{p|n} \left(1 + \frac{1}{p}\right)^{-1} \quad &\text{if $m$ is a perfect square,} \newline
 0 \quad &\text{otherwise,}
\end{cases}$$ 
where the sum ranges over fundamental discriminants $d$ and $D$ is the number of terms appearing in the sum. 


You could recast this as 


$$\lim\_{X \rightarrow \infty} \frac{1}{D} \sum\_{0 < |d| \leq X} \chi\_d(n)\chi\_d(m)= \begin{cases}
 \prod\_{p|nm} \left(1 + \frac{1}{p}\right)^{-1} \quad &\text{if $mn$ is a perfect square,} \newline
 0 \quad &\text{otherwise,}
\end{cases}$$ 


which has the standard form of an orthogonality relation for characters. In the first case, $\chi\_d(n) = 1$ unless $\gcd(d,n) > 1$, so essentially i'm trying to count fundamental discriminants. But this still seems a bit tricky to me. 


My approach is to try and count fundamental discriminants by using the generating function for squarefree numbers, i.e. $$\frac{\zeta(s)}{\zeta(2s)} = \sum\_{n=1}^\infty \frac{|\mu(n)|}{n^s}.$$ I know that Jutila proves this in his paper On the Mean Values of $L(1/2,\chi\_d)$ for Real Characters, but I would like to prove this lemma equation using analytic methods. Can anyone help me. 



orthogonality relation for quadratic Dirichlet characters
So I think I solved half of the problem. Suppose that $n$ is a perfect square. Then $\chi\_d(n) = 1$ unless $\gcd(d,n) > 1$, in which case its $0$. So, for $\gcd{d,n} = 1$, we are simply pulling out the subset of fundamental discriminants having no common divisor with $n$. To quantify the size of this subset, we must first count fundamental discriminants. 


The set of fundamental discriminants consists of all square-free integers congruent to $1$ modulo $4$ (i.e. odd fundamental discriminants) and all such numbers multiplied by $-4$ and $\pm 8$ (i.e. even fundamental discriminants). The odd fundamental discriminants may be counted by considering the series $$\sum\_{\text{$d$ odd}} \frac{1}{|d|^s}.$$ In fact, this is a Dirichlet series. For observe that $$\sum\_{\text{$d$ odd}} \frac{1}{|d|^s} = 1 + \frac{1}{3^s} + \frac{1}{5^s} + \frac{1}{7^s} + \cdots = \prod\_{p>2} \left(1 + \frac{1}{p^s}\right) = \frac{\zeta(s)}{\zeta(2s)} \left(1 + \frac{1}{2^s}\right)^{-1},$$
where $$\frac{\zeta(s)}{\zeta(2s)} = \sum\_{n=1}^\infty \frac{|\mu(n)|}{n^s},$$ is the Dirichlet series which generates the square-free numbers. So, by following the definition of fundamental discriminants given above, we can count fundamental discriminants by using the Dirichlet series $$\left(1 + \frac{1}{4^s} + \frac{2}{8^s}\right) \frac{\zeta(s)}{\zeta(2s)} \left(1 +\frac{1}{2^s}\right)^{-1} = \left(1 + \frac{1}{4^s} + \frac{2}{8^s}\right) \underbrace{\prod\_{p>2} \left(1 + \frac{1}{p^s}\right)}\_{l\_p(s)}.$$ 


Now, to omit those discriminants with $\gcd(d,m) > 1$, we just omit the corresponding factors in $l\_p(s)$. What's missing is $$\prod\_{\substack{p>2 \\ p|m}} \left(1 + \frac{1}{p^s}\right),$$ so the relative density (compared to all fundamental discriminants $d$) is can be quantified by the expression $$\frac{1}{D} \cdot \prod\_{\substack{p>2 \\ p\nmid m}} \left(1 + \frac{1}{p^s}\right) = \prod\_{\substack{p>2 \\ p|m}} \left(1 + \frac{1}{p^s}\right)^{-1}.$$ As in the proof of the prime number theorem, the main contribution here comes from the simple pole at $s=1$ (of $\zeta(s)$). In fact, $p=2$ also fits at $s=1$ since $1 + \frac{1}{4} + \frac{2}{8} = 1 + \frac{1}{2}$. Thus, in the end we obtain $$\lim\_{X\rightarrow \infty} \frac{1}{D} \sum\_{0 < |d| \leq X} \chi\_d(m) = \prod\_{p|m} \left(1 + \frac{1}{p}\right)^{-1},$$ as desired.


Now, does anyone know how to explain the other case. I assume it just follows from the symmetry of the roots of unity. But can anyone validate and perhaps clarify this. Thank you. 


