The right way to teach the FFT

The algorithm behind the Fast Fourier Transform has a simple yet beautiful geometric interpretation that is often lost in translation in a classroom. This article provides a visual perspective which aims to capture the essence of it.

Authors: Jithin Donny George

The right way to teach the FFT
The righ t w a y to teac h the FFT Jithin D. George ∗ 20 Ma y 2018 Abstract The algorithm b ehind the F ast F ourier T ransform has a simple yet beautiful ge o metric int erpr etation that is often lost in tra nslation in a classro om. This article provides a visual per sp ective whic h aims to capture the es sence of it. Students are o ften confused wh en they encounter the F ast F o ur ier T ransform (FFT) f or the fir st time. The author b eliev es the confusion stems fr om tw o sources. 1. Th e b elief that one n eeds to un d erstand the F ourier transform completely to un derstand the FFT. This is not true. The FFT simply is an efficie nt w ay of computing su ms of a sp ecial form and the te rms in the Discrete F ourier T ransform (DFT) (1) just happ ened to b e in that form. A k = N − 1 X n =0 a n e − i 2 πn N k (1) 2. Th e C o oley-T uk ey Algorithm [1]. This is the heart of th e FFT. The idea is that it is p ossible to d ecomp ose the DFT of a sequence of terms int o the DFT of the eve n terms and the DFT of the o d d terms. When applied recursiv ely , this results in a computational cost of O ( N log N ). The follo wing decomp osition of A k in to o dd and even terms is generally used to illustrate the id ea. N − 1 X n =0 a n e − i 2 πn N k = N/ 2 − 1 X n =0 a 2 n e − i 2 π (2 n ) N k + N/ 2 − 1 X n =0 a 2 n +1 e − i 2 π (2 n +1) N k (2) Let us tak e a simp lified lo ok at the terms in a DFT. A k = N − 1 X n =0 a n e − in 2 π N k = N − 1 X n =0 a n e ik θ n (3) a n e ik θ n can b e visualized as the v alue a n lo cated at an angle of k θ n on a unit circle in the complex plane. As n goes from 0 to N-1, the θ n s divide the circle into N arcs of angle 2 π N . Eac h term in the summ ation in (3 ) is a m ultiple of a p oin t on the u nit circle in the complex plane. 0 a 0 1 a 1 2 a 2 3 a 3 4 a 4 5 a 5 6 a 6 7 a 7 = A 1 { a 0 , a 1 , a 2 , a 3 , a 4 , a 5 , a 6 , a 7 } With this geometric view, the Co oley-T uk ey algo rithm in (2 ) b ecomes obvious through the diagram b elo w. ∗ Department of Applied Mathematics, Universit y of W ashington, Seattle, W A (jithindgeorge93@gmail.co m) 1 0 a 0 1 a 1 2 a 2 3 a 3 4 a 4 5 a 5 6 a 6 7 a 7 0 a 0 2 a 2 4 a 4 6 a 6 1 a 1 3 a 3 5 a 5 7 a 7 = + = + e iθ 0 a 0 2 a 2 4 a 4 6 a 6 1 a 1 3 a 3 5 a 5 7 a 7 W e are able to compute su ms like the FFT in this wa y b ecause the o dd terms are a ’rotation’ a w a y from the ev en terms. This is quite elegan t b ut it in itself, do esn’t pro vide any new computational efficiency . W e d ecomp ose a su m into t wo smaller s ums of half the size. But w e still hav e to do all the sums either wa y . What giv es th e FFT its computational efficiency is the fact that the smaller su ms can b e ‘recycled’ to get n ew sums. 0 a 0 2 a 2 4 a 4 6 a 6 1 a 1 3 a 3 5 a 5 7 a 7 + = − e iθ 0 a 0 2 a 2 4 a 4 6 a 6 1 a 1 3 a 3 5 a 5 7 a 7 = = A 5 { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 } 0 a 0 1 a 1 2 a 2 3 a 3 4 a 4 5 a 5 6 a 6 7 a 7 The t w o terms whic h when added giv e A 1 can b e ‘recycled’ b y subtracting them to giv e A 5 . 2 This defin itely has to sa ve some co mpu tational cost. Ho w m uc h ? T o get th e fi ne details, w e w ould hav e to w ork out a s imple example. An example Let’s ha ve a lo ok at the DFT of the vec tor { a 0 , a 1 , a 2 , a 3 } . 1 a 0 a 1 a 2 a 3 1 a 0 a 2 1 a 1 a 3 A 0 = = + 0 a 0 1 a 1 2 a 2 3 a 3 0 a 0 2 a 2 1 a 1 3 a 3 A 1 = = + e iθ 0 a 0 a 2 1 a 1 a 3 0 a 0 a 2 1 a 1 a 3 A 2 = = − 3 0 a 0 1 a 1 2 a 2 3 a 3 0 a 0 2 a 2 1 a 1 3 a 3 A 3 = = − e iθ So, y ou can get the FFT of { a 0 , a 1 , a 2 , a 3 } using the follo wing terms. 0 a 0 2 a 2 1 a 1 3 a 3 0 a 0 a 2 1 a 1 a 3 The first t wo terms are the FFT of { a 0 , a 2 } and the last tw o form the FFT of { a 1 , a 3 } . Thus, an FFT can b e decomp osed in to an FFT of th e even terms and one of the o dd terms. This sav es a lot of compu tational cost sin ce doing DFT naiv ely is O ( N 2 ). Th is is different from decomp osing sums whic h had a cost of O ( N ) and where decomp osing did not help s av e computational cost. FFT { a 1 , a 2 , a 3 , a 4 } has the com bined compu tational cost of FFT { a 1 , a 3 } , FFT { a 2 , a 4 } and cN where c repr esents the cost of th e m ultiplication and add ition for eac h A n . Expanding the FFTs recursiv ely , FFT { a 1 , a 2 , a 3 , a 4 } has the com bin ed computational cost o f FFT { a 1 } , FFT { a 3 } , FFT { a 2 } , FFT { a 4 } and 2 cN . Computing the DFT naively with N p oin ts requ ir es c 1 N 2 w ork while computing t w o DFTs of size N 2 requires only half as m uc h wo rk, 2 c 1  N 2  2 = 1 2 c 1 N 2 , p lus c 2 N wo rk to combine the tw o results. W e can apply this recursivel y log 2 N times to completely eliminate the quadratic cost, lea ving only the cost of N 1-p oint DFTs plu s log 2 N com binations eac h requiring O ( N ) w ork, for a total of O ( N log 2 N ) wo rk. Th us, in general, th e total cost is N + clog 2 ( N ) N ≈ O ( l og 2 ( N ) N ) Ac kno wledgmen ts The author t hanks D a vid I. Ketc heson and Randall J. LeV eque for their co mments on earlier drafts. References [1] Co oley , J.W. and T ukey , J.W., 1965 . An algorithm for the mac h ine calculat ion of complex F ourier series. Mathematic s of computation, 19(90 ), pp.297-301. 4

Original Paper

Loading high-quality paper...

Comments & Academic Discussion

Loading comments...

Leave a Comment