A-16.4 Inverse FFT (or NTT)

So far, we have computed:

C(X) : ((x0,y0⟨c⟩),(x1,y1⟨c⟩),⋯(xn−1,yn−1⟨c⟩)), where yi⟨c⟩ = yi⟨a⟩⋅yi⟨b⟩

Our final step is to convert yi⟨c⟩ back to c→, the polynomial coefficients of C(X). We call this reversing operation the inverse FFT.

Given an (n −1)-degree polynomial C(X) = ∑ ⁡ i=0n−1ciXi, the forward FFT process is computationally equivalent to evaluating the polynomial at n distinct n-th roots of Xn + 1 as follows:

yi⟨c⟩ = C(ω2i+1) = ∑ ⁡ j=0n−1cj ⋅(ω2i+1)j = ∑ j=0n−1cj ⋅ω(2i+1)j

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

yi⟨c⟩ = W ⋅c→, where W = [ (ω1)0 (ω1)1 ⋯ (ω1)n−1 (ω3)0 (ω3)1 ⋯ (ω3)n−1 ⋮ ⋮ ⋱ ⋮ (ω2n−1)0 (ω2n−1)1 ⋯ (ω2n−1)n−1 ] , c→ = (c0,c1,⋯,cn−1)

We denote each element of W as: (W)i,j = ω(2i+1)j. The inverse FFT is a process of reversing the above computation. For this inversion, our goal is to find an inverse matrix W−1 such that W−1 ⋅yi⟨c⟩ = W−1 ⋅(W ⋅c→) = (W−1 ⋅W) ⋅c→ = In ⋅c→ = c→. As a solution, we propose the inverse matrix W−1 as follows:

(W−1)j,k = n−1 ⋅ω−(2k+1)j

Now, we will show why W−1 ⋅W = In. Each element of W−1 ⋅W is computed as:

(W−1 ⋅W)j,i = ∑ ⁡ k=0n−1(n−1 ⋅ω−(2k+1)j ⋅ω(2k+1)i) = n−1 ⋅∑ k=0n−1ω(2k+1)(i−j)

In order for W−1 ⋅W to be In, the following should hold:

(W−1⋅W) j,i = { 1 if j = i 0 if j≠i

If j = i holds, the above condition is satisfied because:

(W−1 ⋅W)j,i = n−1 ⋅∑ ⁡ k=0n−1ω(2k+1)(0) = n−1 ⋅∑ k=0n−11 = n−1 ⋅n = 1

In the case of j≠i, we will leverage the Geometric Sum formula ∑ ⁡ i=0n−1xi = xn −1 x −1 (the proof is provided below):

⟨Theorem A-16.4⟩ Geometric Sum Formula

Let the geometric sum Sn = 1 + x + x2 + ⋯ + xn−1

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

x ⋅Sn −Sn = (x + x2 + x3 + ⋯ + xn) −(1 + x + x2 + ⋯ + xn−1) = xn −1

Sn ⋅(x −1) = xn −1

Sn = xn −1 x −1 ▹ with the constraint that x≠1

Our goal is to compute ∑ ⁡ k=0n−1ω(2k+1)(i−j) = ωi−j ∑ k=0n−1(ω2(i−j))k. Leveraging the Geometric Sum formula with x = ω2(i−j):

ωi−j ∑ ⁡ k=0n−1(ω2(i−j))k = ωi−j(ω2(i−j))n −1 ω2(i−j) −1

= ωi−j(ω2n)i−j −1 ω2(i−j) −1

= ωi−j (1)i−j −1 ω2(i−j) −1 ▹ since the order of ω is 2n, ω2n = 1

▹Here, the denominator can’t be 0. Since i≠j and |i −j|< n, the exponent 2(i −j) is not a multiple of 2n.

= 0

Thus, (W−1 ⋅W)j,i is 1 if j = i, and 0 if j≠i. Therefore, the inverse FFT can be computed as c→ = W−1 ⋅y⟨c⟩, where:

ci = ∑ ⁡ j=0n−1(W−1)i,j ⋅yj⟨c⟩

∑ ⁡ j=0n−1 (n−1 ⋅ω−(2j+1)i) ⋅yj⟨c⟩ ▹ since (W−1)j,k = n−1 ⋅ω−(2k+1)j, and (W−1)i,j = n−1 ⋅ω−(2j+1)i

= n−1 ⋅∑ ⁡ j=0n−1yj⟨c⟩⋅ω−(2j+1)i

= n−1 ∑ ⁡ j=0n−1yj⟨c⟩⋅(ω−2𝑗𝑖 ⋅ω−i) ▹ since ω−(2j+1)i = ω−2𝑗𝑖−i = ω−2𝑗𝑖 ⋅ω−i

= n−1ω−i ∑ ⁡ j=0n−1yj⟨c⟩(ω−2)𝑗𝑖

By reusing the recursive splitting technique explained in the forward process (§A-16.2.2), this inverse operation also achieves a time complexity of O(nlog⁡n).