# Dirichlet character

In analytic number theory and related branches of mathematics, a complex-valued arithmetic function $\chi :\mathbb {Z} \rightarrow \mathbb {C}$ is a Dirichlet character of modulus $m$ (where $m$ is a positive integer) if for all integers $a$ and $b$:
* $\chi (ab)=\chi (a)\chi (b);$ that is, $\chi$ is completely multiplicative.
* $\chi (a){\begin{cases}=0&{\text{if }}\gcd(a,m)>1\\\neq 0&{\text{if }}\gcd(a,m)=1.\end{cases}}$ (gcd is the greatest common divisor)
* $\chi (a+m)=\chi (a)$; that is, $\chi$ is periodic with period $m$.
The simplest possible character, called the principal character, usually denoted $\chi _{0}$, (see Notation below) exists for all moduli:
    $\chi _{0}(a)={\begin{cases}0&{\text{if }}\gcd(a,m)>1\\1&{\text{if }}\gcd(a,m)=1.\end{cases}}$
The German mathematician Peter Gustav Lejeune Dirichlet—for whom the character is named—introduced these functions in his 1837 paper on primes in arithmetic progressions.

## Notation

$\phi (n)$ is Euler's totient function.
$\zeta _{n}$ is a complex primitive n-th root of unity:
    $\zeta _{n}^{n}=1,$ but $\zeta _{n}\neq 1,\zeta _{n}^{2}\neq 1,...\zeta _{n}^{n-1}\neq 1.$
$(\mathbb {Z} /m\mathbb {Z} )^{\times }$ is the group of units mod $m$. It has order $\phi (m).$
${\widehat {(\mathbb {Z} /m\mathbb {Z} )^{\times }}}$ is the group of Dirichlet characters mod $m$.
$p,p_{k},$ etc. are prime numbers.
$(m,n)$ is a standard abbreviation for $\gcd(m,n)$
$\chi (a),\chi '(a),\chi _{r}(a),$ etc. are Dirichlet characters. (the lowercase Greek letter chi for "character")
There is no standard notation for Dirichlet characters that includes the modulus. In many contexts (such as in the proof of Dirichlet's theorem) the modulus is fixed. In other contexts, such as this article, characters of different moduli appear. Where appropriate this article employs a variation of Conrey labeling (introduced by Brian Conrey and used by the LMFDB).
In this labeling characters for modulus $m$ are denoted $\chi _{m,t}(a)$ where the index $t$ is described in the section the group of characters below. In this labeling, $\chi _{m,\_}(a)$ denotes an unspecified character and $\chi _{m,1}(a)$ denotes the principal character mod $m$.

## Relation to group characters

The word "character" is used several ways in mathematics. In this section it refers to a homomorphism from a group $G$ (written multiplicatively) to the multiplicative group of the field of complex numbers:
    $\eta :G\rightarrow \mathbb {C} ^{\times },\;\;\eta (gh)=\eta (g)\eta (h),\;\;\eta (g^{-1})=\eta (g)^{-1}.$
The set of characters is denoted ${\widehat {G}}.$ If the product of two characters is defined by pointwise multiplication $\eta \theta (a)=\eta (a)\theta (a),$ the identity by the trivial character $\eta _{0}(a)=1$ and the inverse by complex inversion $\eta ^{-1}(a)=\eta (a)^{-1}$ then ${\widehat {G}}$ becomes an abelian group.
If $A$ is a finite abelian group then there is an isomorphism $A\cong {\widehat {A}}$, and the orthogonality relations:
    $\sum _{a\in A}\eta (a)={\begin{cases}|A|&{\text{ if }}\eta =\eta _{0}\\0&{\text{ if }}\eta \neq \eta _{0}\end{cases}}$  and  $\sum _{\eta \in {\widehat {A}}}\eta (a)={\begin{cases}|A|&{\text{ if }}a=1\\0&{\text{ if }}a\neq 1.\end{cases}}$
The elements of the finite abelian group $(\mathbb {Z} /m\mathbb {Z} )^{\times }$ are the residue classes $[a]=\{x:x\equiv a{\pmod {m}}\}$ where $(a,m)=1.$
A group character $\rho :(\mathbb {Z} /m\mathbb {Z} )^{\times }\rightarrow \mathbb {C} ^{\times }$ can be extended to a Dirichlet character $\chi :\mathbb {Z} \rightarrow \mathbb {C}$ by defining
    $\chi (a)={\begin{cases}0&{\text{if }}[a]\not \in (\mathbb {Z} /m\mathbb {Z} )^{\times }&{\text{i.e. }}(a,m)>1\\\rho ([a])&{\text{if }}[a]\in (\mathbb {Z} /m\mathbb {Z} )^{\times }&{\text{i.e. }}(a,m)=1,\end{cases}}$
and conversely, a Dirichlet character mod $m$ defines a group character on $(\mathbb {Z} /m\mathbb {Z} )^{\times }.$
Paraphrasing Davenport, Dirichlet characters can be regarded as a particular case of Abelian group characters. But this article follows Dirichlet in giving a direct and constructive account of them. This is partly for historical reasons, in that Dirichlet's work preceded by several decades the development of group theory, and partly for a mathematical reason, namely that the group in question has a simple and interesting structure which is obscured if one treats it as one treats the general Abelian group.

## Elementary facts

4) Since $\gcd(1,m)=1,$ property 2) says $\chi (1)\neq 0$ so it can be canceled from both sides of $\chi (1)\chi (1)=\chi (1\times 1)=\chi (1)$:
    $\chi (1)=1.$
5) Property 3) is equivalent to
    if $a\equiv b{\pmod {m}}$ then $\chi (a)=\chi (b).$
6) Property 1) implies that, for any positive integer $n$
    $\chi (a^{n})=\chi (a)^{n}.$
7) Euler's theorem states that if $(a,m)=1$ then $a^{\phi (m)}\equiv 1{\pmod {m}}.$ Therefore,
    $\chi (a)^{\phi (m)}=\chi (a^{\phi (m)})=\chi (1)=1.$
