Optimized Inversion Algorithm
Presentation: https://www.youtube.com/watch?v=QNxgKYcc-A0
Finite-field inversion can be optimized when the extension degree is small and the field's algebraic structure is well-defined. Specifically, extension fields of degrees three and four enable inversion to be formulated in closed form, leveraging low-dimensional linear algebra and quadratic subextensions.
For the quadratic extension (), inversion admits a particularly simple closed form. Writing an element as , the inverse is obtained by first forming a base-field denominator and then multiplying its inverse by the conjugate .
For the cubic extension (), multiplication by a fixed element defines an -linear endomorphism of a three-dimensional vector space. Inversion can therefore be obtained by inverting this linear transformation, leading to explicit formulas involving determinants and adjugate matrices.
For the quartic extension (), the field admits a natural representation as a quadratic extension over . This tower structure enables inversion via conjugation with respect to the intermediate field, reducing the problem to the inversion of a single element in .
1. Inversion in
1.1 Field Definition
Let
where is fixed. Every element is written uniquely as
1.2 Multiplication as a Linear Operator
Multiplication by defines an -linear map given by . With respect to the basis , this map is represented by
1.3 Inversion via Linear Algebra
Assume . Then is invertible and the inverse element satisfies . By Cramer’s rule,
so the coordinates of are given by the first column of .
1.4 Explicit Inversion Formula
: The First Column of the Adjugate Matrix
This is the cofactor of the , where is the element at row and coloum .
It is calculated as the determinant of the matrix remaining after crossing out the 1st row and 1st column.
This is the cofactor for the .
The sign is already integrated into the simplified formula in the code.
This is the cofactor for the .
These constitute the first column of the adjugate matrix . In extension fields, the matrix has a circulant structure, meaning that knowing the first column is sufficient to determine the entire inverse.
: The Determinant
This is the Laplace expansion along the first column of matrix .
It performs
: The Final Inverse
2. Inversion in the Quartic Extension Field
Direct inversion via a matrix is inefficient. Instead, is viewed as a quadratic extension over :
2.1 Tower Construction
Let and .
Every element can be written as with .
2.2 Quadratic Conjugation
Define the conjugate of over by . This operation satisfies .
2.3 First Level of Rationalization (Removing )
Our goal is to find . To remove from the denominator, we multiply the top and bottom by the conjugate :
Since , the denominator becomes .
Now, has been eliminated from the denominator, leaving only .
2.4 Second Level of Rationalization (Removing )
Let's look at the new denominator . Since and contain , can be expanded into a linear form of : . To remove , we multiply by its conjugate :
Since , the final denominator becomes .
This value (the Norm) is now a pure scalar (BaseField), free of both and .
2.5 Inversion Formula
Assume . Then , and the inverse of is
Thus inversion in reduces to inversion in .
2.6 Inversion in the Quadratic Subfield
Writing with , one has
This completes the inversion algorithm using only base-field arithmetic.
3. Performance Comparison with the Itoh–Tsujii Algorithm
This section compares the specialized inversion methods for low-degree extension fields with the Itoh–Tsujii algorithm from the perspective of arithmetic cost. The comparison is expressed in terms of operations over the prime field .
Throughout, it is assumed that:
Frobenius applications are free or negligible compared to multiplication,
squaring and multiplication in are counted separately
3.1 Arithmetic Cost Summary
Matrix-based inversion
Linear algebra (determinant + adjugate)
Itoh–Tsujii
Extension-field multiplications
Quadratic tower inversion
Two successive quadratic reductions
Itoh–Tsujii
Flat exponentiation in full extension
3.2 Interpretation
For both cubic and quartic extensions, the specialized inversion formulas reduce the number of base-field multiplications by avoiding full extension-field multiplication.
In the cubic case, inversion is obtained via explicit determinant and adjugate computation, keeping all arithmetic in .
In the quartic case, inversion proceeds through a quadratic tower, so that all intermediate inversions occur in proper subfields.
In contrast, the Itoh–Tsujii algorithm operates uniformly on the full extension field and requires additional extension-field multiplications, which expand to a larger number of base-field operations.
3.3 Asymptotic Perspective
However, for small values of , the constant factors dominate:
Specialized methods achieve lower arithmetic cost by exploiting explicit low-degree structure.
Itoh–Tsujii trades higher constant factors for generality and uniformity across extension degrees.
As a result, for extension degrees and , the specialized algorithms are typically preferred.
A. Possibility of Inversion over a Quadratic Tower
A.1 Setting
Consider an extension field of degree over the prime field . Assume that the field admits a recursive quadratic tower representation of the form
where is a non-square.
A.2 Quadratic Reduction Step
At each level of the tower, an element of can be written as with . The inverse of is computed by:
forming the denominator ,
multiplying its inverse by the conjugate .
This reduces inversion in to a single inversion in .
A.3 Recursive Structure
By recursively applying the quadratic reduction step, inversion in is reduced along the tower
As a result, exactly one inversion in the base field is required, together with a bounded number of multiplications and squarings in intermediate subfields.
A.4 Applicability Conditions
This approach is applicable if and only if:
the extension field is explicitly represented as a quadratic tower,
a suitable non-residue is available at each level of the tower.
If the field is instead given as a flat extension with , a compatible quadratic tower representation may not be immediately available and may require nontrivial basis transformations.
A.5 Limitations
Although quadratic tower inversion is structurally simple and implementation-friendly, it is not universally optimal. For large values of , the accumulated cost of intermediate multiplications may outweigh the benefits of avoiding extension-field exponentiation. Moreover, the existence of suitable non-residues is field-dependent and must be ensured by construction.
Written by Soowon Jeong of Fractalyze
Last updated