Lecture 5
Maths with Complex Numbers
The mathematical beauty of ‘i’, the square route of minus 1, is all very well, but what use to us is a number that cannot be calculated? Well in the Fourier Transform, ‘i’ serves a very important purpose indeed. It keeps things separate, and that is exactly what we want from an algorithm that breaks a signal apart into its constituent sine waves. How does ‘i’ keep things separate and how does this help us?
Transcript |
So the mathematical beauty of ‘i’, the square route of minus 1, is all very well, but what use to us is a number that cannot be calculated? Well in the Fourier Transform, ‘i’ serves a very important purpose indeed. It keeps things separate, and that is exactly what we want from an algorithm that breaks a signal apart into its constituent sine waves.
How does ‘i’ keep things separate and how does this help us?
Back in the lecture on Phase, we saw how any phase shifted Sine wave can be made by adding together a non-phase shifted Cosine wave and a non-phase shifted Sine wave at the same frequency but different amplitudes.
If I was to write this down in as a mathematical equation, then my phase shifted Sine Wave which I’m going to call S of theta would be:
S of theta equals A times the cosine of theta plus B times the sine of theta where A is the amplitude of the cosine wave and B is the amplitude of the sine wave and theta is the angle. In the lecture on Euler’s identity, we saw how Euler’s number ‘e’ is related to the Sine and Cosine functions, but we have to multiply the sine part of the equation by the imaginary number i to make the relationship work. We’re now going to use this relationship to create an entirely new type of number called a complex number.
The numbers we have always known up to now, 1, 2, 3 and so on, are made up of only one dimension. We could represent them simply as a distance along a single line. Even minus numbers are points on the same line, they’re just points that go off in the opposite direction. Let’s call these simple numbers for now.
Complex numbers, on the other hand, are made up of 2 dimensions; a real dimension and an imaginary dimension. The real dimension is any simple number, and the imaginary dimension is any simple number, multiplied by ‘i’.
So an example of a complex number is 3 plus 4i. Here is where ‘i’ keeps things separate for us. If this was any sort of normal number, without the ‘i’, 3 plus 4, for example, we could simply add these 2 numbers together to get 7. Like walking 3 units along our line and then continuing to walk another 4. But this is not what we want to do. We want to keep the 3 and the 4 mathematically separate. We want to make sure that we can’t simply add them together. This is what ‘i’ does for us. It forces the imaginary part of the complex number into its own, independent dimension. It changes our simple 1 dimensional world into a more complex world with 2 dimensions, rather like a 2 dimensional graph.
The 3 is in the real dimension, which we plot on the x-axis, and the 4i is in the imaginary dimension which we plot along the y-axis. So a complex number can be represented as a coordinate described by the distances along 2 perpendicular axes. The axes must be perpendicular as only perpendicular lines are truly independent of each other.
That is to say the real number can occupy any value on the x-axis and the imaginary number can occupy any value on the y-axis.
I am now walking around in a 2-dimensional world where any location in that world can be described by a complex number. We call this world the complex plane.
We’re now going to combine all the different principles that we have learned into one set of equations. Here’s how we’re going to do it:
We already have the first equation: 3 plus 4i. This is known as the Cartesian Form of a complex number as it describes the Cartesian coordinate of my complex number point: 3 by 4.
I’m going to use this as the apex of a right-angled triangle similar to those we drew in the phase lecture.
Remember, I could arrive at the same point on my triangle in one of 2 ways, either by walking along the base of the triangle a distance of 3 units then walking up its side a distance of 4 units. Alternatively I could set off on at an angle of about 53.1º, which I calculated using the inverse tangent rule, and walking 5 units along its hypotenuse, which I calculated using Pythagoras’ theorem.
Now the base of the triangle represents the amplitude, A of the of the cosine wave. And the height of the triangle represents the amplitude B of the sine wave.
This produces a sine wave, which I called S of theta, with an amplitude of 5, represented by the length of the hypotenuse of the triangle and a phase shift of 53.1º, represented by the angle of the triangle here.
However, another way of calculating the length of the base of the triangle is to take the Cosine of the Angle and multiply it by the length of the hypotenuse 5 times the cosine of 53.1° equals 3.
Another way of calculating the length of the height of the triangle is to take the Sine of the Angle and multiplying it by the length of the hypotenuse 5 times the sine of 53.1° equals 4.
So I could describe my complex number point another way by writing it in its Polar Form: 5 times the cosine of 53.1° plus 5 times i times the sine of 53.1°.
It’s called Polar Form as in geometric terms, a pole is a point and a polar is a line leading to that point. We can describe this line by its length and its angle. So the polar form of a complex number, rather than giving us the coordinates of a point in the complex plain like the Cartesian form does, gives us the angle and the distance of that point from the origin.
But Euler gave us Euler’s formula which links Euler’s number e, to the Polar Form of a complex number, so we can write our number in yet another form, Exponential Form, using Euler’s number: 5 times e to the i times 53.1°.
We can therefore describe the amplitudes of the Cosine and Sine component A and B of our phase-shifted sine wave, S of theta in 3 different ways.
We could describe them in Cartesian Form using the distance we walked along the x and y-axes to describe the coordinates of the apex of the triangle in the complex plane, 3 plus 4i, which are the amplitudes A of the cosine wave, and B of the sine wave, respectively.
We could describe them in Polar Form using the length of the hypotenuse and the angle of the triangle which corresponds to the amplitude and phase shift of S of theta.
and finally Euler showed us that by using his formula, we can describe them in Exponential form as 5 times e to the i times 53.1°.
So 5 times e to the i times 53.1° is equal to 5 times the cosine of 53.1° plus 5 times i times the sine of 53.1° which is equal to 3 plus 4i.
What use it this set of equations to us?
Well firstly, using the Cartesian form, we can easily see the amplitudes of the cosine and sine waves the make up our phase-shifted wave. Using the exponential form we can easily see the amplitude and the phase shift of the resultant wave and using the polar form we can convert from the Exponential form into the Cartesian form.
So complex numbers give us an easily readable definition for each sine wave making up our signal.
Secondly, the Fourier transform involves rather a lot of mathematical operations which would be fiddly to do if we had to write each sine wave out in full. By choosing the most convenient of the 3 different forms of actually writing the equation of our sine wave down, we can do these mathematical operations more easily. Let’s do an example.
The two operations that we’re going to need to do again and again in the Fourier Transform are Adding and Multiplying so let’s first add together 2 complex numbers.
Let’s add 3 plus 4i and 9 plus 2i together. To do this we need to group together the real and imaginary parts of the number: The 3 and 5 are real so we group those together. The 9 and 2 are both multiplied by i so they are imaginary. So let’s rewrite the sum as 3 plus 9 plus 4i plus 2i. Well that’s easy to do, 3 plus 9 is twelve and 4i plus 2i is 6i so the result is 12 plus 6i.
Subtraction is just as easy. Let’s subtract 9 plus 2i from 3 plus 4i. Again we group together the real and imaginary terms: 3 minus 9 is minus 6 and 4i minus 2i is 2i. So the result is minus 6 plus 2i.
How about if we were to multiply the 2 complex numbers from the previous example? 3 plus 4i times 9 plus 2i. Well it’s just like multiplying brackets, we use the FOIL method. Foil stands for First, Outside, Inside, Last. We have to multiply the numbers together in 4 stages.
Stage 1, we multiply the 2 first terms in each bracket 3 times 9 equals 27. Stage 2, we multiply the 2 outside terms 3 times 2i equals 6i. Stage 3, we multiply the 2 inside terms 4i times 9 equals 36i. Stage 4, we multiply the 2 last terms in each bracket 4i times 2i equals 8i squared, but remember that i squared equals mins 1 so the answer to this last stage is minus 8.
So this all gives us 27 plus 6i minus 8 plus 36i. Now we group the real and imaginary terms just as we did before when we were adding 27 minus 8 and 6i plus 36i which gives us the result: 19 plus 42i.
However, when multiplying, it could be easier to express the 2 complex numbers in exponential form because then we could multiply them together using the exponential product rule.
The exponential product rule states: To multiply 2 exponential numbers, simply add together their indices:
e to the a times e to the b equals e to the a plus.
Let’s leave Euler out of it a second take a simple example:
If I want to multiply 2 to the power 3 by 2 to the power 4, all I have to do is to add together the 3 and the 4 to get the answer. 2 to the power 3 times 2 to the power 4 equals 2 to the power 3 plus 4 which is equal to 2 to the power 7.
Let’s look at why this is true: 2 to the power 3 equals 2 times 2 times 2. 2 to the power 4 equals 2 times 2 times 2 times 2. If I write this out in full, to multiply the two numbers together, I simply do 2 times 2 times 2 times 2 times 2 times 2 times 2. If I count up all the twos, you can see why this is the same as writing 2 to the power 7.
Now the 2 could be any number, Euler’s number for example. So exactly the same method works for 3 plus 4i times 9 plus 2i if we write them out in exponential form. To do this, we use Pythagoras and the Inverse Tangent Rule.
So for 3 plus 4i: Pythagoras gives us the root of 3 squared plus 4 squared equals 5. The Inverse Tangent Rule give us inverse tan of 4 divided by 3 is roughly equal to 53.1º.
For 9 plus 2i: Pythagoras gives us the root of 9 squared plus 2 squared is roughly equal to 9.2 and the Inverse Tangent Rule give us inverse tan of 2 divided by 9 is roughly equal to 12.5º.
So we can rewrite the multiplication in the form: 5 times e to the power of 53.1º times i times 9.2 e to the power of 12.5º times i. The 5 and the 9.2 we multiply as normal giving us 46. The 53.1º and the 12.5º we add together giving us 65.6º. Which gives us the result 46 times e to the power of 65.6º times i.
We can use the Polar form to convert this back into Cartesian form and show that the two methods give the same answer: 46 times the cosine of 65.6º is equal to 19 and 46 times i times the sine of 65.6º is equal to 42i.
Now let’s try to divide 3 plus 4i by 9 plus 2i. How about, if we tried to use the FOIL method to divide the numbers? This time we really hit a problem. Look what happens: Dividing the 2 first terms in the brackets, 3 divided by 9, is no problem as that just gives us a third; no it’s the outside terms that are the difficult ones as look what happens to the i. If we divide the 2 outside terms, 3 divided by 2i, the i ends up on the bottom as the denominator. This makes things very awkward. We’ve already had enough trouble with i being the square root of minus 1 let alone having to introduce a new term to cope with 1 over the square root of minus 1. If only there was some trick we could use to get the i out of the denominator. Well as it happens, there is. We use something called the complex conjugate.
The complex conjugate is a nifty little number. Any complex number multiplied by its complex conjugate, gives us a real number as the result. No i’s to worry about.
To get the complex conjugate of any complex number, we simply change the sign of the between the real and imaginary parts. So, for example, the complex conjugate of 9 plus 2i is 9 minus 2i. Now if we multiply these 2 numbers together using FOIL: 9 times 9 equals 81. 9 times minus 2i equals minus 18i. 2i times 9 equals 18i and 2i times minus 2i equals minus 4i squared. But I squared equals minus 1 so minus 4i squared equals minus 4 times minus 1 which simply equals 4.
So grouping these terms together gives us: 81 minus 18i plus 18i plus 4. The minus 18i and 18i cancel each other out leaving us with no i’s so we are simply left with 81 plus 4 which equals 85, a totally real result.
So how do we use this trick in our division calculation?
What we can do is to multiply both the 3 plus 4i and the 9 plus 2i by 9 minus 2i. We can do this as 9 minus 2i divided by 9 minus 2i is equal to 1. So all we have done is multiplied our original calculation by 1 which doesn’t affect the result. However, what it does do, is to allow us to use FOIL on both the numerator and the denominator. We already calculated the denominator as 9 minus 2i is the complex conjugate of 9 plus 2i which we worked out before simply equaled 85. So without changing the outcome of the calculation at all, we have managed to get the i out of the denominator and can now treat the rest of the calculation as a multiplication.
So using FOIL: 3 times 9 equals 27. 3 times minus 2i equals minus 6i. 4i times 9 equals 36i and 4i times minus 2i equals minus 8i squared or simply 8 as i squared equals minus 1. This makes 27 minus 6i plus 8 plus 36i. If we rearrange this, grouping the real and imaginary terms, we get: 27 plus 8 minus 6i plus 36i which gives us: 35 + 30i.
So now we are left with the result: 35 + 30i over 85. But we are used to seeing complex number written with a real part and an imaginary part, so let’s rewrite this expression slightly: 35 over 85 plus 30 over 85i, or if we actually work out the division: 0.41 plus 0.35i.
Although the FOIL method does allow us to get to an answer when dividing 2 complex numbers, we had to work very hard to get there. It is here that writing our 2 complex numbers in their exponential form really comes into its own.
If we rewrite our calculation, using the exponential form of the 2 complex numbers like we did when we multiplied them before, we can use a similar method to divide them.
When multiplying, we first multiply the 5 and the 9.2. Now that we are dividing, we simply divide them instead, giving us the answer 0.54. When multiplying, we added the 53.1º and the 12.5º, now that we are dividing, we simply minus them instead, giving us 40.6º. This gives us the overall result: 0.54 times e to the 40.6º times i. Using the polar form we can convert this back into the Cartesian form which gives us: 0.54 times the cosine of 40.6º plus 0.54 times i times the sine of 40.6º which gives us the result 0.41 plus 0.35i. The same we got before, but arrived at with much greater ease.
So the imaginary number “i” and the world of complex numbers gave Fourier a notation, a mathematical language which he could use to do his calculations. However, although complex numbers gave Fourier a way of describing mathematically what he was trying to do, a notation is only an alphabet, a set of individual letters. He still had to join these letters up to form the words and sentences he needed to describe his theory. In the next lecture, we’re going to find out how the Fourier Transform actually works. We’re going to learn all about Convolution.
Podcast
Support the course
Would you like to learn about how the Fourier Series became the Fourier Transform, how the DFT and FFT work and what Windowing is? Please help me to devote more time to filming the rest of the video course by supporting me on Patreon.
...or via PayPal
...or a coffee would be much appreciated.
Keep in touch
Receive updates on the continuing production of the course, get notified when there is a new post or video and be the first to know when the full course goes live.
Click here to subscribe