A-16.4 Inverse FFT (or NTT)

Once we have computed:

C(X) : ((x0,y0c),(x1,y1c),(xn1,yn1c)), where yic = yiayib

, our final step is to convert yic back to c, the polynomial coefficients of C(X). We call this reversing operation the inverse FFT.

Given an (n 1)-degree polynomial A(X) = i=0n1aiXi, the forward FFT process is computationally equivalent to evaluating the polynomial at n distinct n-th roots of unity as follows:

yia = A(ωi) = j=0n1aj (ωi)j = j=0n1aj ω𝑖𝑗

The above evaluation is equivalent to computing the following matrix-vector multiplication:

yia = W a, where W = [ (ω0)0 (ω0)1 (ω0)n1 (ω1)0 (ω1)1 (ω1)n1 (ωn1)0 (ωn1)1 (ωn1)n1 ] , a = (a0,a1,,an1)

We denote each element of W as: (W)i,j = ω𝑖𝑗. The inverse FFT is a process of reversing the above computation. For this inversion, our goal is to find an inverse matrix W1 such that W1 yia = W1 (W a) = (W1 W) a = In a = a. As a solution, we propose the inverse matrix W1 as follows: (W1)j,k = n1 ω𝑗𝑘. Now, we will show why W1 W = In.

Each element of W1 W is computed as:

(W1 W)j,i = k=0n1(n1 ω𝑗𝑘 ω𝑘𝑖) = n1 k=0n1ω𝑗𝑘 ω𝑘𝑖 = n1 k=0n1ω(ij)k

In order for W1 W to be In, the following should hold:

(W1W) j,i = { 1 if j = i 0 if ji

If j = i, the above condition holds, because (W1 W)j,i = n1 k=0n1ω(0)k = n1 k=0n11 = n1 n = 1.

In the case of ji, we will leverage the Geometric Sum formula i=0n1xi = xn 1 x 1 (the proof is provided below):

Theorem A-16.4 Geometric Sum Formula

Let the geometric sum Sn = 1 + x + x2 + + xn1

Then, x Sn = x + x2 + x3 + + xn

x Sn Sn = (x + x2 + x3 + + xn) (1 + x + x2 + + xn1) = xn 1

Sn (x 1) = xn 1

Sn = xn 1 x 1 # with the constraint that x1

Our goal is to compute k=0n1ω(ij)k. Leveraging the Geometric Sum formula i=0n1xi = xn 1 x 1 ,

k=0n1ω(ij)k = (ωij)n 1 ωij 1

= (ωn)ij 1 ωij 1

= (1)ij 1 ωij 1 # since the order of ω is n

# Here, the denominator can’t be 0, since ij and n < i j < n (as 0 i < n and 0 j < n)

= 0

Thus, (W1 W)j,i is 1 if j = i, and 0 if ji. Therefore, the inverse FFT can be computed as follows:

c = W1 yic, where ci = n1 j=0n1yicω𝑖𝑗

The above inverse FFT computation is equivalent to evaluating the polynomial C^(X) = i=0n1yicXi at X = {ω0,ω1,ω2,,ω(n1)}, which is equivalent to evaluating C^(X) at X = {ω0,ωn1,ωn2,,ω1}. For this evaluation, we can use the same optimization technique explained in the forward FFT process (§A-16.2.2) whose time complexity is O(nlogn).