Vous êtes sur la page 1sur 17

Chapter 3

Convolutions and the Discrete


Fourier Transform
3.1 The Cooley-Tukey Algorithm
Let n = pq, with p, q > 1. Given a vector x of size n, the Cooley-Tukey algorithm computes
DFT
n
(x) = F
n
x in terms of the lower-order transforms DFT
p
and DFT
q
by performing
the following ve steps:
1. Arrange x into a p q matrix X, in row major order;
2. For 0 j q 1, substitute column X
j
of matrix X with DFT
p
(X
j
) = F
p
X
j
;
3. For 0 i p 1, 0 j q 1, multiply the (i, j)-th entry of the matrix by the
twiddle factor
ij
n
;
4. For 0 i p 1 substitute row X
i
of matrix X with DFT
q
(X
i
) = F
q
X
i
;
5. Read out y = DFT
n
(x) by enumerating the entries of the resulting matrix in column-
major order.
For n = 2
k
, the Cooley-Tukey algorithm yields the FFT(x) algorithm seen in class.
Indeed, let n = p q, with p = n/2 and q = 2. Then, the rst step creates the following
1
matrix with n/2 rows and 2 columns:
X =
_
_
_
_
_
_
_
_
_
_
_
x
0
x
1
.
.
.
.
.
.
x
2i
x
2i+1
.
.
.
.
.
.
x
n2
x
n1
_
_
_
_
_
_
_
_
_
_
_
.
Observe that X
0
= x
[0]
and X
1
= x
[1]
, in other words, the two columns separate the
even-indexed entries of x from the odd-indexed entries, as in the Divide step of FFT.
Step 2 of the Cooley-Tukey algorithm requires transforming the columns independently.
Therefore, if
y
[0]
= F
n/2
x
[0]
and y
[1]
= F
n/2
x
[1]
we obtain
X =
_
_
_
_
_
_
_
_
_
_
_
y
[0]
0
y
[1]
0
.
.
.
.
.
.
y
[0]
i
y
[1]
i
.
.
.
.
.
.
y
[0]
n/21
y
[1]
n/21
_
_
_
_
_
_
_
_
_
_
_
,
which corresponds to the Recurse step of FFT. In Step 3 (multiplication by the twiddle
factors), the i-th component of the second column X
1
is multiplied by
i1
n
=
i
n
, yielding
X =
_
_
_
_
_
_
_
_
_
_
_
y
[0]
0

n
0
y
[1]
1
.
.
.
.
.
.
y
[0]
i

n
i
y
[1]
i
.
.
.
.
.
.
y
[0]
n/21

n
n/21
y
[1]
n/21
_
_
_
_
_
_
_
_
_
_
_
.
In Step 4, we transform each row (y
[0]
i
,
n
i
y
[1]
i
). Since
F
2
=
_
_
1 1
1 1
_
_
,
2
the i-th row of X becomes
_
_
1 1
1 1
_
_
_
_
y
[0]
i

n
i
y
[1]
i
_
_
=
_
_
y
[0]
i
+
n
i
y
[1]
i
y
[0]
i

n
i
y
[1]
i
_
_
.
Finally, obtaining the components of y = F
n
x in column major order amounts to say that,
for 0 i n/2 1,
y
i
= y
[0]
i
+
n
i
y
[1]
i
and y
i+n/2
= y
[0]
i

n
i
y
[1]
i
,
which is exactly the recombination performed in the Conquer step of FFT.
Exercise 3.1 Let n = 12, p = 3, q = 4, and let x = (0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1). Com-
pute DFT
12
(x) by applying the Cooley-Tukey algorithm and showing the matrix at the
end of each step.
Answer: Let =
12
= e
i/6
=

3/2 + i/2. On input x = (0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1),


the Cooley-Tukey algorithm executes as follows.
Step 1: Arrange x into a 3 4 matrix, in row major order. We obtain:
X =
_

_
0 0 1 1
1 0 1 0
0 0 1 1
_

