These are the human proofs of Fast discrete cosine transform, at full length.
Makhoul's reduction computes the DCT-II, its inverse recovers the input, and the rounding error is O(u log n) full
This proof shows: correctness, complexity, error-bound.
Let n=2t with t≥1 (for n=1 line L2 returns X0=x0, which is the DCT-II of length 1). Let x∈Rn, let v be the vector built by lines L3 to L5, so vr=x2r and vn−1−r=x2r+1 for 0≤r<n/2, let Vk=∑rvrωnrk with ωn=e−2πi/n, and let dk=e−πik/(2n). Write Xk=∑jxjcos2nπ(2j+1)k.
Lemma 1 (reordering). For 0≤k≤n−1, Xk=∑r=0n−1vrcos2nπ(4r+1)k.
Proof. Lines L3 to L5 define a bijection between the indices j and r: the even j=2r go to r∈{0,…,n/2−1}, and the odd j=2r+1 go to r′=n−1−r∈{n/2,…,n−1}. For an even j=2r, 2j+1=4r+1. For an odd j=2r+1 with r=n−1−r′, 2j+1=4r+3=4n−(4r′+1), so cos2nπ(2j+1)k=cos(2πk−2nπ(4r′+1)k)=cos2nπ(4r′+1)k, since cos is even and has period 2π. Summing over the bijection gives the claim. □
Theorem 1 (forward). FAST-DCT(x) returns X.
Proof. By Theorem 1 of the FFT proof, line L6 computes V=Fnv. Then dkVk=∑rvre−πik/(2n)e−2πirk/n=∑rvre−πi(4r+1)k/(2n). Since each vr is real, the real part is ∑rvrcos2nπ(4r+1)k, which is Xk by Lemma 1. Line L8 stores this value for each k. □
Lemma 2 (symmetry). For 1≤k≤n−1, Im(dkVk)=−Xn−k, and V0=X0.
Proof. Since v is real, Vn−k=∑rvrωnr(n−k)=∑rvrωn−rk=Vk. Also dn−k=e−πi/2eπik/(2n)=−idk. So dn−kVn−k=−idkVk. For z=a+ib, Re(−izˉ)=Re(−ia−b)=−b. With z=dkVk and Theorem 1 applied at n−k, Xn−k=Re(dn−kVn−k)=−Im(dkVk). Finally d0=1, and V0=∑rvr is real, so V0=Re(d0V0)=X0. □
Proof. By Theorem 1 and Lemma 2, dkVk=Xk−iXn−k for 1≤k≤n−1, so Vk=dk(Xk−iXn−k)=eπik/(2n)(Xk−iXn−k), using ∣dk∣=1. Together with V0=X0, line L10 sets W=V. Since ωn is a principal n-th root of unity in C and n is invertible, Theorem 2 of the FFT proof shows that line L11 returns w=v, which is real. Line L12 undoes the bijection of lines L3 to L5, so it returns x. □
Lemma 3 (row orthogonality). Let Ckj=cos2nπ(2j+1)k. Then CCT=D=diag(n,2n,…,2n), and ∥Cy∥2≥n/2∥y∥2 for every y∈Rn.
Proof. First, for an integer m with 0<∣m∣<2n, S(m)=∑j=0n−1cos2nπ(2j+1)m=0. Put θ=πm/n, so eiθ=1. Then S(m)=Re(eiθ/2∑jeijθ)=Re(eiθ/2eiθ−1einθ−1). If m is even, einθ=eiπm=1 and S(m)=0. If m is odd, einθ=−1 and eiθ−1=2isin(θ/2)eiθ/2 with sin(θ/2)=0, so S(m)=Re(2isin(θ/2)−2)=Re(sin(θ/2)i)=0. Now by cosacosb=21(cos(a−b)+cos(a+b)), (CCT)kl=21(S(k−l)+S(k+l)), with S(0)=n. For k=l=0 this is n. For k=l≥1 it is 21(n+S(2k))=2n, since 0<2k<2n. For k=l, both k−l and k+l are nonzero and less than 2n in absolute value, so the entry is 0. Hence Q=D−1/2C satisfies QQT=I, so Q is orthogonal, and ∥Cy∥2=∥D1/2Qy∥2≥n/2∥Qy∥2=n/2∥y∥2. □
Theorem 3 (rounding error). Work in floating point with unit roundoff u and γm=mu/(1−mu). Suppose the computed FFT satisfies ∥V^−V∥2≤δ∥V∥2 (Higham, Theorem 24.2, gives such a δ=O(ulogn) when the twiddle factors are accurate), each computed rotation is d^k=dk(1+θk) with ∣θk∣≤μ, and line L8 evaluates c^kReV^k+s^kImV^k in floating point, with d^k=c^k−is^k. Then
∥X∥2∥X^−X∥2≤2(δ+μ+2γ2)+O(u2)
for x=0.
Proof. Lines L3 to L5 copy entries, so v is exact and ∥v∥2=∥x∥2. By Parseval for the unnormalized DFT, ∥V∥2=n∥v∥2=n∥x∥2. The floating-point dot product of length 2 gives X^k=Re(d^kV^k)+ek with ∣ek∣≤γ2(∣c^kReV^k∣+∣s^kImV^k∣)≤2γ2∣d^k∣∣V^k∣, by the Cauchy-Schwarz inequality. Hence
By Lemma 3, ∥X∥2=∥Cx∥2≥n/2∥x∥2. Dividing gives the bound. □
Operation count. Lines L3 to L5 and L12 only move data. Line L6 is one complex FFT of length n: 2nlgn complex multiplications and nlgn complex additions, which is 2nlgn real multiplications and 3nlgn real additions with the usual 4 multiplications and 2 additions per complex product. Lines L7 and L8 use at most 2n real multiplications and n real additions, plus the n rotation factors, which can be precomputed once per length. So FAST-DCT uses 5nlgn+3n real operations, and Θ(nlogn) in total. Line L10 uses O(n) operations and line L11 one inverse FFT of length n, so the inverse has the same order of cost. ■