Skip to content

quadratic twist ​

Also known as: Legendre symbol.

Multiplying a Dirichlet character χ modulo N by the Legendre symbol (·/d) of an odd prime d coprime to N, yielding a non-principal character modulo N·d whose L-function family admits zero-density control.

Diagram illustrating quadratic twist
Diagram illustrating quadratic twist.

Level 1 — First-Principles ​

Fix an odd integer greater than 1 divisible only by 1 and itselfprime number d. The Legendre symbol (n/d) answers a basic modular-arithmetic question about any integer n: is n a perfect square modulo d?

(nd)={0if d divides n,+1if d∤n and n≡a2(modd) for some integer a,−1otherwise.

For d=7, the nonzero squares modulo 7 are 12≡1, 22≡4, and 32≡2, so (1/7)=(2/7)=(4/7)=+1 while (3/7)=(5/7)=(6/7)=−1.

Now take a periodic multiplicative weight χ(n) modulo NDirichlet character and an odd prime d coprime to N. Multiplying the two weights gives a new periodic multiplicative weight χd(n)=χ(n)(n/d) of period Nd. This product is the quadratic twist of χ by d, and its associated weighted sum and continuation L(χd,s)Dirichlet L-function is the twisted L-function.

Stage 01 relies on quadratic twists to keep its prime-power remainder nonnegative while avoiding accidental pole cancellations. On n≡1(modq0), the proof weights each integer by λ(n)=Λ(n)(1−(n/d)), combining the logarithmic prime-power weight Λ(n)von Mangoldt function with 1−(n/d)∈{0,1,2}. Expanding 1−(n/d) splits the transform of the remainder into a positive term from the untwisted Dirichlet L-functions modulo q0 and a negative term from their quadratic twists by d. Because d can vary freely over all primes in a chosen residue class modulo q0, a zero-density estimate guarantees that at least one prime d in that class has no twisted zeros anywhere inside a prescribed box to the right of Re(s)=1/2. Fixing such a prime d clears out the negative poles in that box, leaving only untwisted poles that the sign-based pole-exclusion theoremLandau's lemma then forces to vanish.

Limits of the intuition ​

Treating the quadratic twist as a single static filter misses two essential requirements. First, for a poorly chosen prime d, a twisted zero could sit directly on top of a zero ρ of L(ψ,s) and cancel its pole in the difference of logarithmic derivatives; the reduction succeeds only because the Stage 01 upper bound holds for every prime d≡d0(modq0), allowing the proof to pick a good prime d after ρ is given. Second, the congruence condition d≡7(mod8) (strengthened in the one-sided bound to d≡q0/2−1(modq0) with 18480∣q0) is structurally necessary: it pins down the quadratic-reciprocity sign of (⋅/d) and ensures that −d is the discriminant of an imaginary quadratic field in which 2 splits, feeding directly into both the zero-density proof and the downstream geometric stage.

Level 2 — Undergrad Bridge ​

For a Dirichlet character χmodN and an odd prime d with gcd(N,d)=1, the quadratic twist χd=χ⋅(⋅/d) is a Dirichlet character modulo Nd. It is never principal (quadTwist_ne_one): choosing a quadratic non-residue amodd and solving n≡1(modN), n≡a(modd) via the Chinese Remainder Theorem yields χd(n)=−1. Consequently L(χd,s) is entire on C, with no pole at s=1.

In the Stage 01 error term primeRemainder, the factor 1−(n/d) couples the untwisted and twisted logarithmic derivatives: for Re(s)>1,

∑n=1n≡1(modq)∞Λ(n)(1−(n/d))ns=1φ(q)∑ψmodq(−L′(ψ,s)L(ψ,s)+L′(ψ⋅(⋅/d),s)L(ψ⋅(⋅/d),s)).

Accordingly, the Laplace transform of v↦Rq(ev) has at most simple poles in Re(s)>0, none at s=1, and residue

r(s)=n(s)−n′(s)φ(q)s(1−s),

where n(s)=∑ψmodqords(entireL(ψ)) and n′(s)=∑ψmodqords(entireL(ψ⋅(⋅/d))).

To make n′(s)=0 on a box Re(s)≥β=1/2+9δ, |Im(s)|≤H, upstream Lib.Analytic.QuadraticTwist proves a zero-density estimate in the spirit of Jutila (1975) and Heath-Brown (1995), replacing the full real-character large sieve by a smoothed theta-series mean square bounded via the Pólya–Vinogradov inequality:

  1. For a primitive character χ≠1 of conductor q≤T2, a zero in the box forces the theta-series tail integral J(χ,T)=∫1/T∞(|θχ(u)|+|θμχ(u)|)du/u to exceed T2δ, via a truncated mollifier and Hadamard's three-lines theorem.
  2. When d≡7(mod8), quadratic reciprocity rewrites (n/d)=(−d/n∘) in terms of the odd part n∘ of n; averaging the squared theta series over v≤T2 bounds ∑J by O(T2+δ), showing that at most O(X1−δ/2) primes d≤X in the class are "bad" (possess a twisted zero in the box).
  3. Since ∑p≡a(modN)(log⁡p)/p diverges by Dirichlet's theorem, not all primes of the invertible class can be bad, yielding a prime d with n′(s)=0 throughout the box.

Level 3 — Formal Lean Contract ​

In Mathlib4 (Mathlib.NumberTheory.LegendreSymbol.Basic), legendreSym d n : ℤ implements (n/d) for [Fact d.Prime] via quadraticChar (ZMod d), and quadraticChar_isQuadratic certifies that legendreSym d n ∈ {0, 1, -1}.

Upstream formalizes the quadratic twist and its zero-density selection across three modules:

  • src/Lib/Analytic/EntireLFunction.lean: New.quadTwist_apply : quadTwist χ d n = χ n * legendreSym d n and New.quadTwist_ne_one (for d ≠ 2 and N.Coprime d).
  • src/Lib/Analytic/QuadraticTwist.lean: New.zero_density_quadTwist (the O(X1−δ/2) bound on IsBadPrime) and New.exists_entireL_quadTwist_ne_zero, which produces d : Primes in the residue class with entireL (quadTwist ξ d) s ≠ 0 on β ≤ s.re, |s.im| ≤ H.
  • src/New/Reduction/Zeros/PrimeError.lean: New.one_sub_chiK_mem_Icc (1 - (chiK d n : ℝ) ∈ Set.Icc 0 2) and New.isPolar_primeRemainder.

Stage 01 anchors the twist in both top-level reduction theorems:

  • 01_reduction/criterion.lean#New.LFunction_ne_zero_of_primeRemainder_le (upstream src/New/Reduction/Zeros/Criterion.lean:35-90):
    lean
    theorem New.LFunction_ne_zero_of_primeRemainder_le {q₀ : ℕ} [NeZero q₀] (hq₀ : 8 ∣ q₀) {d₀ : ℕ}
        (hd₀_mod : d₀ % 8 = 7) (hd₀_cop : d₀.Coprime q₀) {β : ℝ} (hβ : 1 / 2 < β)
        (h_bound : ∀ d : Primes, (d : ℕ) ≡ d₀ [MOD q₀] →
          ∃ A : ℝ, ∀ᶠ x : ℝ in atTop, primeRemainder d q₀ x ≤ A * x ^ (β - 1))
        (ψ : DirichletCharacter ℂ q₀) {ρ : ℂ} (hρ_ne : ρ ≠ 1) (hρ_re : β < ρ.re) :
        ψ.LFunction ρ ≠ 0
  • 01_reduction/one_sided_bound.lean#New.eventually_primeRemainder_le_mul_rpow (upstream src/New/Reduction/OneSidedBound.lean:201-235):
    lean
    theorem New.eventually_primeRemainder_le_mul_rpow {q₀ : ℕ} [NeZero q₀] (hq₀ : 18480 ∣ q₀) {d : ℕ}
        [hd_prime : Fact d.Prime] (hd : d ≡ q₀ / 2 - 1 [MOD q₀]) {ε : ℝ} (hε : 0 < ε) :
        ∀ᶠ y : ℝ in atTop, primeRemainder d q₀ y ≤ (128 * q₀.totient + 32) * y ^ (-1 / 2 + ε)

See the page's live verification banner (audit/verification-status.json) for the currently pinned upstream snapshot and local Lean build status (build_status: unverified-locally).

Where this analogy breaks ​

A quadratic twist χ⋅(⋅/d) does not remove zeros of L(χ,s) directly: it introduces a second family of poles with opposite sign into the remainder's transform, so Stage 01 works only because a zero-density estimate selects a prime d in the required congruence class whose twisted L-functions have no zeros in the target box.

Formal Lean Anchors ​

theorem New.LFunction_ne_zero_of_primeRemainder_le — Upstream source (src/New/Reduction/Zeros/Criterion.lean L35-L90)

lean
/-- **One-sided criterion.** Let `q₀` be a positive multiple of `8`, let `d₀ ≡ 7` mod `8` be prime
to `q₀`, and let `β > 1/2`. Suppose that for each prime `d ≡ d₀` mod `q₀` the remainder
`primeRemainder d q₀ x = ∑_{n ≤ x} λ(n) (1/n - 1/x) - log x / φ(q₀) - c` is at most `A * x ^ (β - 1)`
for some `A` and all large `x`. Here `λ(n) = Λ(n) (1 - (n/d))` for `n ≡ 1` mod `q₀` and `0` otherwise,
and `c` is the constant for which the remainder tends to `0`. Then `L(ρ, ψ) ≠ 0` for every
character `ψ` modulo `q₀` and every `ρ ≠ 1` with `re ρ > β`. -/
theorem New.LFunction_ne_zero_of_primeRemainder_le {q₀ : ℕ} [NeZero q₀] (hq₀ : 8 ∣ q₀) {d₀ : ℕ}
    (hd₀_mod : d₀ % 8 = 7) (hd₀_cop : d₀.Coprime q₀) {β : ℝ} (hβ : 1 / 2 < β)
    (h_bound : ∀ d : Primes, (d : ℕ) ≡ d₀ [MOD q₀] →
      ∃ A : ℝ, ∀ᶠ x : ℝ in atTop, primeRemainder d q₀ x ≤ A * x ^ (β - 1))
    (ψ : DirichletCharacter ℂ q₀) {ρ : ℂ} (hρ_ne : ρ ≠ 1) (hρ_re : β < ρ.re) :
    ψ.LFunction ρ ≠ 0 := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Reduction/Zeros/Criterion.lean:35-90 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=45 body_sha256=dee53546115f07956df438a6dd34a213cb6cb1775d14fde132a1c579e7a308de]