_
.
Step 2: Transform columns. We must replace each column X
j
with F
3
X
j
, where F
3
is
based on the third root
3
= 1/2 + (

3/2)i. The result is:


X =
_

_
1 0 3 2

1
2
+

3
2
i 0 0
1
2

3
2
i

1
2

3
2
i 0 0
1
2
+

3
2
i
_

_
.
Step 3: Multiply entry (i, j) by
ij
. Note that the rst column and the rst row will be
left unchanged (multiplied by
0
= 1), and there are several 0-entries in the matrix. In
fact, we only need to compute
3
= e
i/2
= i and
6
= e
i
= 1. The resulting matrix is:
X =
_

_
1 0 3 2

1
2
+

3
2
i 0 0

3
2
+
1
2
i

1
2

3
2
i 0 0
1
2

3
2
i
_

_
.
3
Step 4: Transform rows. Similarly to Step 2, we replace each row X
i
with F
4
X
i
, where
F
4
is based on the fourth root
4
= i. The result is:
D =
_

_
6 2 2i 2 2 + 2i

31
2
+
1+

3
2
i 0
1+

3
2
+

31
2
i 1 +

3i
1

3i
1+

3
2
+
1

3
2
i 0

31
2

1+

3
2
i
_

_
.
Step 5: Read out the transform in column major order. We nally obtain:
DFT
12
(x) =
_
6,

3 1
2
+
1 +

3
2
i, 1

3i, 2 2i, 0,
1 +

3
2
+
1

3
2
i,
2,
1 +

3
2
+

3 1
2
i, 0, 2 + 2i, 1 +

3i,

3 1
2

1 +

3
2
i
_
.
2
3.2 Linear and Cyclic Convolution
Let a and b be two arbitrary vectors of n components. The linear convolution of a and b,
denoted w = a b, is a vector of 2n 1 components such that, for 0 i 2n 1,
w
i
=
min{i,n1}

j=max{0,in+1}
a
j
b
ij
, (3.1)
where the lower and upper bounds in the summation are chosen in such a way that the
indices j and ij always range between 0 and n1. Recall that w
i
is the i-th coecient of
the polynomial of degree bound 2n which is obtained by multiplying the two polynomials
whose coecient representations are a and b. By evaluating the polynomials on the 2n
2n-th roots of unity, pointwise-multiplying the values and interpolating from the resulting
point representation vector, we obtain the following theorem:
Theorem 3.1 (Linear Convolution Theorem) Let a and b be two arbitrary vectors of
n components, and let w = a b. Then
(w|0
1
) = DFT
1
2n
(DFT
2n
(a|0
n
) DFT
2n
(b|0
n
)) ,
where denotes component-wise product, and (x|0
k
) denotes the vector obtained by padding
4
vector x with k zeroes.
Theorem (3.1) gives us a way to compute w in (nlog n) time by applying the FFT
algorithm.
Let us now introduce a new vector operator. For a and b, vectors of n components, we
dene the cyclic convolution (also called wrapped convolution) of a and b, denoted a b,
as a vector z of n components such that, for 0 i n 1,
z
i
=
n1

j=0
a
j
b
(ij) mod n
. (3.2)
Note the similarity between (3.1) and (3.2). However, recall that if a and b have n com-
ponents, then a b has 2n 1 components, while a b has only n components.
Cyclic convolution can be thought of as a wrapped version of linear convolution. To
see this, note that, for 0 i n 1,
z
i
=
i

j=0
a
j
b
ij
+
n1

