TL;DR
Dirichlet's theorem says that if and have no common factor, the progression contains infinitely many primes. A stronger form says the primes are shared out evenly among the allowed remainders mod . The proof needs tools beyond elementary counting, which is why the result was a landmark when it appeared in 1837.
Builds on: Prime Number Theorem, Euler's Totient Function · Leads to: the Bombieri-Vinogradov theorem, Dirichlet characters
Where it's used
Choosing moduli for fast arithmetic. Some algorithms multiply large polynomials using a modular version of the Fourier transform, and they need a prime with divisible by a large power of 2. The prime 998244353 is one such prime, and it satisfies . Dirichlet's theorem guarantees that such primes exist for every power of 2, which is why the search for them is worth doing.
Searching for a prime in a required class. A program that needs a prime can search the progression and expect to find primes after a modest number of tries. The walkthrough below explains why.
Counting primes by type. Analysts of prime tables compare how many primes fall in each residue class. The even split predicted by the theorem is the baseline against which any bias is measured.
How it works
Take the modulus . The remainders coprime to 4 are 1 and 3, so there are allowed classes. Dirichlet's theorem says the odd primes should split between them, roughly evenly, and that each class contains infinitely many primes.
- List the allowed classes. Numbers congruent to 0 or 2 mod 4 are even, so they can hold only the prime 2. The allowed classes are and . Check: each of 1 and 3 shares no factor with 4.
- List the primes up to 30. They are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, which is 10 primes.
- Sort them by remainder mod 4. The primes are 5, 13, 17 and 29, which is 4 of them. The primes are 3, 7, 11, 19 and 23, which is 5 of them. The prime 2 is the one left over. Check: .
- Compare with the even split. Among the 9 odd primes up to 30, an even split would give 4.5 to each class. The observed 4 and 5 are close to that.
- Go further. Up to 100 the odd primes split 11 to 13. The even split would give 12 and 12. Check: 11 + 13 + 1 = 25, which is .
- Read off the rule. Both classes keep receiving primes, and the difference between them stays small compared with the total. Dirichlet's theorem says this does not stop: each allowed class receives infinitely many primes.
- primes 1 mod 4
- primes 3 mod 4
The math
Let and let satisfy . Then the progression contains infinitely many primes. More precisely, let be the number of primes with . Then
The second statement says the primes are shared out evenly among the allowed classes, which is the sense in which they "spread evenly".
Step 1 in symbols: the allowed classes
The classes with form a group under multiplication, the group of units mod . Its size is , the totient. For the group is , of size 2. Each allowed class should get about of the primes.
Step 2 in symbols: separating classes with characters
A Dirichlet character mod is a function on the integers that is periodic mod , is zero when , and is a group homomorphism from the units mod into the unit circle of the complex numbers. For there are two characters: the trivial character , which is 1 on odd numbers, and , which is when and when .
For an odd prime , the indicator of is
Check: if , the bracket is , and half of that is 1. If , the bracket is .
In general the same orthogonality of characters gives, for ,
Step 3 in symbols: the trivial character
The trivial character gives up to the finitely many primes dividing . By the Prime Number Theorem, this is about . So the trivial character supplies the main term .
Step 4 in symbols: the other characters
For a nontrivial character , the sum must grow more slowly than . For , the check at is , which is tiny beside 25.
The reason is the L-function , which converges for real . Writing it as an Euler product over primes, for near 1. The key fact is that is finite and nonzero for every nontrivial . For this is the Leibniz series .
Step 5 in symbols: infinitely many primes
For the trivial character, is essentially , which diverges as . This divergence is the reason there are infinitely many primes at all. For a progression , the same argument gives
The trivial character's sum diverges, and the nontrivial sums stay bounded because . So the left side diverges, which forces infinitely many primes in the class .
Worked examples
The allowed classes mod 3 are and . The primes up to 20 are 2, 3, 5, 7, 11, 13, 17 and 19.
- The prime 3 is divisible by 3, so it is in class .
- The primes are 7, 13 and 19, which is 3 primes.
- The primes are 2, 5, 11 and 17, which is 4 primes.
- Check the total: , which is .
- Interpretation: the two allowed classes share the 7 primes that are not 3 almost evenly, 3 to 4. The even split would be 3.5 each.
Use and . There are primes, and exactly one of them, 2, is even. So there are 24 odd primes.
- Write the indicator of for odd primes as .
- Add over the 24 odd primes: .
- Compute , since there are 11 primes and 13 primes .
- So , which matches the direct count.
- Interpretation: the difference between the two classes is only 2, and the character sum is the thing that controls it. The theorem says this sum is small compared with the count, so the split becomes even in the limit.
A transform of length needs a prime . The candidates are for whole numbers , and all of them are odd, since is even. Around , the chance that such a candidate is prime is about .
- .
- The probability is about .
- The reciprocal is about 10.4. So roughly one candidate in ten is prime.
- Interpretation: a search through this progression should find a prime after about ten tries near . Dirichlet's theorem says the search never runs out, and the density estimate says how long it takes.
Try it: about how many candidates should you test near ? Answer: , so the probability is about , and the expected number of candidates is about .
Common mistakes and tradeoffs
It is tempting to think the condition can be dropped. In fact the progression , with , contains no primes at all. Every term is divisible by 3, and 3 itself is not in the progression. The condition is what rules out such common factors.
It is tempting to think the primes are split exactly evenly at every . In fact the split is only asymptotic. Up to 100 the classes mod 4 receive 11 and 13 primes. Small leads of one class over the other, such as this one, are called Chebyshev's bias. The theorem says the split evens out in the limit, although the bias can persist for a long range of .
It is tempting to think the theorem tells you where the next prime in a class is. In fact it proves that primes exist in the class and that they are spread evenly. It gives no bound on how far apart they are, which needs a different and harder result.
It is tempting to confuse this result with the theorem that the primes contain arbitrarily long arithmetic progressions, which is the Green–Tao theorem. There the progressions are made of primes; here the primes lie in a progression.
Use the theorem when you need primes in a fixed residue class, for example to choose a modulus or to split a count by class. Do not use it when you need an exact position or an exact count; for that, sieve. Its quantitative form is a statement about the limit, so at small the counts can differ noticeably from the even split.
History
Legendre conjectured, from tables of primes, that a progression with no common factor should contain infinitely many primes. Gauss and others studied the question too. The even split is the sharper form that the analytic work later made precise.
Peter Gustav Lejeune Dirichlet proved the statement that bears his name in 1837. His proof introduced characters and the L-functions that carry his name, and it used analysis where earlier number theory had used only algebra. The step that needed the most work was showing that is nonzero for nontrivial characters.
In 1896 Jacques Hadamard and Charles Jean de la Vallée Poussin proved the Prime Number Theorem. De la Vallée Poussin extended the same analytic method to progressions, which gave the full asymptotic form . That extension is what made the result useful beyond the question of infinitude.
It caught on because it answers a practical question about where primes live, and because its method, through characters and L-functions, became the foundation of analytic number theory.
Recap
- Dirichlet's theorem: if , the progression contains infinitely many primes.
- The primes are shared evenly among the allowed classes, asymptotically.
- Characters separate the classes, and the trivial character gives the main term from the Prime Number Theorem.
- The nontrivial characters contribute little because , which is the hard step.
- Read next: Dirichlet Character for the characters themselves, and Bombieri–Vinogradov for a result that averages the progression counts over many moduli.
Check yourself
QuestionState Dirichlet's theorem in words, including the condition on and .Show answer
If and share no common factor, the arithmetic progression contains infinitely many primes. The condition is needed: when and share a factor, every term shares that factor too, so there are at most finitely many primes in the progression.
QuestionCount the primes up to 30 that are , and the primes up to 30 that are .Show answer
The primes up to 30 are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29. Those are 5, 13, 17 and 29, which is 4 primes. Those are 3, 7, 11, 19 and 23, which is 5 primes. The prime 2 is in neither class.
QuestionWhy does the trivial character produce the main term in the count of primes in a class, while the nontrivial characters do not?Show answer
The trivial character is 1 on every number coprime to , so its sum over primes is the full prime count , which is about . The nontrivial characters take values and (or complex values of modulus 1) in a pattern that cancels over primes. Their sums are much smaller because the corresponding L-function is finite and nonzero at .
QuestionYou need a prime with near . About how many candidates of the form should you test before finding one?Show answer
The density for candidates coprime to is about . Here , and , so the chance of a prime is about . The expected number of candidates is about 10.4, so roughly ten.
Sources
- Dirichlet's theorem on arithmetic progressions, Wikipedia. https://en.wikipedia.org/wiki/Dirichlet%27s_theorem_on_arithmetic_progressions
- Dirichlet character, Wikipedia. https://en.wikipedia.org/wiki/Dirichlet_character
- Prime number theorem, Wikipedia. https://en.wikipedia.org/wiki/Prime_number_theorem