FLINT3.7.0-dev
Algorithm

Embeddings of finite fields

Cost
One root finding of a degree-mm polynomial over Fpn\mathbb{F}_{p^n}, plus O(n3)O(n^3) operations in Fp\mathbb{F}_p for the matrices.

Let k=Fp[y]/(fm)k = \mathbb{F}_p[y]/(f_m) and K=Fp[x]/(fn)K = \mathbb{F}_p[x]/(f_n) be fields of degrees m∣nm \mid n. Then KK has a unique subfield of order pmp^m, isomorphic to kk, but an isomorphism has to be computed: it is determined by the image of the generator yy, which must be a root of fmf_m in KK, and there are mm such roots, giving the mm embeddings k→Kk \to K, which differ by powers of the Frobenius map. Lenstra showed that isomorphisms of finite fields can be found in deterministic polynomial time [Len1991]; practical algorithms either find a root of fmf_m in KK, as FLINT does, or use Kummer theory and Gauss periods to construct compatible generators without factoring [All2002] [DFRR2019]. Systems such as Magma maintain a lattice of compatible embeddings between all fields created [BCS1997b]; FLINT computes embeddings on demand and leaves compatibility to the user (Conway polynomials, Defining polynomials, provide compatible generators by construction, but fq_embed does not use this).

Finding the embedding#

fq_embed_gens returns the generator yy of kk, its minimal polynomial fmf_m, and a root β\beta of fmf_m in KK. The root is found by fq_poly_factor_split_single, that is, by the root finding of gr_poly_roots_finite_field applied to fmf_m viewed as a polynomial over KK (Roots of polynomials over finite fields), which splits fmf_m (a product of mm distinct linear factors over KK) by random equal-degree splitting; its cost is dominated by modular exponentiations of polynomials of degree less than mm over KK to exponents of size about pnp^n. The embedding is φ(∑ciyi)=∑ciβi\varphi(\sum c_i y^i) = \sum c_i \beta^i.

The embedding matrix#

With respect to the bases 1,y,…,ym−11, y, \ldots, y^{m-1} of kk and 1,x,…,xn−11, x, \ldots, x^{n-1} of KK, φ\varphi is the n×mn \times m matrix whose columns are the coordinates of β0,…,βm−1\beta^0, \ldots, \beta^{m-1}, the first mm columns of the composition matrix of β\beta (fq_embed_composition_matrix_sub). More generally, fq_embed_matrices accepts any generator γ\gamma of kk with minimal polynomial gg and a root γ′\gamma' of gg in KK; it then composes the matrix of Fp[z]/(g)→K\mathbb{F}_p[z]/(g) \to K, z↦γ′z \mapsto \gamma', with the inverse of the matrix of Fp[z]/(g)→k\mathbb{F}_p[z]/(g) \to k, z↦γz \mapsto \gamma.

Projecting back with the trace#