theorem New.eventually_primeRemainder_le_mul_rpow — Upstream source (src/New/Reduction/OneSidedBound.lean L201-L235)

lean
/-- **One-sided bound.** Let `q₀ > 0` be a multiple of `18480`, let `d ≡ q₀ / 2 - 1` modulo `q₀` be
a prime, and let `ε > 0`. Then `R = primeRemainder d q₀` satisfies
`R(y) ≤ (128 φ(q₀) + 32) y ^ (-1/2 + ε)` for all large real `y`. -/
theorem New.eventually_primeRemainder_le_mul_rpow {q₀ : ℕ} [NeZero q₀] (hq₀ : 18480 ∣ q₀) {d : ℕ}
    [hd_prime : Fact d.Prime] (hd : d ≡ q₀ / 2 - 1 [MOD q₀]) {ε : ℝ} (hε : 0 < ε) :
    ∀ᶠ y : ℝ in atTop, primeRemainder d q₀ y ≤ (128 * q₀.totient + 32) * y ^ (-1 / 2 + ε) := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Reduction/OneSidedBound.lean:201-235 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=30 body_sha256=3c83f57c4fd982274a17d7539635c9b9dde4053c2c86ead0a79ed97a76a8f4d8]
  • prime number — A whole number greater than 1 whose only positive whole-number divisors are 1 and itself; every integer above 1 factors uniquely into a product of them.
  • Dirichlet character — A periodic multiplicative label χ : ℤ → ℂ modulo N that equals 0 when gcd(n, N) > 1, takes roots of unity when gcd(n, N) = 1, and satisfies χ(ab) = χ(a)χ(b).
  • Dirichlet L-function — The meromorphic continuation of ∑ χ(n) n⁻ˢ associated to a Dirichlet character χ, generalizing ζ(s) to track primes across residue classes modulo N.
  • von Mangoldt function — The arithmetic weight Λ(n) equal to log p when n is a prime power pᵏ (k ≥ 1) and 0 otherwise, converting multiplicative prime factorizations into additive logarithms.
  • Landau's lemma — A complex-analytic theorem stating that the Laplace or Dirichlet transform of a nonnegative function must have a singularity on the real axis at its abscissa of convergence, turning one-sided error bounds into zero-free half-planes.

