The Discrete Fourier Transform: Useful maths
Contents
- Introduction
- Vectors in 3D real space
- Discrete time signals as N-length complex valued vectors
- Geometric sequences and discrete time signals
- Sine waves from complex phasors
- Geometric series
1 Introduction
A handful of mathematical tools are particularly useful in understanding the structure and use of the Discrete Fourier Transform (DFT). Several of them are gathered together here on a single page.
The other pages within the signals and signal processing section use this page as essential background.
2 Vectors in 3D real space
2.1 Introduction
It can be useful to treat discrete time signals, such as sampled audio signals stored in computer memory, as `vectors’ of numbers. Indeed, much of DSP is based upon the mathematical tools of vectors and Euclidian geometry (sines, cosines, phase angles, , etc).
We begin this page with a quick overview of key metrics used to describe vectors in 3D real space, which will be extended below to arbitrary length discrete time signals.
2.2 The dot product as an inner product
In regular 3D real space, the inner product , between two vectors and , is equivalent to the dot product. It can therefore be obtained by multiplying the lengths of the two vectors together with the cosine of the angle between them
(1)
where || means the Euclidian length of (also referred to as the magnitude of ).
Evaluating via equation 1 will return a scalar number, which will be 0 if the vectors are orthogonal, and nonzero otherwise.
In somewhat loose language, tells us something about how much `overlaps’ , and vice versa (since it can be shown that ).
2.3 Vector norm and length
If we take the inner product of the vector with itself, we obtain
(2)
from which it can be seen by inspection that the `length’ of overlap of with itself, i.e., its effective length regardless of direction, is given by
(3)
which is another way of saying that the length of is the magnitude of (i.e., ).
The quantity is known as the norm of , which for a vector in 3D real space also corresponds to its length (or indeed, magnitude).
3 Discrete time signals as N-length complex valued vectors
3.1 Introduction
Consider -length complex valued discrete time signals, say and , specified at integer sample time indices (the sample rate is not important here). Each signal comprises samples, and therefore runs from .
The signals can be viewed as a pair of -dimensional vectors in space (i.e., each vector has numbers, each of which is, in general, complex valued).
3.2 Inner product for discrete time signals
The inner product between and , which we’ll call , is obtained via
(4)
where denotes the complex conjugate. As with the real space dot product, extension of the inner product to renders a scalar that tells us about the `amount of overlap’ between the signals (albeit that will be complex valued, in general).
Fourier analysis, including the Discrete Fourier Transform, is about examining the `amount of’ a given frequency component within a given signal, so it is not hard to imagine that the inner product may be a useful tool, in due course.
3.3 Discrete time signal energy
If we take the inner product of the signal with itself, we obtain
(5)
The quantity is sometimes referred to as the `total energy’ of the signal, though care is needed in this interpretation, particularly when comparing time domain and frequency domain signal metrics.
It’s also sometimes called the `squared L2 norm’. Notice the conceptual similarity with the real space example in equation 2 above.
3.4 Discrete time signal length and the L2-norm
Analogous with the real space example of equation 3, an -length complex valued discrete signal, , can be thought of as having an -dimensional `length’. This is usually defined in terms of the L2-norm (aka Euclidian norm), , as
(6)
using the definition in equation 5. Sometimes is written as (where the 2 is a subscript, not a superscript), to be explicit that it is the L2-norm, but in general where is written we assume reference to the L2-norm.
Later on we will see how useful it is to have strict definitions of `energy’ and `length’ when it comes to comparing the units of signals expressed in the discrete time vs. discrete frequency domains.
4 Geometric sequences and discrete time signals
4.1 Geometric sequences
Consider an arbitrary number , i.e., a complex valued number with a real and an imaginary part (say, where , and are real valued numbers).
In DSP it is often helpful to define special signals that are expressed as a geometric sequence based upon a single complex number. For example, we might define a discrete time signal as
(7)
where takes on integer values between 0 and , i.e., .
The signal describes a `finite geometric sequence’, where each entry comes from raising the number to an integer power .
4.2 Geometric sequence: Example
As an example, consider the complex number
(8)
which describes a single point on the complex plane, illustrated in Figure 1.
As with any single complex number, can be parameterised by the angle it makes from the positive real axis, (which is in this case), and its distance from the origin (1, in this case). It can also be parameterised in terms of its separate real and imaginary parts. In other words
(9)
which are labelled in Figure 1.
We can use to generate a periodic sequence of numbers by inserting it into equation 7, to produce
(10)
since in this case we have defined , and there are therefore exactly 16 entries in .
It is instructive to examine how the entries in , as defined in equation 10, change with each new value of . Here are the first few values:
(11)
and all 16 values are plotted on the complex plane in Figure 2.
- Starting at we see that takes the value 1, and hence this point lies at a distance of 1 away from the origin along the real axis.
- For , is just our original complex number, , as marked on Figure 1 (the dashed line in Figure 2 is the same as that shown in Figure 1, to emphasise this point).
- For , `jumps’ anticlockwise from where it was at , tracing out another radians in the process.For , `jumps’ another radians, anticlockwise, from where it was at .
- As increments towards , we see that it traces out a series of points that lie along a circle of radius 1, centred at the origin. This special circle is known as the `unit circle’, and is marked in black on Figure 2. It has importance across DSP, well beyond the generation of periodic signals.
In other words, describes a sampled phasor, of magnitude 1, rotating anticlockwise on the complex plane.
Note that if we were to examine , which would correspond to the 17th consecutive value of , we would find that takes on exactly the same value as it did for . We therefore see that the defined in equation 10 is periodic, with a period of exactly 16 samples, since calculating entries for values of simply `plays back’ the same sequence of numbers calculated in the range .
4.3 Roots of unity
The 16 values of calculated via equation 10 are sometimes referred to as the `roots of unity’. In this case, because of the way we defined , there are exactly 16 of them.
Changing the value of to, say, 20, would result in a sampled phasor with 20 unique sample locations, and therefore expressing 20 roots of unity.
In general, a signal defined via
(12)
will express the roots of unity, since raising any of the entries in to the power will result in
(13)
for any integer value of .
Graphically, it is clear from Figure 2 that the sequence , as defined in equation 12, divides the unit circle into `slices’ of equal angular spacing.
5 Sine waves from complex phasors
Although the sampled complex phasor defined in equation 12 seems `complicated’, due to its use of complex numbers, it should be clear from the preceding sections that the mathematics are actually quite simple. This is because complex exponential arithmetic is generally straightforward, particularly in the context of DSP.
Indeed, this is an illustrative example of why is can be useful to undertake certain tasks with a particular representation, even if later converting to a different representation — we’ll see more of this when examining time domain and frequency domain signal representations.
It is natural to ponder whether such expressions are useful in the `real world’. One way to address this is to re-express equation 12 via Euler’s identity, and then take, for example, only the imaginary part (), to generate a new discrete time signal . We can formalise this via
(14)
which demonstrates that taking the imaginary part of the sampled complex phasor will create a sampled sine wave.
Figure 3 illustrates the creation of a sampled sine wave from a sampled complex phasor, via equation 14.
6 Geometric series
Adding together all numbers in the geometric sequence defined in equation 7, from up to , is known as a finite geometric series, and may be written
(15)
If (i.e., is purely real and of value 1), then equation 15 simply reduces to a sum of values of 1, such that
(16)
Crucially, it can be shown that if , equation 15 may instead be expressed as
(17)
which turns out to be very useful in demonstrating key properties of the Discrete Fourier Transform (DFT), amongst other things.
It’s useful because we now have a simple way to add up the values of a finite length discrete time signal, and indeed the product of disctete time signals, whatever the value of the signal.