j=i+1
a
j
b
n+ij
(3.3)
(note that the second summation evaluates to zero for i = n 1). To obtain z
i
, we start
by multiplying, a
0
by b
i
, then a
1
by b
i1
. . . until we multiply a
i
by b
0
. Then, we proceed
by wrapping around vector b and multiplying a
i+1
by b
n1
, a
i+2
by b
n2
and so forth.
Observe the multiplication pattern of the a
i
s and the b
j
s in cyclic convolution:
z
0
= a
0
b
0
+ a
1
b
n1
+ . . . + a
n2
b
2
+ a
n1
b
1
z
1
= a
0
b
1
+ a
1
b
0
+ . . . + a
n2
b
3
+ a
n1
b
2
.
.
.
z
i
= a
0
b
i
+ a
1
b
i1
+ . . . + a
n2
b
i+2
+ a
n1
b
i+1
.
.
.
z
n1
= a
0
b
n1
+ a
1
b
n2
+ . . . + a
n2
b
1
+ a
n1
b
0
5
We can write the above system as z = C(b) a, where
C(b) =
_

_
b
0
b
n1
. . . b
2
b
1
b
1
b
0
. . . b
3
b
2
.
.
.
.
.
. . . .
.
.
.
.
.
.
b
i
b
i1
. . . b
i+2
b
i+1
.
.
.
.
.
. . . .
.
.
.
.
.
.
b
n1
b
n2
. . . b
1
b
0
_

_
Note that the columns of C(b) are obtained as consecutive cyclic right shifts of b. Matrix
C(b) is called a circulant matrix with rst column b. A circulant matrix admits a very
compact representation, since the matrix is uniquely specied by its rst column.
Note that computing w = a b according to the denition takes (n
2
) time. However,
it turns out that we can use the FFT to compute cyclic convolutions in (nlog n) time.
We have:
Theorem 3.2 (Cyclic Convolution Theorem) Let a and b be two arbitrary vectors of
n components, and let z = a b. Then
z = DFT
1
n
(DFT
n
(a) DFT
n
(b)) , (3.4)
where denotes component-wise product.
Therefore, simply computing the DFTs of a and b with no padding, multiplying their
components and then taking the inverse DFT gives us the cyclic convolution of a and b.
Proof: It suces to show that DFT
n
(z) = DFT
n
(a) DFT
n
(b). We have:
(DFT
n
(a))
i
=
n1

j=0
a
j

ij
n
and (DFT
n
(b))
i
=
n1

k=0
b
k

ik
n
,
therefore
(DFT
n
(a))
i
(DFT
n
(b))
i
=
_
_
n1

j=0
a
j

ij
n
_
_
_
n1

k=0
b
k

ik
n
_
=
n1

j=0
n1

k=0
a
j
b
k

i(j+k)
n
. (3.5)
On the other hand, from Equation (3.3) we have:
(DFT
n
(z))
i
=
n1

p=0
_
_
p

s=0
a
s
b
ps
+
n1

s=p+1
a
s
b
n+ps
_
_

ip
n
6
=
n1

p=0
p

s=0
a
s
b
ps

ip
n
+
n1

p=0
n1

s=p+1
a
s
b
n+ps

ip
n
. (3.6)
Let us now show that, for any 0 i n 1, Formulae (3.5) and (3.6) coincide. For this
purpose, it suces to note that each term a

b
m
, with 0 , m n 1, appears only once
in (3.5), multiplied by
i(+m)
n
. In (3.6), if + m < n, then a

b
m
appears only once in
the rst double summation, for p = + m and s = , and multiplied by
ip
n
=
i(+m)
n
. If
+m n, then a

b
m
appears only once in the second double summation, for p = +mn
and s = , and multiplied by
ip
n
=
i(+mn)
n
=
i(+m)
n

in
n
=
i(+m)
n
. The theorem
follows. 2
The following are immediate corollaries of Theorems (3.1) and 3.2.
Corollary 3.1 Let a and b be two arbitrary vectors of n components. Then
(a b|0
1
) = (a|0
n
) (b|0
n
).
Corollary 3.2 Let a and b be two arbitrary vectors of n components. Then
a b = b a = C(b) a = C(a) b
Corollary 3.1 gives us a way to compute w = a b through a cyclic convolution. In
what follows, we investigate the inverse relation: in particular, we will write z = a b as
a function of w.
Recall that
z
i
=
i

j=0
a
j
b
ij
+
n1

