These are the human proofs of Convolution via FFT, at full length.
FFT-CONVOLVE returns the linear convolution, with a first-order error bound in floating point full
This proof shows: correctness, error-bound.
Let R be a commutative ring, a∈Rm, b∈Rℓ with m,ℓ≥1, L=m+ℓ−1, and N the least power of two with N≥L. Assume that ω∈R is a principal N-th root of unity and that N is a unit of R. Let a′,b′∈RN be a and b padded with zeros (lines L4 and L5).
Lemma 1 (padding). For 0≤k≤N−1, (a′⊛b′)k=(a∗b)k if k≤L−1, and 0 otherwise.
Proof. By definition (a′⊛b′)k=∑j=0N−1aj′b(k−j)modN′. A term is nonzero only if j≤m−1 and r=(k−j)modN≤ℓ−1. Then j+r≤m+ℓ−2<N, and j+r≡k(modN) with 0≤j+r<N, so j+r=k. Hence the sum is ∑j+r=k,j<m,r<ℓajbr, which is (a∗b)k for k≤L−1 and an empty sum for k≥L. □
Theorem 1. FFT-CONVOLVE(a,b) returns a∗b.
Proof. By the correctness theorem of the FFT, line L6 sets A=FNa′ and B=FNb′, with (FNx)k=∑jxjωjk. Line L7 sets C=A⋅B entrywise. By the convolution theorem (forward form, which only needs ωN=1), C=FN(a′⊛b′). Since ω is principal and N is a unit, INVERSE-FFT computes FN−1, so line L8 leaves a′⊛b′ in C. By Lemma 1, its first L entries, returned by line L9, are a∗b. ■
Operation count. Lines L6 and L8 run three FFTs of length N, each with 2NlgN multiplications and NlgN additions. Line L7 does N multiplications, and the scaling in line L8 does N more. In total 23NlgN+2N multiplications and 3NlgN additions, with N<2L by the choice of N.
Theorem 2 (floating point, first order). Over C with ω=e−2πi/N, let each FFT be computed in floating point with unit roundoff u, and assume the bound of Higham, Theorem 24.2: the computed transform y^ of any vector x satisfies ∥y^−Fx∥2≤δ∥Fx∥2, where δ=lgN⋅η/(1−lgN⋅η) and η=μ+γ4(2+μ). The same bound holds for the transform with ω−1. Assume each computed complex product is xy(1+θ) with ∣θ∣≤γ=2γ2, and that the division by the power of two N is exact. Then the computed c^ satisfies
Proof. We use two facts on F=FN and G=FN(ω−1): ∥Fx∥2=N∥x∥2, by the summation lemma, and ∥Fx∥∞≤∥x∥1, since every entry of F has modulus 1; the same holds for G. Also ∥a′∥=∥a∥ in each norm.
Let A=Fa′ and A^=A+EA with ∥EA∥2≤δN∥a∥2, and in the same way B^=B+EB with ∥EB∥2≤δN∥b∥2. The computed product is C^k=A^kB^k(1+θk). With C=A⋅B, and dropping products of two error terms,
C^−C=EA⋅B+A⋅EB+θ⋅A⋅B+O(u2).
Now ∥EA⋅B∥2≤∥EA∥2∥B∥∞≤δN∥a∥2∥b∥1, ∥A⋅EB∥2≤∥A∥∞∥EB∥2≤δN∥a∥1∥b∥2, and ∥θ⋅A⋅B∥2≤γ∥A∥2∥B∥∞≤γN∥a∥2∥b∥1. So ∥C^−C∥2≤(2δ+γ)NK+O(u2).
The inverse step computes c^′=N1(GC^+EG) with ∥EG∥2≤δ∥GC^∥2=δN∥C^∥2. The exact value is c′=N1GC=a′⊛b′, by Theorem 1. So
c^′−c′=N1G(C^−C)+N1EG.
For the first term, ∥N1Gv∥∞≤N1∥v∥1≤N1∥v∥2, which gives at most (2δ+γ)K+O(u2). For the second term, ∥N1EG∥∞≤N1∥EG∥2≤Nδ∥C^∥2, and ∥C^∥2=∥C∥2+O(u)≤∥A∥2∥B∥∞+O(u)≤NK+O(u), which gives at most δK+O(u2). Adding the two terms, and noting that c^ is the first L entries of c^′ and a∗b the first L entries of c′, proves the bound. ■
Exact rounding. If a and b are integer vectors, then a∗b is an integer vector, and if the right side of Theorem 2, including the second-order terms, is below 21, rounding each real part of c^ to the nearest integer returns a∗b exactly.