Referenced By ​

Authoritative Sources ​

  • Multiplicative Number Theory (book) — H. Davenport, 3rd ed., Springer Graduate Texts in Mathematics 74 (2000), Chapters 5 and 9.
  • On mean values of Dirichlet polynomials with real characters (paper) — M. Jutila, Acta Arithmetica 27 (1975), pp. 191–198.
  • A mean value estimate for real character sums (paper) — D. R. Heath-Brown, Acta Arithmetica 72 (1995), pp. 235–275.
  • Mathlib4: legendreSym (mathlib) — Mathlib.NumberTheory.LegendreSymbol.Basic (legendreSym, quadraticChar_isQuadratic).

Page Glossary ​

prime number
A whole number greater than 1 whose only positive whole-number divisors are 1 and itself; every integer above 1 factors uniquely into a product of them.
Dirichlet character
A periodic multiplicative label χ : ℤ → ℂ modulo N that equals 0 when gcd(n, N) > 1, takes roots of unity when gcd(n, N) = 1, and satisfies χ(ab) = χ(a)χ(b).
Dirichlet L-function
The meromorphic continuation of ∑ χ(n) n⁻ˢ associated to a Dirichlet character χ, generalizing ζ(s) to track primes across residue classes modulo N.
von Mangoldt function
The arithmetic weight Λ(n) equal to log p when n is a prime power pᵏ (k ≥ 1) and 0 otherwise, converting multiplicative prime factorizations into additive logarithms.
Landau's lemma
A complex-analytic theorem stating that the Laplace or Dirichlet transform of a nonnegative function must have a singularity on the real axis at its abscissa of convergence, turning one-sided error bounds into zero-free half-planes.