That is, the nonzero values of $\chi (a)$ are $\phi (m)$-th roots of unity:
    $\chi (a)={\begin{cases}0&{\text{if }}\gcd(a,m)>1\\\zeta _{\phi (m)}^{r}&{\text{if }}\gcd(a,m)=1\end{cases}}$
for some integer $r$ which depends on $\chi ,\zeta ,$ and $a$. This implies there are only a finite number of characters for a given modulus.
8) If $\chi$ and $\chi '$ are two characters for the same modulus so is their product $\chi \chi ',$ defined by pointwise multiplication:
    $\chi \chi '(a)=\chi (a)\chi '(a)$ ($\chi \chi '$ obviously satisfies 1-3).
The principal character is an identity:
    $\chi \chi _{0}(a)=\chi (a)\chi _{0}(a)={\begin{cases}0\times 0&=\chi (a)&{\text{if }}\gcd(a,m)>1\\\chi (a)\times 1&=\chi (a)&{\text{if }}\gcd(a,m)=1.\end{cases}}$
9) Let $a^{-1}$ denote the inverse of $a$ in $(\mathbb {Z} /m\mathbb {Z} )^{\times }$. Then
    $\chi (a)\chi (a^{-1})=\chi (aa^{-1})=\chi (1)=1,$ so $\chi (a^{-1})=\chi (a)^{-1},$ which extends 6) to all integers.
The complex conjugate of a root of unity is also its inverse (see here for details), so for $(a,m)=1$
    ${\overline {\chi }}(a)=\chi (a)^{-1}=\chi (a^{-1}).$ (${\overline {\chi }}$ also obviously satisfies 1-3).
Thus for all integers $a$
    $\chi (a){\overline {\chi }}(a)={\begin{cases}0&{\text{if }}\gcd(a,m)>1\\1&{\text{if }}\gcd(a,m)=1\end{cases}};$ in other words $\chi {\overline {\chi }}=\chi _{0}$.
10) The multiplication and identity defined in 8) and the inversion defined in 9) turn the set of Dirichlet characters for a given modulus into a finite abelian group.

## The group of characters

There are three different cases because the groups $(\mathbb {Z} /m\mathbb {Z} )^{\times }$ have different structures depending on whether $m$ is a power of 2, a power of an odd prime, or the product of prime powers.

### Powers of odd primes

If $q=p^{k}$ is an odd number $(\mathbb {Z} /q\mathbb {Z} )^{\times }$ is cyclic of order $\phi (q)$; a generator is called a primitive root mod $q$. Let $g_{q}$ be a primitive root and for $(a,q)=1$ define the function $\nu _{q}(a)$ (the index of $a$) by
    $a\equiv g_{q}^{\nu _{q}(a)}{\pmod {q}},$
    $0\leq \nu _{q}<\phi (q).$
For $(ab,q)=1,\;\;a\equiv b{\pmod {q}}$ if and only if $\nu _{q}(a)=\nu _{q}(b).$ Since
    $\chi (a)=\chi (g_{q}^{\nu _{q}(a)})=\chi (g_{q})^{\nu _{q}(a)},$ $\chi$ is determined by its value at $g_{q}.$
Let $\omega _{q}=\zeta _{\phi (q)}$ be a primitive $\phi (q)$-th root of unity. From property 7) above the possible values of $\chi (g_{q})$ are $\omega _{q},\omega _{q}^{2},...\omega _{q}^{\phi (q)}=1.$ These distinct values give rise to $\phi (q)$ Dirichlet characters mod $q.$ For $(r,q)=1$ define $\chi _{q,r}(a)$ as
    $\chi _{q,r}(a)={\begin{cases}0&{\text{if }}\gcd(a,q)>1\\\omega _{q}^{\nu _{q}(r)\nu _{q}(a)}&{\text{if }}\gcd(a,q)=1.\end{cases}}$
Then for $(rs,q)=1$ and all $a$ and $b$
    $\chi _{q,r}(a)\chi _{q,r}(b)=\chi _{q,r}(ab),$ showing that $\chi _{q,r}$ is a character and
    $\chi _{q,r}(a)\chi _{q,s}(a)=\chi _{q,rs}(a),$ which gives an explicit isomorphism ${\widehat {(\mathbb {Z} /p^{k}\mathbb {Z} )^{\times }}}\cong (\mathbb {Z} /p^{k}\mathbb {Z} )^{\times }.$

#### Examples m = 3, 5, 7, 9

2 is a primitive root mod 3. ($\phi (3)=2$)
    $2^{1}\equiv 2,\;2^{2}\equiv 2^{0}\equiv 1{\pmod {3}},$
so the values of $\nu _{3}$ are
    ${\begin{array}{|c|c|c|c|c|c|c|}a&1&2\\\hline \nu _{3}(a)&0&1\\\end{array}}$.
The nonzero values of the characters mod 3 are
    ${\begin{array}{|c|c|c|c|c|c|c|}&1&2\\\hline \chi _{3,1}&1&1\\\chi _{3,2}&1&-1\\\end{array}}$
2 is a primitive root mod 5. ($\phi (5)=4$)
    $2^{1}\equiv 2,\;2^{2}\equiv 4,\;2^{3}\equiv 3,\;2^{4}\equiv 2^{0}\equiv 1{\pmod {5}},$
so the values of $\nu _{5}$ are
    ${\begin{array}{|c|c|c|c|c|c|c|}a&1&2&3&4\\\hline \nu _{5}(a)&0&1&3&2\\\end{array}}$.
The nonzero values of the characters mod 5 are
    ${\begin{array}{|c|c|c|c|c|c|c|}&1&2&3&4\\\hline \chi _{5,1}&1&1&1&1\\\chi _{5,2}&1&i&-i&-1\\\chi _{5,3}&1&-i&i&-1\\\chi _{5,4}&1&-1&-1&1\\\end{array}}$
3 is a primitive root mod 7. ($\phi (7)=6$)
    $3^{1}\equiv 3,\;3^{2}\equiv 2,\;3^{3}\equiv 6,\;3^{4}\equiv 4,\;3^{5}\equiv 5,\;3^{6}\equiv 3^{0}\equiv 1{\pmod {7}},$
so the values of $\nu _{7}$ are
    ${\begin{array}{|c|c|c|c|c|c|c|}a&1&2&3&4&5&6\\\hline \nu _{7}(a)&0&2&1&4&5&3\\\end{array}}$.