j=i+1
a
j
b
n+ij
= z
1
i
+ z
2
i
, (3.7)
for 0 i n 1. Note that z
2
n1
= 0. By making the bounds in the summation explicit,
we can rewrite (3.1) as
w
i
=
_

i
j=0
a
j
b
ij
, for 0 i n 1,

n1
j=in+1
a
j
b
ij
, for n i 2n 2.
(3.8)
7
From (3.7) and (3.8) it immediately follows that z
1
n1
= w
n1
, therefore z
n1
= w
n1
. For
0 i n 2 we have:
z
1
i
= w
i
z
2
i
=
n1

j=i+1
a
j
b
n+ij
=
n1

j = (i + n)
n + 1
a
j
b
(i+n)j
= w
i+n
.
Therefore, for 0 i n 2, z
i
= w
i
+ w
i+n
.
Exercise 3.2 The complex number = e
i/4
=

2
2
+
i

2
2
is an 8-th principal root of unity
in the complex eld.
(a) Compute
i
for i = 0, 1, 2, 3, 4, 5, 6, 7.
(b) Write the Fourier transform matrix F
8
= [
ij
] for i, j = 0, 1, . . . , 7.
(c) Write F
1
8
= (1/8)[
ij
] for i, j = 0, 1, , 7.
(d) Compute X = F
8
x, for x = (1, 0, 1, 1, 0, 0, 1, 1).
(e) Let x = (0, 0, 1, 0, 0, 0, 0, 0) and y = (0, 0, 0, 0, 1, 0, 0, 0). Compute the cyclic convo-
lution z = x y using the denition.
(f) Repeat (e) using the cyclic convolution theorem.
Answer:
8
(a) Let d =

2
2
. We have:

0
= 1
1
= (d + di)

2
= (d + di)
2
= d
2
+ 2
1
2
i d
2
= i

3
=
2
(d + di) = di + di
2
= d + di

4
=
3
(d + di) = d
2
+ (di)
2
= 1

5
=
4
(d + di) = d di

6
=
5
(d + di) =d
2
2d
2
i
(di)
2
= i

7
=
6
(d + di) = di di
2
= d di
E

0
=
8

1
T

2
d
d
d
d ds

3
'

5
c

6
d
d
d
dd

7
6
Imaginary
-
Real
For higher powers
r
with r > 7, recall that
r
=
r mod 8
.
(b)
F
8
=
_

10

12

14

12

15

18

21

12

16

20

24

28

10

15

20

25

30

35

12

18

24

30

36

42

14

21

28

35

42

49
_

_
=
_

_
1 1 1 1 1 1 1 1
1 (d + di) i (d + di) 1 (d di) i (d di)
1 i 1 i 1 i 1 i
1 (d + di) i (d + di) 1 (d di) i (d di)
1 1 1 1 1 1 1 1
1 (d di) i (d di) 1 (d + di) i (d + di)
1 i 1 i 1 i 1 i
1 (d di) i (d di) 1 (d + di) i (d + di)
_

_
9
(c)
F
1
8
=
1
8
_

10

12

14

12

15

18

21

12

16

20

24

28

10

15

20

25

30

35

12

18

24

30

36

42

14

21

28

35

42

49
_

_
=
1
8
_

_
1 1 1 1 1 1 1 1
1 (d di) i (d di) 1 (d + di) i (d + di)
1 i 1 i 1 i 1 i
1 (d di) i (d di) 1 (d + di) i (d + di)
1 1 1 1 1 1 1 1
1 (d di) i (d + di) 1 (d di) i (d di)
1 i 1 i 1 i 1 i
1 (d + di) i (d + di) 1 (d di) i (d di)
_

_
(d)
X = F
8
x = F
8

_
1
0
1
1
0
0
1
1
_

_
=
_

