Dirichlet characters
A Dirichlet character is a pattern of roots of unity that repeats modulo and respects multiplication. Characters pick out residue classes the way sines and cosines pick out frequencies, which is how Dirichlet proved that every progression with contains infinitely many primes.
Definition and numbering
A character modulo is a function on the integers with , , and exactly when . Its nonzero values are roots of unity. There are characters modulo , and under multiplication they form a group isomorphic to the units modulo .
That isomorphism can be made explicit, and Conrey's numbering (the one used by the LMFDB) does so: for each coprime to there is a character , with . For an odd prime power with least primitive root ,
with a similar rule for powers of 2 using , and a product over the prime powers of .
import { dirichletCharacter, dirichletGroup } from "@ratmath/numtheory";
const chi = dirichletCharacter(7, 3);
String(chi); // "χ_7(3, ·)"
chi.order; // 6
chi.exponent(2); // 1/3: χ(2) = exp(2πi/3), exactly
chi.exponents(); // [null, 0, 1/3, 1/6, 2/3, 5/6, 1/2] for n = 0, …, 6
chi.value(2); // { re: -0.5, im: 0.866… }
chi.parity; // "odd": χ(−1) = −1
Values are kept exactly as fractions with ; value gives the complex number in doubles, and at(n) gives as BigInts for a real character.
The group of characters
const G = dirichletGroup(15);
G.order; // 8
G.structure; // [2, 4]: the group is Z/2 × Z/4, like the units mod 15
G.characters.map((c) => [c.number, c.order, c.conductor, c.parity]);
// [1, 1, 1, even] [2, 4, 15, even] [4, 2, 5, even] [7, 4, 5, odd]
// [8, 4, 15, even] [11, 2, 3, odd] [13, 4, 5, odd] [14, 2, 15, odd]
String(dirichletCharacter(15, 2).mul(dirichletCharacter(15, 2))); // "χ_15(4, ·)": numbers multiply
String(dirichletCharacter(3, 2).mul(dirichletCharacter(5, 2))); // "χ_15(2, ·)": moduli combine
String(dirichletCharacter(15, 2).conjugate()); // "χ_15(8, ·)"
The orthogonality relations are what make characters useful: summing over all characters isolates one residue class.
G.orthogonality(2, 2); // { re: 8, im: 0 }
G.orthogonality(2, 7); // { re: 0, im: 0 }
Conductors and primitive characters
A character modulo 15 may really come from a smaller modulus: only depends on modulo 3, wherever it is not zero. The smallest such modulus is the conductor, and a character is primitive when its conductor is its modulus. Every character is induced by exactly one primitive character.
const c = dirichletCharacter(15, 11);
c.conductor; // 3
String(c.primitive()); // "χ_3(2, ·)"
G.primitive.map((x) => x.number); // [2, 8, 14]
String(dirichletCharacter(5, 2).induce(15)); // "χ_15(7, ·)"
For a primitive character the Gauss sum has absolute value exactly ; it is the constant in the functional equation of the L-function.
Real characters and the Kronecker symbol
The characters with values in are the quadratic ones. For a discriminant , the Kronecker symbol is a character modulo , primitive exactly when is a fundamental discriminant. It records how primes split in : splits when the symbol is , is inert when it is , and ramifies when it is .
const k = kroneckerCharacter(-23);
String(k); // "χ_23(22, ·)"
[1, 2, 3, 4, 5, 6, 7].map((n) => k.at(n)); // [1n, 1n, 1n, 1n, -1n, 1n, -1n]
k.isPrimitive; // true
k.gaussSum(); // { re: 0, im: 4.7958… }: i·√23
String(kroneckerCharacter(-4)); // "χ_4(3, ·)"
String(kroneckerCharacter(5)); // "χ_5(4, ·)"
What characters are for: the L-functions , in Zeta and L values.
@ratmath/numtheory and Core's Rational in scope. The last line's value is shown; PRINT(…) adds lines, TEX(…) typesets math.