How this calculation works
Evaluate prime-field Gauss and Jacobi character sums with exact cyclotomic coefficients and complex numerical values.
G(χ)=Σ_(x≠0)χ(x)e^(2πix/p); J(χ,ψ)=Σ_x χ(x)ψ(1−x), with all characters zero at 0.A worked example
At p=5, primitive root 2 and both exponents 1, J=−1−2i and the first Gauss sum has squared magnitude 5.
Good to know
Odd primes 3–31, verified primitive root, exponents 0…p−2. Exact BigInt coefficients reduced modulo Φ_(p(p−1)); numeric values use the positive additive-character sign. Trivial characters also take value zero at zero.
Reference: SageMath Dirichlet characters: gauss_sum and jacobi_sum (opens in a new tab) ↗
Character sums combine two kinds of periodicity
A multiplicative character describes powers of a primitive root in the nonzero residue classes of a prime field. An additive character describes residues through complex p-th roots of unity. A Gauss sum multiplies these two periodic structures and adds across the field, while a Jacobi sum combines two multiplicative characters at x and 1−x.
These sums are complex algebraic numbers, not the Jacobi symbol or a yes-or-no quadratic-residuosity test. Even when a quadratic character happens to be involved, the entire sum contains phase information and interactions among many residues. The input therefore includes a prime, a primitive root and character exponents rather than one integer pair.
Compare this with the Jacobi symbol calculator with reciprocity steps. Sum complex roots of unity weighted by multiplicative characters over a prime field. The Jacobi symbol returns a single quadratic-residuosity symbol and is not a Jacobi sum.
Specify the character convention
For a chosen primitive root g, exponent a defines χ_a(g^j)=exp(2πiaj/(p−1)). Exponent zero is the trivial multiplicative character on nonzero residues. This page extends every character by zero at the residue 0, including that trivial character, so terms involving zero follow one explicit convention.
The additive factor in the Gauss sum is exp(+2πix/p). Changing its sign can conjugate or otherwise transform values, and changing the primitive root changes how an exponent names a particular character. When comparing outputs, first align those conventions instead of treating a phase or sign difference as a numerical error.
Verify the supplied primitive root
The program lists successive powers of g modulo p and checks that they visit every nonzero residue exactly once before returning to one. That produces a discrete logarithm table for the tiny supported field. A number that generates only a proper subgroup is rejected rather than used to assign incomplete character values.
Primality is also checked within the small bound. Composite moduli have units and zero divisors with a different character theory and are not accepted as approximate replacements. The prime cap is deliberately smaller than a general number-theory library because this interface displays complete canonical exact expressions, not only rounded complex answers.
Use a common cyclotomic basis
Both the p-th additive roots and the (p−1)-th multiplicative roots are powers of a primitive root of unity of order N=p(p−1). Each sum is first an integer polynomial in that root. Reducing the polynomial modulo the cyclotomic polynomial Φ_N gives a canonical basis expansion of degree below φ(N).
Coefficients are stored as BigInt integers, so exact algebraic cancellation is preserved. The output lists only nonzero powers with their coefficients and separately supplies a complex numerical value. A sparse term list is a representation in the stated root-of-unity basis; it is not an assertion that the algebraic number has that many distinct geometric frequencies.
Read the example modulo five
For p=5 and primitive root 2, exponent one is a fourth-order character. Using that character twice gives the default Jacobi sum −1−2i. The first Gauss sum is approximately −1.1755705+1.9021130i, whose squared magnitude is five within numerical rounding.
The exact term expansion and the rounded complex pair describe the same algebraic sum. For a nontrivial multiplicative character, the identity |G(χ)|²=p is a useful independent check. The trivial character has Gauss sum −1 under this convention, so applying the nontrivial-character magnitude identity to exponent zero would be incorrect.
Check the Gauss–Jacobi product identity
When χ, ψ and χψ are all nontrivial, the relation G(χ)G(ψ)=J(χ,ψ)G(χψ) connects the two kinds of sum. The calculator evaluates both sides as a numerical consistency diagnostic whenever those assumptions hold, while the underlying displayed exact expressions remain available for algebraic inspection.
Exceptional cases with a trivial factor or trivial product require their own formulas. The program does not blindly divide by a Gauss sum and apply the generic identity outside its assumptions. This separation prevents an apparently convenient shortcut from silently changing the endpoint terms contributed by the zero-extension convention.
Interpret exact and floating outputs separately
The reduced cyclotomic coefficients are exact within the entered prime-field model. The decimal real and imaginary parts are ordinary finite-precision evaluations, so tiny values near zero should not replace the exact representation when proving an identity. Use the coefficients and the stated cyclotomic polynomial for exact comparisons.
This page does not support extension fields, composite moduli or arbitrary analytic continuation of characters. Its size limit keeps primitive-root verification, polynomial reduction and complete output manageable in a browser. All supported exponent choices belong on this one page; separate pages for quadratic or quartic parameter settings would repeat the same character-sum operation.
A few questions, answered
Is a Jacobi sum the Jacobi symbol?
No. A Jacobi sum adds products of complex multiplicative characters; the Jacobi symbol is a different arithmetic function.
Why must the root be primitive?
Its powers must label every nonzero residue so the supplied exponent defines a character on the whole multiplicative group.
What is the value of a trivial character at zero?
On this page it is zero, just like the nontrivial characters; the convention is explicit in the output.
Which outputs are exact?
The cyclotomic coefficient lists are exact integers. The displayed real and imaginary parts are rounded numerical evaluations.