_
1 + 0 + 1 1 + 0 + 0 1 + 1
1 + 0 + i (d + di) + 0 + 0 (i) + (d di)
1 + 0 + (1) (i) + 0 + 0 (1) + (i)
1 + 0 + (i) (d + di) + 0 + 0 i + (d di)
1 + 0 + 1 (1) + 0 + 0 1 + (1)
1 + 0 + i (d di) + 0 + 0 (i) + (d + di)
1 + 0 + (1) i + 0 + 0 (1) + i
1 + 0 + (i) (d di) + 0 + 0 i + (d + di)
_

_
=
_

_
1
(1 + 2d) + (2 2d)i
1
(1 2d) + (2 2d)i
1
(1 2d) + (2 + 2d)i
1
(1 + 2d) + (2 + 2d)i
_

_
10
(e) Let n = 8. Since only x
2
and y
4
are nonzero, the only way x
l
y
(il) mod n
can be nonzero
is when l = 2 and i = 6 (we get the value of l directly; for i, from (i l) mod n = 4, we
get (i 2) mod n = 4, which implies i = 6). Thus, z
6
= x
2
y
4
= 1, while all the other z
i
s
are zero.
(f) First, we note that, since x and y have only one nonzero element each, and that the
element is a 1, F
8
x is column 2 of F
8
and F
8
y is column 4 of F
8
. Now, from the denition
of F
8
, we know that [F
8
]
ij
=
ij
; thus, the i-th element of F
8
x F
8
y is
i2+i4
=
i6
. But
this is exactly column 6 of F
8
! Therefore, multiplying F
1
8
by F
8
x F
8
y we obtain the
column 6 of the identity matrix, namely (0 0 0 0 0 0 1 0), exactly the answer in Part (e). 2
Exercise 3.3 Let n and k be powers of two, with 1 k n. We say that a vector
x = (x
0
, x
1
, . . . , x
n1
) is (n, k)-sparse if x
i
= 0 for i mod k = 0, with 0 i n1. Design
and analyze an algorithm which, on input an (n, k)-sparse vector x, returns DFT
n
(x)
in O
_
n +
n
k
log
n
k
_
time. The cost model must assign unit time to arithmetic operations
between scalar complexes and assignments between scalars.
Answer: We follow a dierent approach than the one seen in class (which used the
Cooley-Tukey algorithm to determine the structure of the transform of an (n, k)-sparse
vector) and, rather, modify the recursive FFT algorithm.
Let x
[0]
= (x
0
, x
2
, . . . , x
n2
) and x
[1]
= (x
1
, x
3
, . . . , x
n1
) be the two n/2-vectors con-
taining, respectively, the even-indexed and odd-indexed components of x. The important
observation upon which we will base our algorithm is the following: if x is (n, k)-sparse,
then x
[0]
is (n/2, k/2)-sparse, while x
[1]
is a 0-vector. Recall that the FFT algorithm
computes DFT
n
(x) by recursively computing DFT
n/2
(x
[0]
) and DFT
n/2
(x
[1]
) and then
performing another (n) additional operations. When invoked on an (n, k)-sparse vector
with k > 1, the algorithm can save one recursive call, since only DFT
n/2
(x
[0]
) must be
computed. Moreover the recombination work becomes straightforward. When k = 1, the
standard FFT algorithm is executed instead. The algorithm follows.
SPARSE FFT(x, k)
n length(x)
if k = 1 then return FFT(x)
x
[0]
(x
0
, x
2
, . . . , x
n2
)
y
[0]
SPARSE FFT(x
[0]
, k/2)
for j 0 to n/2 1 do
y
j
y
[0]
j
y
j+n/2
y
[0]
j
return y
11
Note that at each recursive step, y is obtained as the concatenation of y
[0]
with itself. It
follows that the DFT
n
of an (n, k)-sparse vector is the k-fold repetition of the DFT
n/k
of
the vector containing its n/k components of index ki, with i = 0, 1, n/k 1.
The correctness of the above algorithm follows from the correctness of the FFT algo-
rithm and the observations made above. As for its running time, we can write the following
recurrence in n and k:
T(n, k) = T
_
n
2
,
k
2
_
+ n, n k > 1,
T(n, 1) = (nlog n).
By iterating the above recurrence we obtain:
T(n, k) = T
_
n
2
,
k
2
_
+ n
= T
_
n
4
,
k
4
_
+ n +
n
2
.
.
.
= T
_
n
k
, 1
_
+ n
log k1

