Sharp bound for a quadratic character sum over two linear forms
ProvedCharacterSums.legendre_sum_two_forms_bound_oneThe sharp constant for a quadratic character sum over two independent linear forms.
Let be an odd prime, the Legendre symbol, and let , be linear forms with non-vanishing determinant . Then
This is the sharp form of the bound: the constant cannot be improved, because the sum is in fact equal to whenever , hence of modulus exactly in that case. The trivial bound is , so this is complete cancellation with the optimal constant.
The weaker bound with constant follows immediately and is what one usually records when the degenerate cases ( or ) are handled crudely; the sharp statement requires treating those cases exactly rather than by a triangle-inequality estimate.
For two linear forms this is the exact analogue of the Weil bound : with a product of two distinct linear factors, and the bound reads — but here the elementary evaluation gives the far stronger constant , independent of , because the quadratic character of a product of two linear forms can be evaluated in closed form.
Formalization note. quadraticChar (ZMod p) is Mathlib's quadratic character, valued in
, so the sum and absolute value are integers and the bound is an inequality
in .
import Mathlib
namespace CharacterSums
theorem legendre_sum_two_forms_bound_one {p : ℕ} [Fact p.Prime] (hp : p ≠ 2)
{a b c d : ZMod p} (h : a * d - b * c ≠ 0) :
|∑ t : ZMod p, quadraticChar (ZMod p) (a * t + b) * quadraticChar (ZMod p) (c * t + d)|
≤ 1 := by sorry
end CharacterSums