FLINT3.7.0-dev
Algorithm

Frobenius map, norm, trace and roots

Cost
Frobenius σe\sigma^e: O(elog⁡p)O(e \log p) multiplications in Fq\mathbb{F}_q; trace: O(dt)O(dt) operations in Fp\mathbb{F}_p once per element (tt terms in ff); norm: one resultant of degree-dd polynomials; square root: O(log⁡q+s2)O(\log q + s^2) multiplications with 2s∥q−12^s \parallel q - 1.

The Galois group of Fq/Fp\mathbb{F}_q/\mathbb{F}_p, q=pdq = p^d, is cyclic of order dd, generated by the Frobenius automorphism σ(a)=ap\sigma(a) = a^p [LN1997]. The trace and the norm are

Tr⁡(a)=∑i=0d−1σi(a),N(a)=∏i=0d−1σi(a),\operatorname{Tr}(a) = \sum_{i=0}^{d-1} \sigma^i(a), \qquad N(a) = \prod_{i=0}^{d-1} \sigma^i(a),

which lie in Fp\mathbb{F}_p; equivalently they are the trace and the determinant of the Fp\mathbb{F}_p-linear map x↦axx \mapsto ax on Fq\mathbb{F}_q. This section describes how the polynomial representations fq and fq_nmod compute them, with Fq=Fp[x]/(f)\mathbb{F}_q = \mathbb{F}_p[x]/(f) for an irreducible ff of degree dd with roots α1,…,αd\alpha_1, \ldots, \alpha_d (the conjugates of the generator); for the Zech representation see Zech logarithms.

The Frobenius map#

fq_frobenius computes σe(a)=ape\sigma^e(a) = a^{p^e}, for ee reduced to [0,d)[0, d), by binary exponentiation with exponent pep^e (_fq_pow), which costs about elog⁡2pe \log_2 p squarings and fewer multiplications. For a∈Fpa \in \mathbb{F}_p (a constant representative) the result is aa.

The Frobenius map is Fp\mathbb{F}_p-linear, so a matrix of σe\sigma^e would make each application cost O(d2)O(d^2) operations in Fp\mathbb{F}_p after an O(d3)O(d^3) precomputation, and σe(a)=a(ξ) mod f\sigma^e(a) = a(\xi) \bmod f with ξ=xpe mod f\xi = x^{p^e} \bmod f, so it can also be computed by modular composition (Composition and modular composition) [GatSho1992]; FLINT uses these techniques for polynomials over Fq\mathbb{F}_q (the iterated Frobenius xqi mod vx^{q^i} \bmod v of fq_poly_iterated_frobenius_preinv) but not for single elements. The pp-th root, the inverse of σ\sigma, is computed as σd−1(a)=apd−1\sigma^{d-1}(a) = a^{p^{d-1}} by d−1d - 1 successive pp-th powers (fq_pth_root). The lift of the Frobenius map to the unramified pp-adic extension Qq\mathbf{Q}_q is described in Frobenius automorphism and Teichmüller lifts in unramified extensions.

The trace#

Since the trace is Fp\mathbb{F}_p-linear, Tr⁡(∑iaixi)=∑iaiTr⁡(xi)\operatorname{Tr}(\sum_i a_i x^i) = \sum_i a_i \operatorname{Tr}(x^i), and the traces of the basis elements are the power sums si=Tr⁡(xi)=∑jαjis_i = \operatorname{Tr}(x^i) = \sum_j \alpha_j^i of the roots of ff.