i=0
2
i
= O
_
n
k
log
n
k
+ n
_
.
2
Exercise 3.4 Given a vector x = (x
0
, x
1
, . . . , x
n1
), the circulant matrix C(x) is an nn
matrix whose rst column is x, while the remaining columns are obtained as consecutive
cyclic right shifts of x . Design and analyze ecient algorithms for the following problems:
(a) Determining the product of two circulant matrices.
(b) Determining a solution (if any) to the linear system C(x)y = b.
(c) Determining whether C(x) is invertible and, if so, computing its inverse.
12
Answer: Note that
C(x) =
_

_
x
0
x
n1
x
2
x
1
x
1
x
0
x
3
x
2
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
x
n2
x
n3
x
0
x
n1
x
n1
x
n2
x
1
x
0
_

_
,
therefore [C(x)]
ij
= x
(ij) mod n
, for 0 i, j n 1.
(a) Let C(x) and C(y) be two circulant matrices. By the denition of row-by-column
product we have, for 0 i, j n 1,
[C(x) C(y)]
ij
=
n1

s=0
[C(x)]
is
[C(y)]
sj
=
n1

s=0
x
(is) mod n
y
(sj) mod n
.
Let k = (i s) mod n. Note that when s varies between 0 and n1, so does k. Moreover,
s = (i k) mod n. By substituting s with k in the above summation we obtain:
[C(x) C(y)]
ij
=
n1

k=0
x
k
y
((ik) mod nj) mod n
=
n1

k=0
x
k
y
((ij) mod nk) mod n
= (x y)
(ij) mod n
.
This suces to show that the product of C(x) and C(y) yields a circulant matrix C(z),
with z = x y. If circulant matrices are represented by storing only their rst column,
then the representation of their product can be computed in O(nlog n) time using the FFT
algorithm.
(b) Consider the system
C(x) y = b, (3.9)
13
where x and b are arbitrary complex vectors and y is the vector of the unknowns. Observe
that
[C(x) y]
i
=
n1

k=0
x
(ik) mod n
y
k
= (y x)
i
.
Let F
n
be the Fourier matrix of order n, and let X, Y , B denote, respectively, F
n
x, F
n
y
and F
n
b. By the cyclic convolution theorem, System 3.9 is equivalent to the following
system
X Y = B,
where denotes component-wise product. Note that such system consists of n equations,
one for each component of the (unknown) vector Y . For 0 i n 1, the i-th equation
is
X
i
Y
i
= B
i
, (3.10)
hence it contains the single unknown Y
i
. Therefore it immediately follows that
1. The system has one and only solution i X
i
= 0, for 0 i n 1.
2. The system has no solution i there exists an index i such that X
i
= 0 and B
i
= 0.
3. The system has innite solutions i for each index i such that X
i
= 0, then B
i
= 0,
and at least one such index exists.
By the equivalence of Systems 3.10 and 3.9, the above considerations also apply to our
original system. Note that X and B can be computed in O(nlog n) time using the FFT
algorithm, and that the subsequent test (as specied in Points 1..3 above) can be performed
in additional O(n) time.
Consider the case when at least one solution exists and dene Y as
Y
i
=
_
_
_
B
i
/X
i
if X
i
= 0
0 otherwise,
for 0 i n 1. Then, a solution to System 3.9 can be computed in O(nlog n) time as
y = F
1
n
Y .
14
(c) By a well known theorem in linear algebra, C(x) is invertible if and only if the linear
system
C(x)y = b
has one and only solution y C
n
, for any given vector b C
n
. By the results in Part
(b), we can therefore conclude that C(x) is invertible if and only if X
i
= (F
n
x)
i
= 0 for
0 i n 1. Such condition can clearly be tested in O(nlog n) time using the FFT
algorithm to compute X and a linear scan to test that X
i
= 0, for 0 i n 1.
Let us now prove that [C(x)]
1
is itself a circulant matrix. To see this, consider the
system
[C(x)]y = (1, 0, . . . , 0). (3.11)
Since C(x) is invertible, System (3.11) has one and only solution y such that
[C(x)]y = y x = (1, 0, . . . , 0).
Consider now the circulant matrix C (y). We have
C(x) C (y) = C
_
x y
_
= C( (1, 0, . . . , 0) ) = I
n
,
where I
n
is the n n identity matrix. Therefore
[C(x)]
1
= C (y)
by the uniqueness of the inverse matrix. As shown in Part (b), System (3.11) can be solved
in time O(nlog n), therefore the inverse of C(x) can be computed within the same time
bound. 2
Exercise 3.5 Consider the linear convolution u x, where both sequences have length
n and u = (1, 1, . . . , 1). Design an algorithm that performs the above operation in time
O(n).
Answer: Let w = u x. Recall that w has 2n 1 components and that
w
i
=
min{n1,i}

