 This is the Fourier transform, this is the complex exponential, and this is the square root of minus one, otherwise known as i. This is what the exponential function looks like without the i, and this is what it looks like with the i. A complex exponential is a spiral. Using the complex exponential, the Fourier transform transforms almost any signal from the time domain into the frequency domain. But what is a spiral doing in the Fourier transform equation? We'll just look at this. If I look at the complex exponential from this angle, it's a cosine wave. And if I look at it from this angle, it's a sine wave. It's a sine wave. In the last video, we discovered how the Fourier transform uses convolution to find out which sinusoid your signal is built out of. Cosine waves and sine waves are sinusoids. But what are they both doing in the equation? And how does the imaginary number i help the Fourier transform take a convolution shortcut? Hi, I'm Mark Newman, and this challenge is all about helping you understand the fascinating world of signals and systems. For centuries, i, or the square root of minus one, was a concept that mathematicians just couldn't accept. The need for such a number can be traced back as far as the 15th century, and Luca Paccioli, Leonardo da Vinci's maths teacher, who was trying unsuccessfully to solve a 4,000 year old problem to find a general solution to the cubic equation. He finally gave up declaring the problem impossible in his 1494 publication, Summa di Arithmetica. A solution was eventually found by another Italian, Girolamo Cardano, which he published in his 1545 book, Arles Magna. However, while he was writing it, he came across a few cubic equations that could not be solved in this way, as the solution involved the square root of minus numbers. He assumed that this was math's way of saying that for certain problems, no solution existed. But in his 1572 book, Algebra, the Italian engineer Raphael Bombelli showed a solution to the problem did exist, and there was a way of using the square root of negative numbers by viewing them not as part of the solution, but simply as a step along the way. A sort of catalyst, and arranging the problem so that in the eventual solution, they cancelled out. However, for the next 200 years, the square root of minus 1 was treated with suspicion by mathematicians. In the 17th century, Leonardo Calt, the father of the Cartesian coordinate system, completely fed up with the very idea, even gave it a name, which summed up what he felt about it, an imaginary number, he called it. But then in 1748, Leonardo Euler, building on the work of British physicist and mathematician Roger Coates 20 years earlier, proposed what is now known as Euler's formula, and imaginary numbers finally became more widely accepted amongst mathematical fraternity. If you're interested in a more complete history of how I was discovered, I've included a link in the description to a really good video on the subject. But what is I? I asked my signals and systems lecturer one day. It's the square root of minus 1. He replied as if that explained everything. But how can a negative number have a square root? I protested. It can in the imaginary dimension. I just didn't understand. What was this imaginary dimension? Perhaps it was some sort of weird science fiction dimension like they have in the movies. I needed an analogy, something to liken it to in the real world. But unfortunately, no such analogy was forthcoming. It wasn't until years later when I was researching for a transform for a project at work that I came across the notion of looking at the problem geometrically. Just as there are four mathematical operators, addition, subtraction, multiplication, and division, so there are four geometric transformations, translation, scaling, reflection, and rotation. The four mathematical operators can be applied in the world of geometry to perform the four transformations. Addition and subtraction can be used to translate an object. Addition moves the object to the right, and subtraction moves it back to the left again. Multiplication and division can be used to scale an object, making it larger or smaller. But multiplication and division are quite powerful operators in the world of geometry. As they can perform more transformations than just scaling. For example, if we scale an object by multiplying it by minus one, we can reflect that object. What about squaring a number? Whenever we square a number, we could think of it as starting out with the unit square, that's a square whose length and height are both one, and applying the same multiplication twice to that unit. So, if I wanted to represent two squared, I scale the unit square by two, and then by two again. What happens if I wanted to represent minus two squared? Again, we start with our unit square, only this time I'm scaling it by minus two. The minus sign reflects the object, and the two scales it. Then, because we are squaring, I have to do the same again. The minus sign reflects the object, and the two scales it. This is one way of understanding why any negative number squared always gives a positive result. The two reflections always mean the object ends up back in the positive domain of numbers. If this is true, how can anything squared ever equal minus one? In other words, if we ask the same question in a geometric way, what transformation can we perform twice to get from here to here using multiplication? Scaling doesn't help us, and neither does reflection, as the squaring operation always ends up reflecting the object back into the domain of positive numbers. Translation can only be done with additional subtraction, so what's left? Only rotation. I can rotate the object once by 90 degrees, and then again by another 90 degrees. The same transformation repeated twice, just as the squaring operation requires. Hey, where did my shape go on that first 90 degree rotation? We're used to living in a world of four dimensions. The position of any object in our world can be described by three spatial coordinates x, y, and z, and a fourth coordinate, which is time. However, in the abstract world of maths, we can have as many dimensions as we like. The only problem is we sometimes have trouble representing them when we try to draw them on a two-dimensional piece of paper. So, as we only have three spatial dimensions to play with, we're going to have to borrow one of those dimensions to represent this strange new dimension. Any number in the imaginary dimension is known as an imaginary number, and is given the symbol i. So, just as we have one, two, and three, etc., on the x and y axes, we have i, two i, and three i, etc., on the imaginary axis. In geometric terms, just as multiplying by minus one can be thought of as a reflection, so multiplying by i can be thought of as a rotation via the imaginary axis. So, if I want to use a squaring operation to transform my unit square so that its length is minus one, I have to multiply it by i to rotate it by 90 degrees, and then by i again to rotate it by another 90 degrees. Therefore, i squared is a rotation of 180 degrees via the imaginary axis, which equals minus one, and that is why i is the square root of minus one. But what does i and the imaginary axis have to do with a Fourier transform, and why is it in the equation? Well, it all depends on which shape we draw. Squares are all very nice, but what if I were to draw another shape instead? What about a spiral? A complex exponential, in fact. It's called complex because depending on which angle we look at it, it can be more than one thing. Floating out here in 3D space, where I can see both the real imaginary and angular dimensions, it looks like a spiral. But if I shift my view so I can see only the angle plotted against the real axis, the spiral becomes a cosine wave. Shifting my view again so I can see only the angle plotted against the imaginary axis, the spiral becomes a sine wave. So the complex exponential contains within it both a cosine wave and a sine wave, and that is what Euler's formula is saying. The i tells us that in order to see the whole picture, we have to shift our viewpoint so that we can see both the real and imaginary axes. Now here's why the complex exponential is present in the Fourier transform. Remember at the end of the last video, I compared the Fourier transform equation to the convolution equation, saying that they shared certain similarities. If you missed it, I've linked the video in the description below. I also set you a challenge. Which term in the Fourier transform equation is equivalent to the f of tau term, and which term is equivalent to the g of tau term? Well here's the answer. The f of tau term in the convolution equation is the signal, which is equivalent to the x of t term in the Fourier transform. This means that the g of tau term in the convolution equation must be the complex exponential in the Fourier transform. In the convolution equation, I used a simple sinusoid as an example of g of tau, and slid it over the signal. Now here's the cool thing. The complex exponential saves us having to slide a sinusoid over the signal. How does it do this? Let's forget imaginary numbers and complex exponentials for a second, because all the complex exponential really is, is a convenient way of packaging together a cosine wave and a sine wave, both with the same frequency, into one convenient expression. So let's take them out of the box and start playing with them. What happens if I add together a cosine wave and a sine wave? They produce a sinusoid of the same frequency, but a different phase. Now if I control the amplitudes of the cosine wave and the sine wave carefully, the amplitude of the sinusoid remains constant while its phase keeps changing. I've made a sliding sinusoid out of a static cosine wave and a static sine wave by just varying their amplitudes. Let's reset the amplitude of the cosine and sine waves again, and go back to the convolution equation. This time, I'm going to use the cosine wave as the G of tau term, and I'm going to set T to zero, and keep it still, leaving me with G of minus tau. Minus tau simply means we need to reverse the cosine wave. Cosine waves are symmetrical, so reversing them doesn't really make any difference, but I'll keep the minus sign in for now for reasons that will become clear in a moment. To perform the convolution with the cosine wave, we multiply it by the signal and integrate. Here's the answer. I'll put this value aside. Now let's use the sine wave as the G of tau term. Again, I'm going to keep it still so T is zero. But look what the minus sign does to the sine wave. It reverses it. This time, because the sine wave is not symmetrical, the minus sign does make a difference, which is why I kept it in before. So to perform the convolution with the sine wave, we multiply it by the signal and integrate. And here's the answer. So now I have two answers, the cosine answer and the sine answer. But I want to know how much a sinusoid of this frequency contributes to the signal. What do I do with the two answers? Remember that when we add together a cosine wave and a sine wave with the same frequency but different amplitudes, we get a phase shifted sinusoid? Well, these two answers are the amplitudes of the cosine and sine waves I need to produce the sinusoid, which, when convolved with the signal, will give me the maximum score for this frequency. So instead of having to perform multiple convolutions as I slide G of tau over the signal, I only need to perform two. One with the cosine wave and one with the sine wave. This is the convolution shortcut which using I in the complex exponential allows us to take. What is more, by using Pythagoras on these two numbers, I can calculate a value that is proportional to the magnitude of the contribution of the sinusoid to the overall signal. And by performing a four quadrant inverse tangent function on these two numbers, I can calculate the phase. Repeating this operation again and again using complex exponentials at lots of different frequencies enables us to plot a graph of each frequency, how much it contributes to the signal, and what its phase is. This is the Fourier transform for this signal. However, there is still one middle point that I've glossed over. We've seen how the Fourier transform uses convolution by multiplying the signal by the complex exponential, which is just a packaged up cosine wave and sine wave. We've also understood that it is I that enables the exponential function to be that package. But what is this minus sign doing here? This comes from the fact that the convolution equation requires us to reverse the signal, as I explained in the last video. Remember G of minus tau? Where is this as no effect on the cosine term? It does affect the sine term, which reverses thereby flipping the spiral of the complex exponential, and Euler's formula changes from this to this. So here's your challenge for this video. Computers cannot run the Fourier transform. There are just too many infinities in the equation. So they run an efficient version of the discrete Fourier transform called the fast Fourier transform. Knowing what we do now about how the Fourier transform tests signals with complex exponentials at lots of different frequencies, how does the Fourier transform know which frequencies to test? After all, it cannot test every frequency in existence, can it? You'll find the answer in the next video. When we learn how to interpret the output of the fast Fourier transform. If you'd like to learn more about Euler's formula and Euler's identity, then check out this video here.