The nonzero values of the characters mod 7 are ($\omega =\zeta _{6},\;\;\omega ^{3}=-1$)
    ${\begin{array}{|c|c|c|c|c|c|c|}&1&2&3&4&5&6\\\hline \chi _{7,1}&1&1&1&1&1&1\\\chi _{7,2}&1&-\omega &\omega ^{2}&\omega ^{2}&-\omega &1\\\chi _{7,3}&1&\omega ^{2}&\omega &-\omega &-\omega ^{2}&-1\\\chi _{7,4}&1&\omega ^{2}&-\omega &-\omega &\omega ^{2}&1\\\chi _{7,5}&1&-\omega &-\omega ^{2}&\omega ^{2}&\omega &-1\\\chi _{7,6}&1&1&-1&1&-1&-1\\\end{array}}$.
2 is a primitive root mod 9. ($\phi (9)=6$)
    $2^{1}\equiv 2,\;2^{2}\equiv 4,\;2^{3}\equiv 8,\;2^{4}\equiv 7,\;2^{5}\equiv 5,\;2^{6}\equiv 2^{0}\equiv 1{\pmod {9}},$
so the values of $\nu _{9}$ are
    ${\begin{array}{|c|c|c|c|c|c|c|}a&1&2&4&5&7&8\\\hline \nu _{9}(a)&0&1&2&5&4&3\\\end{array}}$.
The nonzero values of the characters mod 9 are ($\omega =\zeta _{6},\;\;\omega ^{3}=-1$)
    ${\begin{array}{|c|c|c|c|c|c|c|}&1&2&4&5&7&8\\\hline \chi _{9,1}&1&1&1&1&1&1\\\chi _{9,2}&1&\omega &\omega ^{2}&-\omega ^{2}&-\omega &-1\\\chi _{9,4}&1&\omega ^{2}&-\omega &-\omega &\omega ^{2}&1\\\chi _{9,5}&1&-\omega ^{2}&-\omega &\omega &\omega ^{2}&-1\\\chi _{9,7}&1&-\omega &\omega ^{2}&\omega ^{2}&-\omega &1\\\chi _{9,8}&1&-1&1&-1&1&-1\\\end{array}}$.

### Powers of 2

$(\mathbb {Z} /2\mathbb {Z} )^{\times }$ is the trivial group with one element. $(\mathbb {Z} /4\mathbb {Z} )^{\times }$ is cyclic of order 2. For 8, 16, and higher powers of 2, there is no primitive root; the powers of 5 are the units $\equiv 1{\pmod {4}}$ and their negatives are the units $\equiv 3{\pmod {4}}.$ For example
    $5^{1}\equiv 5,\;5^{2}\equiv 5^{0}\equiv 1{\pmod {8}}$
    $5^{1}\equiv 5,\;5^{2}\equiv 9,\;5^{3}\equiv 13,\;5^{4}\equiv 5^{0}\equiv 1{\pmod {16}}$
    $5^{1}\equiv 5,\;5^{2}\equiv 25,\;5^{3}\equiv 29,\;5^{4}\equiv 17,\;5^{5}\equiv 21,\;5^{6}\equiv 9,\;5^{7}\equiv 13,\;5^{8}\equiv 5^{0}\equiv 1{\pmod {32}}.$
Let $q=2^{k},\;\;k\geq 3$; then $(\mathbb {Z} /q\mathbb {Z} )^{\times }$ is the direct product of a cyclic group of order 2 (generated by −1) and a cyclic group of order ${\frac {\phi (q)}{2}}$ (generated by 5). For odd numbers $a$ define the functions $\nu _{0}$ and $\nu _{q}$ by
    $a\equiv (-1)^{\nu _{0}(a)}5^{\nu _{q}(a)}{\pmod {q}},$
    $0\leq \nu _{0}<2,\;\;0\leq \nu _{q}<{\frac {\phi (q)}{2}}.$
For odd $a$ and $b,\;\;a\equiv b{\pmod {q}}$ if and only if $\nu _{0}(a)=\nu _{0}(b)$ and $\nu _{q}(a)=\nu _{q}(b).$ For odd $a$ the value of $\chi (a)$ is determined by the values of $\chi (-1)$ and $\chi (5).$
Let $\omega _{q}=\zeta _{\frac {\phi (q)}{2}}$ be a primitive ${\frac {\phi (q)}{2}}$-th root of unity. The possible values of $\chi ((-1)^{\nu _{0}(a)}5^{\nu _{q}(a)})$ are $\pm \omega _{q},\pm \omega _{q}^{2},...\pm \omega _{q}^{\frac {\phi (q)}{2}}=\pm 1.$ These distinct values give rise to $\phi (q)$ Dirichlet characters mod $q.$ For odd $r$ define $\chi _{q,r}(a)$ by
    $\chi _{q,r}(a)={\begin{cases}0&{\text{if }}a{\text{ is even}}\\(-1)^{\nu _{0}(r)\nu _{0}(a)}\omega _{q}^{\nu _{q}(r)\nu _{q}(a)}&{\text{if }}a{\text{ is odd}}.\end{cases}}$
Then for odd $r$ and $s$ and all $a$ and $b$
    $\chi _{q,r}(a)\chi _{q,r}(b)=\chi _{q,r}(ab)$ showing that $\chi _{q,r}$ is a character and
    $\chi _{q,r}(a)\chi _{q,s}(a)=\chi _{q,rs}(a)$ showing that ${\widehat {(\mathbb {Z} /2^{k}\mathbb {Z} )^{\times }}}\cong (\mathbb {Z} /2^{k}\mathbb {Z} )^{\times }.$

#### Examples m = 2, 4, 8, 16

The only character mod 2 is the principal character $\chi _{2,1}$.
−1 is a primitive root mod 4 ($\phi (4)=2$)
    ${\begin{array}{|||}a&1&3\\\hline \nu _{0}(a)&0&1\\\end{array}}$
The nonzero values of the characters mod 4 are
    ${\begin{array}{|c|c|c|c|c|c|c|}&1&3\\\hline \chi _{4,1}&1&1\\\chi _{4,3}&1&-1\\\end{array}}$