Lemma 1 (Newton's identities). Let f=xd+cd−1xd−1+⋯+c0f = x^d + c_{d-1} x^{d-1} + \cdots + c_0 be monic with roots α1,…,αd\alpha_1, \ldots, \alpha_d and si=∑jαjis_i = \sum_j \alpha_j^i. Then s0=ds_0 = d and, for 1≤i≤d1 \le i \le d,

si=−(i cd−i+∑k=1i−1cd−k si−k).s_i = -\Bigl(i\, c_{d-i} + \sum_{k=1}^{i-1} c_{d-k}\, s_{i-k}\Bigr).

Proof. From f(X)=∏j(X−αj)f(X) = \prod_j (X - \alpha_j) we get f′(X)/f(X)=∑j1/(X−αj)=∑i≥0siX−i−1f'(X)/f(X) = \sum_j 1/(X - \alpha_j) = \sum_{i \ge 0} s_i X^{-i-1} as a series in 1/X1/X. Multiplying by ff gives f′(X)=f(X)∑i≥0siX−i−1f'(X) = f(X) \sum_{i \ge 0} s_i X^{-i-1}; comparing the coefficients of Xd−1−iX^{d-1-i} for 1≤i≤d1 \le i \le d gives (d−i)cd−i=∑k=0icd−ksi−k(d - i) c_{d-i} = \sum_{k=0}^{i} c_{d-k} s_{i-k} with cd=1c_d = 1, that is si+∑k=1i−1cd−ksi−k+d cd−i=(d−i)cd−is_i + \sum_{k=1}^{i-1} c_{d-k} s_{i-k} + d\,c_{d-i} = (d - i) c_{d-i}, which is the claim.

_fq_trace computes s0,…,sd−1s_0, \ldots, s_{d-1} by the recurrence of Lemma 1, using only the nonzero coefficients of the monic version of ff, so the cost is O(dt)O(dt) operations for a polynomial with tt nonzero terms, and then the dot product ∑aisi\sum a_i s_i. The same power sums appear in fq_embed_mono_to_dual_matrix, which computes Tr⁡(xi+j)\operatorname{Tr}(x^{i+j}) for all i+j<2d−1i + j < 2d - 1 from the series expansion of rev⁡(f′)/rev⁡(f)\operatorname{rev}(f')/\operatorname{rev}(f), the reversed form of the series in the proof.

The norm#

Proposition 2. For a∈Fp[x]a \in \mathbb{F}_p[x] with deg⁡a=m\deg a = m and the defining polynomial ff with leading coefficient cc, N(a mod f)=Res⁡(f,a)/cmN(a \bmod f) = \operatorname{Res}(f, a) / c^m.

Proof. The conjugates of a(x)a(x) are a(αj)a(\alpha_j), so N(a)=∏ja(αj)N(a) = \prod_j a(\alpha_j), and by the product formula for the resultant Res⁡(f,a)=cm∏f(α)=0a(α)\operatorname{Res}(f, a) = c^{m} \prod_{f(\alpha) = 0} a(\alpha) [GG2003] [LN1997].

_fq_norm computes the resultant with _fmpz_mod_poly_resultant (_nmod_poly_resultant for fq_nmod), which uses the Euclidean or half-GCD algorithm (Half-GCD), and divides by cmc^m when ff is not monic. For a∈Fpa \in \mathbb{F}_p it returns ada^d.

Square roots and squares#

The group Fq×\mathbb{F}_q^\times is cyclic of order q−1q - 1, so for odd pp exactly half of its elements are squares, and a≠0a \ne 0 is a square if and only if a(q−1)/2=1a^{(q-1)/2} = 1 (Euler's criterion; fq_is_square). In characteristic 2 every element is a square, with the unique square root σ−1(a)\sigma^{-1}(a).

Algorithm 1: Tonelli–Shanks

Input: a square a≠0,1a \ne 0, 1 in Fq\mathbb{F}_q, qq odd, and a non-square zz. Write q−1=2stq - 1 = 2^s t with tt odd.

Output: bb with b2=ab^2 = a.

  1. c←ztc \gets z^t, u←atu \gets a^t, b←a(t+1)/2b \gets a^{(t+1)/2}, M←sM \gets s.
  2. While u≠1u \ne 1: find the least ii with u2i=1u^{2^i} = 1 (if i=Mi = M, aa is not a square); set w←c2M−i−1w \gets c^{2^{M-i-1}}, M←iM \gets i, c←w2c \gets w^2, u←ucu \gets u c, b←bwb \gets b w.
  3. Return bb.

The invariant is b2=aub^2 = a u, with uu in the subgroup of order 2M2^M and cc a generator of the subgroup of order 2M2^M; each iteration decreases the order of uu, so there are at most ss iterations of at most ss squarings each [Ton1891] [Sha1973]. fq_sqrt takes as zz the generator of the field if the context was created from a Conway polynomial, which is primitive and hence not a square, and otherwise draws random elements until it finds a non-square (half of all elements qualify). The cost is O(log⁡q)O(\log q) multiplications for the three powers and O(s2)O(s^2) for the loop. fq_poly_sqrt computes square roots of polynomials with a power series square root and fq_sqrt for the lowest nonzero coefficient.

Multiplicative order#

The order of a≠0a \ne 0 divides q−1q - 1. fq_multiplicative_order factors q−1=∏ℓieiq - 1 = \prod \ell_i^{e_i} with fmpz_factor, and for each prime ℓi\ell_i divides the candidate order by ℓi\ell_i as long as aa raised to the result is still 1; this needs O(∑iei)O(\sum_i e_i) exponentiations. For large qq the factorisation of q−1q - 1 dominates. An element is primitive if and only if its order is q−1q - 1 (fq_is_primitive), and a defining polynomial is primitive if and only if its root fq_gen is.

Use in FLINT#

Referenced from#

References#

  • [LN1997] R. Lidl and H. Niederreiter. Finite Fields. Second edition, Encyclopedia of Mathematics and its Applications 20, Cambridge University Press, 1997.
  • [GatSho1992] J. von zur Gathen and V. Shoup, "Computing Frobenius maps and factoring polynomials", Computational Complexity 2 (1992), 187-224. https://doi.org/10.1007/BF01272074
  • [GG2003] J. von zur Gathen and J. Gerhard, Modern Computer Algebra, second edition, Cambridge University Press (2003)
  • [Ton1891] A. Tonelli, "Bemerkung über die Auflösung quadratischer Congruenzen", Nachrichten von der Königlichen Gesellschaft der Wissenschaften und der Georg-Augusts-Universität zu Göttingen (1891), 344–346
  • [Sha1973] D. Shanks, "Five number-theoretic algorithms", Proceedings of the Second Manitoba Conference on Numerical Mathematics, Congressus Numerantium 7 (1973), 51–70
Cite this page

The FLINT team, “Frobenius map, norm, trace and roots,” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/algorithms/finite-fields/frobenius-norm-trace.html (generated 2026-11-02).