j=max{0,in+1}
u
j
x
ij
=
_

i
j=0
x
j
if 0 i n 1,

n1
j=in+1
x
j
if n i 2n 2.
(3.12)
15
From (3.12) we can easily derive the following two recurrences.
_
_
_
w
0
= x
0
w
i
= w
i1
+ x
i
, 1 i n 1.
_
_
_
w
2n2
= x
n1
w
2n2i
= w
2n2i+1
+ x
n1i
, n 1 i 1.
(Note that both recurrences compute w
n1
). The algorithm is the following:
UNIT LIN CONV(x)
n length(x)
z
0
x
0
z
2n2
x
n1
for i 1 to n 1 do
z
i
z
i1
+ x
i
z
2n2i
z
2n2i+1
+ x
n1i
return z
The program performs exactly 2n 2 additions and therefore runs in linear time. 2
Exercise 3.6 Let n = pq. Let x = (x
0
, x
1
, . . . , x
n1
) be a periodic sequence of period q,
that is, x
i+q
= x
i
, for i = 0, 1, . . . , n 1 q. Let X = (X
0
, X
1
, . . . , X
n1
) = Fx. Prove
that X
k
= 0 unless k is a multiple of p. (Hint: base your argument on the Cooley-Tukey
algorithm introduced in Section 3.1).
Exercise 3.7 Consider the following equation system
x x = y,
where x = (x
0
, x
1
, . . . , x
n1
) is a vector of complex unknowns and y = (y
0
, y
1
, . . . , y
n1
) is
a given vector of complex numbers.
(a) How many solutions has the system? In case the number of solutions is a function
of y, derive this function.
(b) Give an O(nlog n) algorithm that, on input y, outputs one solution to the system,
if one exists.
Exercise 3.8 The complex number
3
= 1/2 +i

3/2 is the principal third root of the


unity in the complex eld.
(a) Evaluate
i
3
for i = 0, 1, 2, 3, 4.
(b) Write the Fourier matrix F
3
.
16
(c) Write F
1
3
(d) Let x = (0, 1, 2). Let y be the cyclic convolution of 8 vectors all equal to x.
Compute y.
Exercise 3.9 Let (X
0
, X
1
, . . . , X
n1
) = DFT
n
(x
0
, x
1
, . . . , x
n1
). Consider now the vector
(Y
0
, Y
1
, . . . , Y
2n1
) = DFT
2n
(x
0
, 0, x
1
, 0, . . . , x
n1
, 0). Write the Y
k
s as a function of the
X
i
s.
Exercise 3.10 Let m and n be two integers, with m n a multiple of n. Describe and
analyze an algorithm to multiply the two polynomials p(x) = a
m1
x
m1
+ a
m2
x
m2
+
+ a
0
and q(x) = b
n1
x
n1
+ b
n2
x
n2
+ + b
0
in time O(mlog n).
17

Vous aimerez peut-être aussi