−1 is and 5 generate the units mod 8 ($\phi (8)=4$)
    ${\begin{array}{|||}a&1&3&5&7\\\hline \nu _{0}(a)&0&1&0&1\\\nu _{8}(a)&0&1&1&0\\\end{array}}$.
The nonzero values of the characters mod 8 are
    ${\begin{array}{|c|c|c|c|c|c|c|}&1&3&5&7\\\hline \chi _{8,1}&1&1&1&1\\\chi _{8,3}&1&1&-1&-1\\\chi _{8,5}&1&-1&-1&1\\\chi _{8,7}&1&-1&1&-1\\\end{array}}$
−1 and 5 generate the units mod 16 ($\phi (16)=8$)
    ${\begin{array}{|||}a&1&3&5&7&9&11&13&15\\\hline \nu _{0}(a)&0&1&0&1&0&1&0&1\\\nu _{16}(a)&0&3&1&2&2&1&3&0\\\end{array}}$.
The nonzero values of the characters mod 16 are
    ${\begin{array}{|||}&1&3&5&7&9&11&13&15\\\hline \chi _{16,1}&1&1&1&1&1&1&1&1\\\chi _{16,3}&1&-i&-i&1&-1&i&i&-1\\\chi _{16,5}&1&-i&i&-1&-1&i&-i&1\\\chi _{16,7}&1&1&-1&-1&1&1&-1&-1\\\chi _{16,9}&1&-1&-1&1&1&-1&-1&1\\\chi _{16,11}&1&i&i&1&-1&-i&-i&-1\\\chi _{16,13}&1&i&-i&-1&-1&-i&i&1\\\chi _{16,15}&1&-1&1&-1&1&-1&1&-1\\\end{array}}$.

### Products of prime powers

Let $m=p_{1}^{m_{1}}p_{2}^{m_{2}}\cdots p_{k}^{m_{k}}=q_{1}q_{2}\cdots q_{k}$ where $p_{1}<p_{2}<\dots <p_{k}$ be the factorization of $m$ into prime powers. The group of units mod $m$ is isomorphic to the direct product of the groups mod the $q_{i}$:
    $(\mathbb {Z} /m\mathbb {Z} )^{\times }\cong (\mathbb {Z} /q_{1}\mathbb {Z} )^{\times }\times (\mathbb {Z} /q_{2}\mathbb {Z} )^{\times }\times \dots \times (\mathbb {Z} /q_{k}\mathbb {Z} )^{\times }.$
This means that 1) there is a one-to-one correspondence between $a\in (\mathbb {Z} /m\mathbb {Z} )^{\times }$ and $k$-tuples $(a_{1},a_{2},\dots ,a_{k})$ where $a_{i}\in (\mathbb {Z} /q_{i}\mathbb {Z} )^{\times }$ and 2) multiplication mod $m$ corresponds to coordinate-wise multiplication of $k$-tuples:
    $ab\equiv c{\pmod {m}}$ corresponds to
    $(a_{1},a_{2},\dots ,a_{k})\times (b_{1},b_{2},\dots ,b_{k})=(c_{1},c_{2},\dots ,c_{k})$ where $c_{i}\equiv a_{i}b_{i}{\pmod {q_{i}}}.$
The Chinese remainder theorem (CRT) implies that the $a_{i}$ are simply $a_{i}\equiv a{\pmod {q_{i}}}.$
There are subgroups $G_{i}<(\mathbb {Z} /m\mathbb {Z} )^{\times }$ such that
    $G_{i}\cong (\mathbb {Z} /q_{i}\mathbb {Z} )^{\times }$ and
    $G_{i}\equiv {\begin{cases}(\mathbb {Z} /q_{i}\mathbb {Z} )^{\times }&\mod q_{i}\\\{1\}&\mod q_{j},j\neq i.\end{cases}}$
Then $(\mathbb {Z} /m\mathbb {Z} )^{\times }\cong G_{1}\times G_{2}\times ...\times G_{k}$ and every $a\in (\mathbb {Z} /m\mathbb {Z} )^{\times }$ corresponds to a $k$-tuple $(a_{1},a_{2},...a_{k})$ where $a_{i}\in G_{i}$ and $a_{i}\equiv a{\pmod {q_{i}}}.$
Every $a\in (\mathbb {Z} /m\mathbb {Z} )^{\times }$ can be uniquely factored as $a=a_{1}a_{2}...a_{k}.$
If $\chi _{m,\_}$ is a character mod $m,$ on the subgroup $G_{i}$ it must be identical to some $\chi _{q_{i},\_}$ mod $q_{i}$ Then
    $\chi _{m,\_}(a)=\chi _{m,\_}(a_{1}a_{2}...)=\chi _{m,\_}(a_{1})\chi _{m,\_}(a_{2})...=\chi _{q_{1},\_}(a_{1})\chi _{q_{2},\_}(a_{2})...,$
showing that every character mod $m$ is the product of characters mod the $q_{i}$.
For $(t,m)=1$ define
    $\chi _{m,t}=\chi _{q_{1},t}\chi _{q_{2},t}...$
Then for $(rs,m)=1$ and all $a$ and $b$
    $\chi _{m,r}(a)\chi _{m,r}(b)=\chi _{m,r}(ab),$ showing that $\chi _{m,r}$ is a character and
    $\chi _{m,r}(a)\chi _{m,s}(a)=\chi _{m,rs}(a),$ showing an isomorphism ${\widehat {(\mathbb {Z} /m\mathbb {Z} )^{\times }}}\cong (\mathbb {Z} /m\mathbb {Z} )^{\times }.$

#### Examples m = 15, 24, 40

$(\mathbb {Z} /15\mathbb {Z} )^{\times }\cong (\mathbb {Z} /3\mathbb {Z} )^{\times }\times (\mathbb {Z} /5\mathbb {Z} )^{\times }.$
The factorization of the characters mod 15 is
    ${\begin{array}{|c|c|c|c|c|c|c|}&\chi _{5,1}&\chi _{5,2}&\chi _{5,3}&\chi _{5,4}\\\hline \chi _{3,1}&\chi _{15,1}&\chi _{15,7}&\chi _{15,13}&\chi _{15,4}\\\chi _{3,2}&\chi _{15,11}&\chi _{15,2}&\chi _{15,8}&\chi _{15,14}\\\end{array}}$
