NTT Over Extension Field

The Core Concept

When computing a NTT over an Extension Field (e.g., Fp2\mathbb{F}_{p^2}), we can avoid doing operations over the extension field. Instead, we can "flatten" the data into the base field (Fp\mathbb{F}_p), run a standard NTT on the base components independently, and then reconstitute the result.


1. The Transformation

Imagine we are working in a Quadratic Extension Field, where every element ee is represented as a+bua + b \cdot u.

  • a,ba, b: Coefficients in the base field.

  • uu: The extension basis (imaginary unit).

Instead of processing one column of "extension elements," we process two columns of "base elements."

The Algorithm:

  1. Split: Take the input vector of elements (ai+biu)(a_i + b_i u) and split it into two vectors: A=[a0,a1...]\bm{A} = [a_0, a_1...] and B=[b0,b1...]\bm{B} = [b_0, b_1...].

  2. Compute: Run the standard base field NTT on A\bm{A} and B\bm{B} separately.

  3. Merge: The result for index kk is simply NTT(A)k+NTT(B)ku\sf{NTT}(\bm{A})_k + \sf{NTT}(\bm{B})_k \cdot u.


2. Why this works

The validity of this optimization relies on one critical constraint: The Root of Unity (ω\omega) must exist in the base field.

If ω\omega is in the base field, multiplying an extension element by ω\omega scales the components independently.

The Proof

Let us show the proof in the quadratic extension field case but it scales to arbitrary degree of extension field using the same logic.

Definition 5: The Number Theoretic Transform (NTT) of a vector of polynomial coefficients a\boldsymbol{a} is defined as a^=NTT(a)\hat{\boldsymbol{a}} = \mathsf{NTT}(\boldsymbol{a}), where:

a^j=i=0n1ωijaimodq(8)\hat{a}_j=\sum^{n-1}_{i=0}\omega^{ij}a_i\mod q \tag{8}

and j=0,1,,n1j=0,1,\dots,n-1. Here, a^\hat{\bm{a}} denotes the evaluations of the polynomial defined by a\bm{a} over {ω0,ω1,,ωn1}\{\omega^{0},\omega^{1},\dots,\omega^{n-1}\} which are the roots of (xn1)(x^n-1).

Let our vector of coefficients in extension field be x\bm{x}, where each element is defined by:

xi=ai+biux_i = a_i + b_i \cdot u

The definition of the NTT for output x^\hat{\bm{x}} is:

x^j=i=0n1ωijxi\hat{x}_j=\sum^{n-1}_{i=0}\omega^{ij}x_i

Substitute xix_i and since ω\omega is in the base field, we can distribute it:

x^j=i=0n1ωijxi=i=0n1ωij(ai+biu)=i=0n1ωijai+i=0n1ωijbiu\hat{x}_j=\sum^{n-1}_{i=0}\omega^{ij}x_i=\sum^{n-1}_{i=0}\omega^{ij}(a_i + b_iu)=\sum^{n-1}_{i=0}\omega^{ij}a_i + \sum^{n-1}_{i=0}\omega^{ij}b_iu

And if we think about the NTT over the base field, we have:

a^j=i=0n1ωijai\hat{a}_j=\sum^{n-1}_{i=0}\omega^{ij}a_i
b^j=i=0n1ωijbi\hat{b}_j=\sum^{n-1}_{i=0}\omega^{ij}b_i

Now, we can rewrite the x^j\hat{x}_j as:

x^j=a^j+b^ju\hat{x}_j=\hat{a}_j + \hat{b}_ju

3. The Constraint (When this fails)

This optimization only works if the twiddle factor ω\omega is in the base field.

If ω\omega were in the extension field (e.g., ω=c+du\omega = c + du), the multiplication would "mix" the components:

ω(a+bu)=(c+du)(a+bu)=(cadb)+(cb+da)u\omega \cdot (a + bu) = (c + du)(a + bu) = (ca - db\dots) + (cb + da) \cdot u

Because the new "real" part (cadb)(ca - db) depends on both aa and bb, you could not process the columns independently.

Summary

  • Standard NTT: O(NlogN)O(N \log N) operations using expensive extension field arithmetic.

  • Flattened NTT: d×O(NlogN)d \times O(N \log N) operations using base field arithmetic where dd is extension degree.

Last updated