Orthogonality of Dirichlet characters (source code)

= Orthogonality of Dirichlet characters
{c}

For reduced residue classes $a,n$ modulo $q$,
$$
\frac1{\varphi(q)}
\sum_{\chi\bmod q}\overline{\chi(a)}\chi(n)
=
\begin{cases}
1,&n\equiv a\pmod q,\\
0,&n\not\equiv a\pmod q.
\end{cases}
$$
This is the orthogonality relation for the characters of the finite <abelian group> $(\mathbb Z/q\mathbb Z)^\times$.