The nonzero values of the characters mod 15 are
    ${\begin{array}{|||}&1&2&4&7&8&11&13&14\\\hline \chi _{15,1}&1&1&1&1&1&1&1&1\\\chi _{15,2}&1&-i&-1&i&i&-1&-i&1\\\chi _{15,4}&1&-1&1&-1&-1&1&-1&1\\\chi _{15,7}&1&i&-1&i&-i&1&-i&-1\\\chi _{15,8}&1&i&-1&-i&-i&-1&i&1\\\chi _{15,11}&1&-1&1&1&-1&-1&1&-1\\\chi _{15,13}&1&-i&-1&-i&i&1&i&-1\\\chi _{15,14}&1&1&1&-1&1&-1&-1&-1\\\end{array}}$.
$(\mathbb {Z} /24\mathbb {Z} )^{\times }\cong (\mathbb {Z} /8\mathbb {Z} )^{\times }\times (\mathbb {Z} /3\mathbb {Z} )^{\times }.$ The factorization of the characters mod 24 is
    ${\begin{array}{|c|c|c|c|c|c|c|}&\chi _{8,1}&\chi _{8,3}&\chi _{8,5}&\chi _{8,7}\\\hline \chi _{3,1}&\chi _{24,1}&\chi _{24,19}&\chi _{24,13}&\chi _{24,7}\\\chi _{3,2}&\chi _{24,17}&\chi _{24,11}&\chi _{24,5}&\chi _{24,23}\\\end{array}}$
The nonzero values of the characters mod 24 are
    ${\begin{array}{|||}&1&5&7&11&13&17&19&23\\\hline \chi _{24,1}&1&1&1&1&1&1&1&1\\\chi _{24,5}&1&1&1&1&-1&-1&-1&-1\\\chi _{24,7}&1&1&-1&-1&1&1&-1&-1\\\chi _{24,11}&1&1&-1&-1&-1&-1&1&1\\\chi _{24,13}&1&-1&1&-1&-1&1&-1&1\\\chi _{24,17}&1&-1&1&-1&1&-1&1&-1\\\chi _{24,19}&1&-1&-1&1&-1&1&1&-1\\\chi _{24,23}&1&-1&-1&1&1&-1&-1&1\\\end{array}}$.
$(\mathbb {Z} /40\mathbb {Z} )^{\times }\cong (\mathbb {Z} /8\mathbb {Z} )^{\times }\times (\mathbb {Z} /5\mathbb {Z} )^{\times }.$ The factorization of the characters mod 40 is
    ${\begin{array}{|c|c|c|c|c|c|c|}&\chi _{8,1}&\chi _{8,3}&\chi _{8,5}&\chi _{8,7}\\\hline \chi _{5,1}&\chi _{40,1}&\chi _{40,11}&\chi _{40,21}&\chi _{40,31}\\\chi _{5,2}&\chi _{40,17}&\chi _{40,27}&\chi _{40,37}&\chi _{40,7}\\\chi _{5,3}&\chi _{40,33}&\chi _{40,3}&\chi _{40,13}&\chi _{40,23}\\\chi _{5,4}&\chi _{40,9}&\chi _{40,19}&\chi _{40,29}&\chi _{40,39}\\\end{array}}$
The nonzero values of the characters mod 40 are
    ${\begin{array}{|||}&1&3&7&9&11&13&17&19&21&23&27&29&31&33&37&39\\\hline \chi _{40,1}&1&1&1&1&1&1&1&1&1&1&1&1&1&1&1&1\\\chi _{40,3}&1&i&i&-1&1&-i&-i&-1&-1&-i&-i&1&-1&i&i&1\\\chi _{40,7}&1&i&-i&-1&-1&-i&i&1&1&i&-i&-1&-1&-i&i&1\\\chi _{40,9}&1&-1&-1&1&1&-1&-1&1&1&-1&-1&1&1&-1&-1&1\\\chi _{40,11}&1&1&-1&1&1&-1&1&1&-1&-1&1&-1&-1&1&-1&-1\\\chi _{40,13}&1&-i&-i&-1&-1&-i&-i&1&-1&i&i&1&1&i&i&-1\\\chi _{40,17}&1&-i&i&-1&1&-i&i&-1&1&-i&i&-1&1&-i&i&-1\\\chi _{40,19}&1&-1&1&1&1&1&-1&1&-1&1&-1&-1&-1&-1&1&-1\\\chi _{40,21}&1&-1&1&1&-1&-1&1&-1&-1&1&-1&-1&1&1&-1&1\\\chi _{40,23}&1&-i&i&-1&-1&i&-i&1&1&-i&i&-1&-1&i&-i&1\\\chi _{40,27}&1&-i&-i&-1&1&i&i&-1&-1&i&i&1&-1&-i&-i&1\\\chi _{40,29}&1&1&-1&1&-1&1&-1&-1&-1&-1&1&-1&1&-1&1&1\\\chi _{40,31}&1&-1&-1&1&-1&1&1&-1&1&-1&-1&1&-1&1&1&-1\\\chi _{40,33}&1&i&-i&-1&1&i&-i&-1&1&i&-i&-1&1&i&-i&-1\\\chi _{40,37}&1&i&i&-1&-1&i&i&1&-1&-i&-i&1&1&-i&-i&-1\\\chi _{40,39}&1&1&1&1&-1&-1&-1&-1&1&1&1&1&-1&-1&-1&-1\\\end{array}}$.

### Summary

Let $m=p_{1}^{k_{1}}p_{2}^{k_{2}}\cdots =q_{1}q_{2}\cdots$, $p_{1}<p_{2}<\dots$ be the factorization of $m$ and assume $(rs,m)=1.$
There are $\phi (m)$ Dirichlet characters mod $m.$ They are denoted by $\chi _{m,r},$ where $\chi _{m,r}=\chi _{m,s}$ is equivalent to $r\equiv s{\pmod {m}}.$ The identity $\chi _{m,r}(a)\chi _{m,s}(a)=\chi _{m,rs}(a)\;$ is an isomorphism ${\widehat {(\mathbb {Z} /m\mathbb {Z} )^{\times }}}\cong (\mathbb {Z} /m\mathbb {Z} )^{\times }.$
Each character mod $m$ has a unique factorization as the product of characters mod the prime powers dividing $m$:
    $\chi _{m,r}=\chi _{q_{1},r}\chi _{q_{2},r}...$
