The Discrete Fourier Transforms (DFTs) of cosine and sine waves have particularly simple analytical expressions.
Table of contents
Let
be an
vector.
The Discrete Fourier
Transform of
is another
vector
whose entries
satisfy
where
is the imaginary unit.
We can use the DFT to obtain the frequency-domain representation
To derive the DFT of the sine and cosine functions, we will use the following properties.
For any angle
,
we
have
Since the period of the trigonometric functions is
,
we
have
for
any integer
and any angle
.
Finally, we
have
Let us start from a cosine
wave:where
.
The number
of cycles per
samples (frequency) is assumed to be a positive integer less than
.
The cosine wave can be written
aswhich
implies that its Discrete Fourier Transform
is
We can
writewhich
is a frequency-domain representation of
as a linear combination of periodic basis functions. The two basis functions
belong to the set of basis functions used in the DFT. Since the
representation of a vector
as a linear combination of a basis is unique, the coefficients of the
linear combination inside the square brackets must be the values of the
discrete Fourier transform. They are all equal to
,
except those corresponding to the frequencies
and
,
which are equal to
and
respectively.
Consider the sine
wave:where
.
The number
of cycles per
samples is again assumed to be a positive integer less than
.
The sine wave can be written
aswhich
implies that the Discrete Fourier Transform
is
We
havewhich
is a frequency-domain representation of
as a linear combination of DFT basis functions. Therefore, the coefficients of
the linear combination inside the square brackets are the values of the DFT
(see also the previous proof). They are all equal to
,
except those corresponding to the frequencies
and
,
which are equal to
and
respectively.
Since the DFT is a linear operator, we can use its linearity to easily derive the DFT of linear combinations of sine and cosine waves.
Example
Let
and
be positive integers, with
.
Let the entries of
be defined
by
Then,
the DFT of
is
Let us now analyze the case of a shifted cosine
wave:where:
;
is a positive integer less than
;
the phase
satisfies
.
The Discrete Fourier Transform
is
We can derive the frequency-domain
representation of
as follows:
As
in the previous proof, we can easily read the values of the DFT from the
frequency-domain representation: all the values of the DFT are equal to
,
except those corresponding to the frequencies
and
,
which are equal to
and
respectively.
Similarly, we can analyze a shifted sine
wave:where:
;
is a positive integer less than
;
the phase
satisfies
.
The Discrete Fourier Transform
is
We can derive the frequency-domain
representation of
as follows:
As
in the previous proofs, we can read the values of the DFT from the
frequency-domain representation: all the values of the DFT are equal to
,
except those corresponding to the frequencies
and
,
which are equal to
and
respectively.
What happens
whenor
but the frequency parameter
is not an integer?
In other words, what happens when the sine or cosine waves have frequencies that do not belong to the set of analysis frequencies used to compute the DFT?
What happens is that the neat results presented above (DFT is zero everywhere
except at the frequencies
and
)
are no longer valid.
When
is not integer, the DFT can be non-zero everywhere, although it tends to be
larger in magnitude around the frequencies
and
.
This phenomenon is known as spectral leakage.
As an example, we set
,
and
.
Then, we compute the DFT
and its
amplitude
spectrum
The amplitude spectrum, displayed in the next plot, clearly shows that
although the amplitudes are large around the
and
frequencies, there is leakage to all the other frequencies.
Please cite as:
Taboga, Marco (2021). "Discrete Fourier transform of cosine and sine waves", Lectures on matrix algebra. https://www.statlect.com/matrix-algebra/discrete-Fourier-transform-of-cosine-and-sine.
Most of the learning materials found on this website are now available in a traditional textbook format.