A map in the other direction, π:K→k\pi: K \to k with π∘φ=id\pi \circ \varphi = \mathrm{id}, is needed to test whether an element of KK lies in the image and to compute its preimage. FLINT obtains it from the relative trace Tr⁡K/k′\operatorname{Tr}_{K/k'}, where k′=φ(k)k' = \varphi(k), which is k′k'-linear and surjective.

Lemma 1. Let L=Fp[x]/(f)L = \mathbb{F}_p[x]/(f) with deg⁡f=d\deg f = d, and let TT be the d×dd \times d matrix with entries Tij=Tr⁡(xi+j)T_{ij} = \operatorname{Tr}(x^{i+j}). Then TT is invertible, and for u∈Lu \in L with coordinate vector u\mathbf{u}, Tu=(Tr⁡(uxi))i<dT\mathbf{u} = (\operatorname{Tr}(u x^i))_{i < d}. Moreover, if f(X)/(X−x)=∑j<dbjXjf(X)/(X - x) = \sum_{j < d} b_j X^j in L[X]L[X], then the basis dual to 1,x,…,xd−11, x, \ldots, x^{d-1} for the trace form is b0/f′(x),…,bd−1/f′(x)b_0/f'(x), \ldots, b_{d-1}/f'(x).

Proof. The trace form (u,v)↦Tr⁡(uv)(u, v) \mapsto \operatorname{Tr}(uv) is nondegenerate because L/FpL/\mathbb{F}_p is separable, so its Gram matrix TT in the monomial basis is invertible, and (Tu)i=∑jTr⁡(xi+j)uj=Tr⁡(xiu)(T\mathbf{u})_i = \sum_j \operatorname{Tr}(x^{i+j}) u_j = \operatorname{Tr}(x^i u). The second statement is Euler's formula for the dual basis [LN1997] (a consequence of Lagrange interpolation at the conjugates of xx).

The matrix TT is fq_embed_mono_to_dual_matrix, computed from the power sums Tr⁡(xi)\operatorname{Tr}(x^i) of Frobenius map, norm, trace and roots; its inverse, fq_embed_dual_to_mono_matrix, is the product of the multiplication matrix of 1/f′(x)1/f'(x) (fq_embed_mul_matrix) and the Hankel matrix of the coefficients of ff, by the second part of the lemma.

Proposition 2. Let BB be the n×mn \times m matrix of an embedding φ:k→K\varphi: k \to K, TKT_K the matrix of the trace form of KK and DkD_k the inverse of that of kk. Then DkBTTKD_k B^T T_K is the matrix of φ−1∘Tr⁡K/k′\varphi^{-1} \circ \operatorname{Tr}_{K/k'}.

Proof. For u∈Ku \in K, TKu=(Tr⁡K/Fp(uxi))iT_K \mathbf{u} = (\operatorname{Tr}_{K/\mathbb{F}_p}(u x^i))_i, so BTTKu=(Tr⁡K/Fp(uφ(yj)))j<mB^T T_K \mathbf{u} = (\operatorname{Tr}_{K/\mathbb{F}_p}(u \varphi(y^j)))_{j < m}, because column jj of BB is the coordinate vector of φ(yj)\varphi(y^j). By transitivity of the trace and k′k'-linearity of Tr⁡K/k′\operatorname{Tr}_{K/k'}, Tr⁡K/Fp(uφ(yj))=Tr⁡k′/Fp(φ(yj)Tr⁡K/k′(u))=Tr⁡k/Fp(yjw)\operatorname{Tr}_{K/\mathbb{F}_p}(u \varphi(y^j)) = \operatorname{Tr}_{k'/\mathbb{F}_p}(\varphi(y^j) \operatorname{Tr}_{K/k'}(u)) = \operatorname{Tr}_{k/\mathbb{F}_p}(y^j w) with w=φ−1(Tr⁡K/k′(u))w = \varphi^{-1}(\operatorname{Tr}_{K/k'}(u)). These are the dual coordinates of ww in kk, and DkD_k converts them to monomial coordinates by Lemma 1.

This is fq_embed_trace_matrix. Since Tr⁡K/k′\operatorname{Tr}_{K/k'} is the multiplication by n/mn/m on k′k', the projection is π(u)=φ−1(Tr⁡K/k′(θu))\pi(u) = \varphi^{-1}(\operatorname{Tr}_{K/k'}(\theta u)) for any θ∈K\theta \in K with Tr⁡K/k′(θ)=1\operatorname{Tr}_{K/k'}(\theta) = 1: θ=(n/m)−1\theta = (n/m)^{-1} if p∤n/mp \nmid n/m, and otherwise θ=xi/Tr⁡K/k′(xi)\theta = x^i / \operatorname{Tr}_{K/k'}(x^i) for a power of the generator with nonzero relative trace, which fq_embed_matrices finds by looking for a nonzero entry in the first row of the trace matrix. Then π(φ(c))=φ−1(φ(c)Tr⁡K/k′(θ))=c\pi(\varphi(c)) = \varphi^{-1}(\varphi(c) \operatorname{Tr}_{K/k'}(\theta)) = c. Using duality in this way, rather than solving a linear system for each element, follows Shoup's approach to computations with linear forms in extensions of finite fields [Sho1994] [Sho1999].

Use in FLINT#

Referenced from#

References#

  • [Len1991] H. W. Lenstra, Jr. Finding isomorphisms between finite fields. Mathematics of Computation 56 (1991), 329–347.
  • [All2002] B. Allombert. Explicit computation of isomorphisms between finite fields. Finite Fields and Their Applications 8:3 (2002), 332–342.
  • [DFRR2019] L. De Feo, H. Randriam and É. Rousseau. Standard lattices of compatibly embedded finite fields. Proceedings of ISSAC 2019, ACM, 122–130.
  • [BCS1997b] W. Bosma, J. Cannon and A. Steel. Lattices of compatibly embedded finite fields. Journal of Symbolic Computation 24:3–4 (1997), 351–369.
  • [LN1997] R. Lidl and H. Niederreiter. Finite Fields. Second edition, Encyclopedia of Mathematics and its Applications 20, Cambridge University Press, 1997.
  • [Sho1994] V. Shoup. Fast construction of irreducible polynomials over finite fields. Journal of Symbolic Computation 17:5 (1994), 371–391.
  • [Sho1999] V. Shoup. Efficient computation of minimal polynomials in algebraic extensions of finite fields. Proceedings of ISSAC 1999, ACM, 53–58.
Cite this page

The FLINT team, “Embeddings of finite fields,” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/algorithms/finite-fields/embeddings.html (generated 2026-11-02).