If $m=m_{1}m_{2},(m_{1},m_{2})=1$ the product $\chi _{m_{1},r}\chi _{m_{2},s}$ is a character $\chi _{m,t}$ where $t$ is given by $t\equiv r{\pmod {m_{1}}}$ and $t\equiv s{\pmod {m_{2}}}.$
Also, $\chi _{m,r}(s)=\chi _{m,s}(r)$

## Orthogonality

The two orthogonality relations are
    $\sum _{a\in (\mathbb {Z} /m\mathbb {Z} )^{\times }}\chi (a)={\begin{cases}\phi (m)&{\text{ if }}\;\chi =\chi _{0}\\0&{\text{ if }}\;\chi \neq \chi _{0}\end{cases}}$  and  $\sum _{\chi \in {\widehat {(\mathbb {Z} /m\mathbb {Z} )^{\times }}}}\chi (a)={\begin{cases}\phi (m)&{\text{ if }}\;a\equiv 1{\pmod {m}}\\0&{\text{ if }}\;a\not \equiv 1{\pmod {m}}.\end{cases}}$
The relations can be written in the symmetric form
    $\sum _{a\in (\mathbb {Z} /m\mathbb {Z} )^{\times }}\chi _{m,r}(a)={\begin{cases}\phi (m)&{\text{ if }}\;r\equiv 1\\0&{\text{ if }}\;r\not \equiv 1\end{cases}}$  and  $\sum _{r\in (\mathbb {Z} /m\mathbb {Z} )^{\times }}\chi _{m,r}(a)={\begin{cases}\phi (m)&{\text{ if }}\;a\equiv 1\\0&{\text{ if }}\;a\not \equiv 1.\end{cases}}$
The first relation is easy to prove: If $\chi =\chi _{0}$ there are $\phi (m)$ non-zero summands each equal to 1. If $\chi \neq \chi _{0}$there is some $a^{*},\;(a^{*},m)=1,\;\chi (a^{*})\neq 1.$ Then
    $\chi (a^{*})\sum _{a\in (\mathbb {Z} /m\mathbb {Z} )^{\times }}\chi (a)=\sum _{a}\chi (a^{*})\chi (a)=\sum _{a}\chi (a^{*}a)=\sum _{a}\chi (a),$ implying
    $(\chi (a^{*})-1)\sum _{a}\chi (a)=0.$ Dividing by the first factor gives $\sum _{a}\chi (a)=0,$ QED. The identity $\chi _{m,r}(s)=\chi _{m,s}(r)$ for $(rs,m)=1$ shows that the relations are equivalent to each other.
The second relation can be proven directly in the same way, but requires a lemma
    Given $a\not \equiv 1{\pmod {m}},\;(a,m)=1,$ there is a $\chi ^{*},\;\chi ^{*}(a)\neq 1.$
The second relation has an important corollary: if $(a,m)=1,$ define the function
    $f_{a}(n)={\frac {1}{\phi (m)}}\sum _{\chi }{\bar {\chi }}(a)\chi (n).$ Then
    $f_{a}(n)={\frac {1}{\phi (m)}}\sum _{\chi }\chi (a^{-1})\chi (n)={\frac {1}{\phi (m)}}\sum _{\chi }\chi (a^{-1}n)={\begin{cases}1,&n\equiv a{\pmod {m}}\\0,&n\not \equiv a{\pmod {m}},\end{cases}}$
That is $f_{a}=\mathbb {1} _{[a]}$ the indicator function of the residue class $[a]=\{x:\;x\equiv a{\pmod {m}}\}$. It is basic in the proof of Dirichlet's theorem.

## Classification of characters
### Conductor; Primitive and induced characters

Any character mod a prime power is also a character mod every larger power. For example, mod 16
    ${\begin{array}{|||}&1&3&5&7&9&11&13&15\\\hline \chi _{16,3}&1&-i&-i&1&-1&i&i&-1\\\chi _{16,9}&1&-1&-1&1&1&-1&-1&1\\\chi _{16,15}&1&-1&1&-1&1&-1&1&-1\\\end{array}}$
$\chi _{16,3}$ has period 16, but $\chi _{16,9}$ has period 8 and $\chi _{16,15}$ has period 4: $\chi _{16,9}=\chi _{8,5}$ and $\chi _{16,15}=\chi _{8,7}=\chi _{4,3}.$
We say that a character $\chi$ of modulus $q$ has a quasiperiod of $d$ if $\chi (m)=\chi (n)$ for all $m$, $n$ coprime to $q$ satisfying $m\equiv n$ mod $d$. For example, $\chi _{2,1}$, the only Dirichlet character of modulus $2$, has a quasiperiod of $1$, but not a period of $1$ (it has a period of $2$, though). The smallest positive integer for which $\chi$ is quasiperiodic is the conductor of $\chi$. So, for instance, $\chi _{2,1}$ has a conductor of $1$.
The conductor of $\chi _{16,3}$ is 16, the conductor of $\chi _{16,9}$ is 8 and that of $\chi _{16,15}$ and $\chi _{8,7}$ is 4. If the modulus and conductor are equal the character is primitive, otherwise imprimitive. An imprimitive character is induced by the character for the smallest modulus: $\chi _{16,9}$ is induced from $\chi _{8,5}$ and $\chi _{16,15}$ and $\chi _{8,7}$ are induced from $\chi _{4,3}$.
A related phenomenon can happen with a character mod the product of primes; its nonzero values may be periodic with a smaller period.
For example, mod 15,
    ${\begin{array}{|||}&1&2&3&4&5&6&7&8&9&10&11&12&13&14&15\\\hline \chi _{15,8}&1&i&0&-1&0&0&-i&-i&0&0&-1&0&i&1&0\\\chi _{15,11}&1&-1&0&1&0&0&1&-1&0&0&-1&0&1&-1&0\\\chi _{15,13}&1&-i&0&-1&0&0&-i&i&0&0&1&0&i&-1&0\\\end{array}}$.
