§ FFT

§ Worked out example of FFT of 8 elements

p(x)a0x0+a1x1+a2x2+a3x3+a4x4+a5x5+a6x6+a7x7pe(x)a0x0+a2x+a4x2+a6x3po(x)a1+a3x+a5x2+a7x3P(x)=pe(x)=xpo(x) p(x) \equiv a_0 x^0 + a_1 x^1 + a_2 x^2 + a_3 x^3 + a_4 x^4 + a_5 x^5 + a_6 x^6 + a_7 x^7 p_e(x) \equiv a_0 x^0 + a_2 x + a_4 x^2 + a_6 x^3 \\ p_o(x) \equiv a_1 + a_3 x + a_5 x^2 + a_7 x^3 \\ P(x) = p_e(x) = x p_o(x)
Now suppose we know how to evaluate pe(x)p_e(x) and po(x)p_o(x) at [w40,w41,w42,w43][w_4^0, w_4^1, w_4^2, w_4^3]. where w4w_4 is the 4th root of unity. We wish to evaluate p(x)p(x) at [w80,w81,w82,,w87][w_8^0, w_8^1, w_8^2, \dots, w_8^7], where w8w_8 is the 8th root of unity. The only two properties of the roots of unity we will need are:
  • w82=w4w_8^2 = w_4.
  • w84=1w_8^4 = -1.
Using the value of w8w_8, the above two relations, the values po(w4k)=[po(1),po(w4,po(w42),po(w43)]p_o(w_4^k) = [p_o(1), p_o(w_4, p_o(w_4^2), p_o(w_4^3)] and pe(w4k)=[pe(1),pe(w4),pe(w42),pe(w43)]p_e(w_4^k) = [p_e(1), p_e(w_4), p_e(w_4^2), p_e(w_4^3)], we evaluate pp at powers of w8w_8 ( [p(w8k)][p(w_8^k)] ) as:
  • p(w8k)=pe((w8k)2)+w8kpo((w8k)2)=pe(w4k)+w8kpo(w4k)p(w_8^k) = p_e((w_8^k)^2) + w_8^k p_o((w_8^k)^2) = p_e(w_4^k) + w_8^k p_o(w_4^k).
  • p(w80)=pe((w80)+w80po(w80)=pe(1)+po(1)p(w_8^0) = p_e((w_8^0) + w_8^0 p_o(w_8^0) = p_e(1) + p_o(1)
  • p(w81)=pe(w82)+w81po(w82)=pe(w41)+w8po(w41)p(w_8^1) = p_e(w_8^2) + w_8^1 p_o(w_8^2) = p_e(w_4^1) + w_8 p_o(w_4^1)
  • p(w82)=pe(w84)+w82po(w84)=pe(w42)+w82po(w42)p(w_8^2) = p_e(w_8^4) + w_8^2 p_o(w_8^4) = p_e(w_4^2) + w_8^2 p_o(w_4^2)
  • p(w83)=pe(w86)+w83po(w86)=pe(w43)+w83po(w43)p(w_8^3) = p_e(w_8^6) + w_8^3 p_o(w_8^6) = p_e(w_4^3) + w_8^3 p_o(w_4^3)
  • p(w84)=pe(w88)+w84po(w88)=pe(w44)+w84po(w44)=pe(1)po(1)p(w_8^4) = p_e(w_8^8) + w_8^4 p_o(w_8^8) = p_e(w_4^4) + w_8^4 p_o(w_4^4) = p_e(1) - p_o(1)

§ Solving the Recurrence: T(n) = n + T(n/2), with T(1) = 1

§ Proof 1:

Expand the recurrence:
= T(n)
= n + 2T(n/2)
= n + 2[n/2 + T(n/4)]
= n + n + 4T(n/4)
= n + n + 4[n/4 + 2T(n/8)]
= n + n + n + 8T(n/8)
= ...
= kn + ... 2^k T(n/2^k)
= (log n)n + 2^(log n) T(n/2^(log n))
= (log n)n + n T(n/n)
= (log n)n + n* 1
= (log n)n + n

§ Proof 2:

Consider the tree:
           8
          mrg:8
   4                 4
   mrg:4           mrg:4
  2     2          2       2
 mrg:2  mrg:2     mrg:2   mrg:2
 1 1    1  1      1   1    1  1
  • Number of leaves is n. Cost of each leaf is T(1) = 1. Total cost of leaf level is n.
  • At each level above, total cost is 8 = 4*2 = 2*4.
  • Number of levels in log n.
  • Total cost is cost of leaf n, plus cost of interior nodes n log n.