In the previous chapters, we studied the Number Theoretic Transform (NTT), which evaluates a polynomial at its k-th roots of unity. It can be understood as transforming a polynomial from its coefficient form into its point-value form.
The NTT can be performed by multiplying the coefficient vector of a degree-(k−1) polynomial by a Vandermonde matrix, with time complexity O(k2). It is also possible, and more interesting, to use a fast and recursive version of the transformation, which reduces the time complexity to O(klogk).
In this chapter, we begin the study of the inverse transformation of the NTT, called the Inverse Number Theoretic Transform, or INTT. It can be used to convert a polynomial from its point-valu form back to its coefficient form. This process is called interpolation.
In our article on Lagrange interpolation, we have already seen a method to perform interpolation. The difference between using Lagrange interpolation and the Inverse Number Theoretic Transform is twofold: Lagrange interpolation can be performed from any set of points, while the INTT can only be performed on the set of k-th roots of unity. Conversely, Lagrange interpolation always has time complexity O(k2), while the INTT can be performed in time complexity O(klogk).
In this chapter, we will:
Recall how evaluation can be performed using a Vandermonde matrix;
Propose an inverse transformation that is also perfomed using a Vandermonde matrix;
Show that this inverse transformation undoes the original transformation. In other words, we show that evaluation through NTT, followed by interpolation through INTT, returns the polynomial to its original coefficient form.
For now, we will work with the INTT for a polynomial of degree 3 so that the reader can more easily follow the calculations.
In a subsequent chapter, we will prove that the proposed inverse transformation applies to polynomials of any degree.
Recap: From coefficient form to point form
Consider the polynomial
f(x)=a0+a1x+a2x2+a3x3
To convert this polynomial from coefficient form to point-value form, it is necessary to evaluate it at least at 4 points.
For example, if the set S={1,ω,ω2,ω3} represents the evaluation points, where ω is a primitive 4th root of unity, the evaluations at these points are given by:
where V(ω) is called a Vandermonde Matrix, and a is the column vector representing the coefficients. You may refer to the article on Vandermonde Matrices to learn about them in detail. A Vandermonde matrix has the property that each of its rows forms a geometric progression, which is a sequence of numbers in which each term is obtained by multiplying the previous one by a constant ratio.
In the matrix V(ω) above, we can note that:
1st row: [1111]→ first term: 1, common ratio: 1
2nd row: [1ωω2ω3]→ first term: 1, common ratio: ω
3rd row: [1ω2ω4ω6]→ first term: 1, common ratio: ω2
4th row: [1ω3ω6ω9]→ first term: 1, common ratio: ω3
Let us recall how the multiplication y=V(ω)⋅a gives the evaluations of f(x):
Thus, if we are given the coefficient form of a polynomial, represented by the vector a, we can obtain its point-value form, represented by the vector y, by left-multiplying a by the Vandermonde matrix V(ω).
But what if we are given the evaluations instead, that is, the vector y, and are asked to compute the coefficients, that is, the vector a?
This can be done using the inverse of the Vandermonde matrix V(ω), denoted by V−1(ω), through the following operation:
Observe that V(ω)−1 also has the property that each of its rows forms a geometric progression:
1st row: [1111]→ first term: 1, common ratio: 1
2nd row: [1ω−1ω−2ω−3]→ first term: 1, common ratio: ω−1
3rd row: [1ω−2ω−4ω−6]→ first term: 1, common ratio: ω−2
4th row: [1ω−3ω−6ω−9]→ first term: 1, common ratio: ω−3
Therefore, the inverse of the Vandermonde matrix in this case is itself another Vandermonde matrix.
In the following sections, we will show that our claim is true in this example using the 4-th roots of unity. In the subsequent chapter, we will prove it in general.
We will prove that, in the case of k-th roots of unity, when the NTT is realized using the following Vandermonde matrix,
The inverse Vandermonde matrix, when multiplied by the vector of evaluations of a given polynomial at the roots of unity, returns the coefficient vector of that polynomial.
Evaluating V(ω)−1⋅y
To demonstrate that the matrix multiplication between V(ω)−1 and y gives us back the coefficient vector a, let us use our earlier example, where f(x)=a0+a1x+a2x2+a3x3, S={1,ω,ω2,ω3} and k=4.
Recall that y, the vector of evaluations of f(x) at the points in S, is given by:
We now show that the vectors a~ and a are equal. In other words, we want to show that
a0~a1~a2~a3~=a0,=a1,=a2,=a3.
Calculating the coefficients a0~,a1~,a2~ and a3~
Let us carry out the matrix multiplication row by row on the right-hand side (RHS) to see how the corresponding coefficients on the left-hand side (LHS) are obtained. For the coefficient a0~, we take the dot product of the first row of V(ω)−1 with the vector y:
a0~ Dot product of the first row of V(ω)−1 with y=41(1⋅f(1)+1⋅f(ω)+1⋅f(ω2)+1⋅f(ω3))=41(1⋅f(1)(a0+a1+a2+a3)+1⋅f(ω)(a0+a1ω+a2ω2+a3ω3)+1⋅f(ω2)(a0+a1ω2+a2ω4+a3ω6)+1⋅f(ω3)(a0+a1ω3+a2ω6+a3ω9))=41(4a0+a1(1+ω+ω2+ω3)+a2(1+ω2+ω4+ω6)+a3(1+ω3+ω6+ω9))
Recall from the previous chapter that, since ω is a primitive 4-th root of unity, the sum
k=0∑3ωmk
is equal to zero whenever m is not a multiple of 4. Explicitly,
k=0∑3ωmk=ωm⋅0+ωm⋅1+ωm⋅2+ωm⋅3=1+ωm+ω2m+ω3m=0
For a detailed look at this concept, please refer to the article on Orthogonality of Roots of Unity.
By substituting values of m that are not multiples of 4, we obtain the following identities:
for mfor mfor mfor mfor mfor m=1=2=3=−1=−2=−3→→→→→→1+ω+ω2+ω3=0,1+ω2+ω4+ω6=0,1+ω3+ω6+ω9=0,1+ω−1+ω−2+ω−3=0,1+ω−2+ω−4+ω−6=0,1+ω−3+ω−6+ω−9=0,
Therefore, all terms multiplying a1, a2, and a3 vanish, leaving
Again, the terms within the parentheses associated with the factors of a0,a2,a3 vanish, leaving
a1~=41⋅4a1=a1
Try expanding the multiplication for a2~ and a3~ on your own and observe how they simplify according to the same logic we have used above. You will find that a2~=a2 and a3~=a3, as expected.
This completes the demonstration that V(ω)−1⋅y=a. With this, we have shown that the inverse of the Vandermonde matrix for the case k=4 is also a Vandermonde matrix. The case for a general value of k will be proved in the subsequent chapter.
This article is part of a series on the Number Theoretic Transform in our ZK Book