The nonzero values of $\chi _{15,8}$ have period 15, but those of $\chi _{15,11}$ have period 3 and those of $\chi _{15,13}$ have period 5. This is easier to see by juxtaposing them with characters mod 3 and 5:
    ${\begin{array}{|||}&1&2&3&4&5&6&7&8&9&10&11&12&13&14&15\\\hline \chi _{15,11}&1&-1&0&1&0&0&1&-1&0&0&-1&0&1&-1&0\\\chi _{3,2}&1&-1&0&1&-1&0&1&-1&0&1&-1&0&1&-1&0\\\hline \chi _{15,13}&1&-i&0&-1&0&0&-i&i&0&0&1&0&i&-1&0\\\chi _{5,3}&1&-i&i&-1&0&1&-i&i&-1&0&1&-i&i&-1&0\\\end{array}}$.
If a character mod $m=qr,\;\;(q,r)=1,\;\;q>1,\;\;r>1$ is defined as
    $\chi _{m,\_}(a)={\begin{cases}0&{\text{ if }}\gcd(a,m)>1\\\chi _{q,\_}(a)&{\text{ if }}\gcd(a,m)=1\end{cases}}$, or equivalently as $\chi _{m,\_}=\chi _{q,\_}\chi _{r,1},$
its nonzero values are determined by the character mod $q$ and have period $q$.
The smallest period of the nonzero values is the conductor of the character. For example, the conductor of $\chi _{15,8}$ is 15, the conductor of $\chi _{15,11}$ is 3, and that of $\chi _{15,13}$ is 5.
As in the prime-power case, if the conductor equals the modulus the character is primitive, otherwise imprimitive. If imprimitive it is induced from the character with the smaller modulus. For example, $\chi _{15,11}$ is induced from $\chi _{3,2}$ and $\chi _{15,13}$ is induced from $\chi _{5,3}$
The principal character is not primitive.
The character $\chi _{m,r}=\chi _{q_{1},r}\chi _{q_{2},r}...$ is primitive if and only if each of the factors is primitive.
Primitive characters often simplify (or make possible) formulas in the theories of L-functions and modular forms.

### Parity

$\chi (a)$ is even if $\chi (-1)=1$ and is odd if $\chi (-1)=-1.$
This distinction appears in the functional equation of the Dirichlet L-function.

### Order

The order of a character is its order as an element of the group ${\widehat {(\mathbb {Z} /m\mathbb {Z} )^{\times }}}$, i.e. the smallest positive integer $n$ such that $\chi ^{n}=\chi _{0}.$ Because of the isomorphism ${\widehat {(\mathbb {Z} /m\mathbb {Z} )^{\times }}}\cong (\mathbb {Z} /m\mathbb {Z} )^{\times }$ the order of $\chi _{m,r}$ is the same as the order of $r$ in $(\mathbb {Z} /m\mathbb {Z} )^{\times }.$ The principal character has order 1; other real characters have order 2, and imaginary characters have order 3 or greater. By Lagrange's theorem the order of a character divides the order of ${\widehat {(\mathbb {Z} /m\mathbb {Z} )^{\times }}}$ which is $\phi (m)$

### Real characters

$\chi (a)$ is real or quadratic if all of its values are real (they must be $0,\;\pm 1$); otherwise it is complex or imaginary.
$\chi$ is real if and only if $\chi ^{2}=\chi _{0}$; $\chi _{m,k}$ is real if and only if $k^{2}\equiv 1{\pmod {m}}$; in particular, $\chi _{m,-1}$ is real and non-principal.
Dirichlet's original proof that $L(1,\chi )\neq 0$ (which was only valid for prime moduli) took two different forms depending on whether $\chi$ was real or not. His later proof, valid for all moduli, was based on his class number formula.
Real characters are Kronecker symbols; for example, the principal character can be written $\chi _{m,1}=\left({\frac {m^{2}}{\bullet }}\right)$.
The real characters in the examples are:

#### Principal

If $m=p_{1}^{k_{1}}p_{2}^{k_{2}}...,\;p_{1}<p_{2}<\;...$ the principal character is $\chi _{m,1}=\left({\frac {p_{1}^{2}p_{2}^{2}...}{\bullet }}\right).$
$\chi _{16,1}=\chi _{8,1}=\chi _{4,1}=\chi _{2,1}=\left({\frac {4}{\bullet }}\right)$  $\chi _{9,1}=\chi _{3,1}=\left({\frac {9}{\bullet }}\right)$  $\chi _{5,1}=\left({\frac {25}{\bullet }}\right)$  $\chi _{7,1}=\left({\frac {49}{\bullet }}\right)$  $\chi _{15,1}=\left({\frac {225}{\bullet }}\right)$  $\chi _{24,1}=\left({\frac {36}{\bullet }}\right)$  $\chi _{40,1}=\left({\frac {100}{\bullet }}\right)$

#### Primitive

If the modulus is the absolute value of a fundamental discriminant there is a real primitive character (there are two if the modulus is a multiple of 8); otherwise if there are any primitive characters they are imaginary.
$\chi _{3,2}=\left({\frac {-3}{\bullet }}\right)$  $\chi _{4,3}=\left({\frac {-4}{\bullet }}\right)$  $\chi _{5,4}=\left({\frac {5}{\bullet }}\right)$  $\chi _{7,6}=\left({\frac {-7}{\bullet }}\right)$  $\chi _{8,3}=\left({\frac {-8}{\bullet }}\right)$  $\chi _{8,5}=\left({\frac {8}{\bullet }}\right)$  $\chi _{15,14}=\left({\frac {-15}{\bullet }}\right)$  $\chi _{24,5}=\left({\frac {-24}{\bullet }}\right)$  $\chi _{24,11}=\left({\frac {24}{\bullet }}\right)$  $\chi _{40,19}=\left({\frac {-40}{\bullet }}\right)$  $\chi _{40,29}=\left({\frac {40}{\bullet }}\right)$

#### Imprimitive

