Algorithm Search⌘K

Proofs: Inverse FFT

These are the human proofs of Inverse FFT, at full length.

INVERSE-FFT computes the inverse DFT with n lg n additions and (n/2) lg n + n multiplications full

This proof shows: correctness, complexity.

Statement. Let RR be a commutative ring, n=2tn = 2^t with t≥0t \ge 0, ω∈R\omega \in R a principal nn-th root of unity, and suppose n⋅1n \cdot 1 is a unit of RR. For each X∈RnX \in R^n, INVERSE-FFT(X,ω)(X, \omega) ends with XX replaced by the unique x∈Rnx \in R^n with DFTω(x)=X\mathrm{DFT}_\omega(x) = X, that is xj=1n∑kXkω−jkx_j = \frac{1}{n} \sum_k X_k \omega^{-jk}. Without line L13 it ends with nxn x. It does exactly nlg⁡nn \lg n additions and subtractions and n2lg⁡n+n\frac{n}{2}\lg n + n multiplications, besides the at most n/2n/2 multiplications of line L2.

The forward stages. For 1≤h≤n/21 \le h \le n/2 a power of two, let Wh=ωn/(2h)W_h = \omega^{n/(2h)} and let Sh:Rn→RnS_h : R^n \to R^n be the map that, for each block start s∈{0,2h,4h,…}s \in \{0, 2h, 4h, \ldots\} and each 0≤k<h0 \le k < h, replaces the pair (ys+k,ys+k+h)=(u,v)(y_{s+k}, y_{s+k+h}) = (u, v) by (u+Whkv, u−Whkv)(u + W_h^k v,\ u - W_h^k v). The pairs for different (s,k)(s, k) are disjoint and cover all positions, so ShS_h is well defined and RR-linear. Let PP be the bit-reversal permutation of the positions, (Py)j=yrevt(j)(Py)_j = y_{\mathrm{rev}_t(j)}. The iterative FFT computes PP and then S1,S2,…,Sn/2S_1, S_2, \ldots, S_{n/2}, and its correctness (proved on the page of the fast Fourier transform) is the identity

Sn/2∘⋯∘S2∘S1∘P=Fn,(Fn)kj=ωjk.(1)S_{n/2} \circ \cdots \circ S_2 \circ S_1 \circ P = F_n, \qquad (F_n)_{kj} = \omega^{jk}. \tag{1}

One inverse stage. Fix hh, and let IhI_h be the map of lines L5 to L9 for this hh. Line L9 reads V[k⋅n/(2h)]=ω−kn/(2h)=Wh−kV[k \cdot n/(2h)] = \omega^{-kn/(2h)} = W_h^{-k}, which exists since ω\omega is a unit (ω⋅ωn−1=1\omega \cdot \omega^{n-1} = 1). Lines L7 to L9 read the two cells of one pair and write only those two cells, and different (s,k)(s, k) touch disjoint pairs, so IhI_h acts on each pair separately, by (a,b)↦(a+b, Wh−k(a−b))(a, b) \mapsto (a + b,\ W_h^{-k}(a - b)). It is RR-linear. For the pair (a,b)=(u+Whkv, u−Whkv)(a, b) = (u + W_h^k v,\ u - W_h^k v) produced by ShS_h,

a+b=2u,Wh−k(a−b)=Wh−k⋅2Whkv=2v.a + b = 2u, \qquad W_h^{-k}(a - b) = W_h^{-k} \cdot 2 W_h^k v = 2v.

Hence

Ih∘Sh=2⋅id.(2)I_h \circ S_h = 2 \cdot \mathrm{id}. \tag{2}

The whole loop. Line L3 sets h=n/2h = n/2, line L10 halves hh, and line L4 stops when h<1h < 1. So the loop runs In/2I_{n/2} first and I1I_1 last, tt stages in all (none when n=1n = 1). Lines L11 and L12 swap jj and revt(j)\mathrm{rev}_t(j) once for each pair j<revt(j)j < \mathrm{rev}_t(j) and leave the fixed points alone; since revt\mathrm{rev}_t is an involution, this applies PP, and P∘P=idP \circ P = \mathrm{id}. Write G=P∘I1∘I2∘⋯∘In/2G = P \circ I_1 \circ I_2 \circ \cdots \circ I_{n/2} for the map of lines L3 to L12. By (1) and then (2) applied tt times from the inside out, using that 2⋅id2 \cdot \mathrm{id} commutes with every linear map,

G∘Fn=P∘I1∘⋯∘In/2∘Sn/2∘⋯∘S1∘P=2t⋅P∘P=n⋅id.G \circ F_n = P \circ I_1 \circ \cdots \circ I_{n/2} \circ S_{n/2} \circ \cdots \circ S_1 \circ P = 2^t \cdot P \circ P = n \cdot \mathrm{id}.

Conclusion. Since nn is a unit and ω\omega is principal, FnF_n is invertible with inverse 1n(ω−jk)j,k\frac{1}{n}(\omega^{-jk})_{j,k}; this is the inverse formula, proved on the DFT page from ∑kωrk=0\sum_k \omega^{rk} = 0 for 1≤r≤n−11 \le r \le n - 1. Multiplying G∘Fn=n⋅idG \circ F_n = n \cdot \mathrm{id} on the right by Fn−1F_n^{-1} gives G=nFn−1G = n F_n^{-1}. So after line L12 the array holds nFn−1X=nxn F_n^{-1} X = n x, and line L13 multiplies by n−1n^{-1}, leaving xx. Uniqueness of xx is the injectivity of FnF_n. Without line L13 the array holds nxn x. Since nFn−1=(ω−jk)j,kn F_n^{-1} = (\omega^{-jk})_{j,k}, this is the unnormalized inverse X↦(∑kXkω−jk)jX \mapsto (\sum_k X_k \omega^{-jk})_j.

Operation count. In the stage with half length hh there are n/(2h)n/(2h) blocks with hh butterflies each, so n/2n/2 butterflies. Each does one addition (line L8), one subtraction and one multiplication (line L9). Over t=lg⁡nt = \lg n stages this is nlg⁡nn \lg n additions and subtractions and n2lg⁡n\frac{n}{2}\lg n multiplications, for every input. Line L13 adds nn multiplications. Line L2 needs at most n/2n/2 multiplications for the powers of ω−1\omega^{-1}, once per length. The loops of lines L4 to L12 take O(nlog⁡n)O(n \log n) index steps, so the time is Θ(nlog⁡n)\Theta(n \log n) for every input. The table VV and the table of reversed indices take Θ(n)\Theta(n) space, and the transform itself writes only into XX. ■\blacksquare

Back to Inverse FFT