$\chi _{8,7}=\chi _{4,3}=\left({\frac {-4}{\bullet }}\right)$  $\chi _{9,8}=\chi _{3,2}=\left({\frac {-3}{\bullet }}\right)$  $\chi _{15,4}=\chi _{5,4}\chi _{3,1}=\left({\frac {45}{\bullet }}\right)$  $\chi _{15,11}=\chi _{3,2}\chi _{5,1}=\left({\frac {-75}{\bullet }}\right)$  $\chi _{16,7}=\chi _{8,3}=\left({\frac {-8}{\bullet }}\right)$  $\chi _{16,9}=\chi _{8,5}=\left({\frac {8}{\bullet }}\right)$  $\chi _{16,15}=\chi _{4,3}=\left({\frac {-4}{\bullet }}\right)$
$\chi _{24,7}=\chi _{8,7}\chi _{3,1}=\chi _{4,3}\chi _{3,1}=\left({\frac {-36}{\bullet }}\right)$  $\chi _{24,13}=\chi _{8,5}\chi _{3,1}=\left({\frac {72}{\bullet }}\right)$  $\chi _{24,17}=\chi _{3,2}\chi _{8,1}=\left({\frac {-12}{\bullet }}\right)$  $\chi _{24,19}=\chi _{8,3}\chi _{3,1}=\left({\frac {-72}{\bullet }}\right)$  $\chi _{24,23}=\chi _{8,7}\chi _{3,2}=\chi _{4,3}\chi _{3,2}=\left({\frac {12}{\bullet }}\right)$
$\chi _{40,9}=\chi _{5,4}\chi _{8,1}=\left({\frac {20}{\bullet }}\right)$  $\chi _{40,11}=\chi _{8,3}\chi _{5,1}=\left({\frac {-200}{\bullet }}\right)$  $\chi _{40,21}=\chi _{8,5}\chi _{5,1}=\left({\frac {200}{\bullet }}\right)$  $\chi _{40,31}=\chi _{8,7}\chi _{5,1}=\chi _{4,3}\chi _{5,1}=\left({\frac {-100}{\bullet }}\right)$  $\chi _{40,39}=\chi _{8,7}\chi _{5,4}=\chi _{4,3}\chi _{5,4}=\left({\frac {-20}{\bullet }}\right)$

## Applications
### L-functions

The Dirichlet L-series for a character $\chi$ is
    $L(s,\chi )=\sum _{n=1}^{\infty }{\frac {\chi (n)}{n^{s}}}.$
This series only converges for ${\mathfrak {R}}(s)>1$; it can be analytically continued to a meromorphic function.
Dirichlet introduced the $L$-function along with the characters in his 1837 paper.

### Modular forms and functions

Dirichlet characters appear several places in the theory of modular forms and functions. A typical example is
Let $\chi \in {\widehat {(\mathbb {Z} /M\mathbb {Z} )^{\times }}}$ and let $\chi _{1}\in {\widehat {(\mathbb {Z} /N\mathbb {Z} )^{\times }}}$ be primitive.
If
    $f(z)=\sum a_{n}z^{n}\in M_{k}(M,\chi )$
define
    $f_{\chi _{1}}(z)=\sum \chi _{1}(n)a_{n}z^{n}$,
Then
    $f_{\chi _{1}}(z)\in M_{k}(MN^{2},\chi \chi _{1}^{2})$. If $f$ is a cusp form so is $f_{\chi _{1}}.$
See theta series of a Dirichlet character for another example.

### Gauss sum

The Gauss sum of a Dirichlet character modulo N is
    $G(\chi )=\sum _{a=1}^{N}\chi (a)e^{\frac {2\pi ia}{N}}.$
It appears in the functional equation of the Dirichlet L-function.

### Jacobi sum

If $\chi$ and $\psi$ are Dirichlet characters mod a prime $p$ their Jacobi sum is
    $J(\chi ,\psi )=\sum _{a=2}^{p-1}\chi (a)\psi (1-a).$
Jacobi sums can be factored into products of Gauss sums.

### Kloosterman sum

If $\chi$ is a Dirichlet character mod $q$ and $\zeta =e^{\frac {2\pi i}{q}}$ the Kloosterman sum $K(a,b,\chi )$ is defined as
    $K(a,b,\chi )=\sum _{r\in (\mathbb {Z} /q\mathbb {Z} )^{\times }}\chi (r)\zeta ^{ar+{\frac {b}{r}}}.$
If $b=0$ it is a Gauss sum.

## Sufficient conditions

It is not necessary to establish the defining properties 1) – 3) to show that a function is a Dirichlet character.

### From Davenport's book

If $\mathrm {X} :\mathbb {Z} \rightarrow \mathbb {C}$ such that
    1) $\mathrm {X} (ab)=\mathrm {X} (a)\mathrm {X} (b),$
    2) $\mathrm {X} (a+m)=\mathrm {X} (a)$,
    3) If $\gcd(a,m)>1$ then $\mathrm {X} (a)=0$, but
    4) $\mathrm {X} (a)$ is not always 0,
then $\mathrm {X} (a)$ is one of the $\phi (m)$ characters mod $m$

### Sárközy's Condition

A Dirichlet character is a completely multiplicative function $f:\mathbb {N} \rightarrow \mathbb {C}$ that satisfies a linear recurrence relation: that is, if $a_{1}f(n+b_{1})+\cdots +a_{k}f(n+b_{k})=0$
for all positive integers $n$, where $a_{1},\ldots ,a_{k}$ are not all zero and $b_{1},\ldots ,b_{k}$ are distinct then $f$ is a Dirichlet character.

### Chudakov's Condition

A Dirichlet character is a completely multiplicative function $f:\mathbb {N} \rightarrow \mathbb {C}$ satisfying the following three properties: a) $f$ takes only finitely many values; b) $f$ vanishes at only finitely many primes; c) there is an $\alpha \in \mathbb {C}$ for which the remainder
$\left|\sum _{n\leq x}f(n)-\alpha x\right|$
is uniformly bounded, as $x\rightarrow \infty$. This equivalent definition of Dirichlet characters was conjectured by Chudakov in 1956, and proved in 2017 by Klurman and Mangerel.