So let's get started by reviewing the basic properties of sine waves. So here's a sine wave being plotted against coordinate systems. And I haven't labeled the axes because there are at least two different variables that commonly appear in the arguments of sine waves. In the first case, the sign wave y(t) might be equal to A, an amplitude, times the sin, and then the argument is omega, some frequency, times time plus a phase shift. So here, the variable is time. So, for instance, if we were measuring the pressure, at some particular position in space as a function of time, like in a sound, that pressure might be increasing and decreasing, and increasing and decreasing. So pressure waves pass a single position as a function of time, and so this would be the equation that you use to express that. On the other hand, it could be that we have a sine wave that is some amplitude, and then the argument of the sine function is actually a spacial frequency, which we call k, we typically represent as k, times a spacial variable, x, plus a phase shift. So, for instance, in this case, if we were trying to describe waves in the ocean, for instance, in one instant in time, this variable might be x, positioned along the surface of the ocean, and this might be the height of the ocean, and so the waves go up and down, and so there's these two typical arguments. Now, notice the analogy between this spacial frequency, how fast the sine wave rises and falls as a function of time, and the spacial frequency, which is how often a wave rises and falls, with respect to this time variable. Now to completely specify a sine wave, you need to know four things about it. First, it's direction, then its wavelength or frequency, those are interconvertible, you need to know it's amplitude, and you need to know it's phase shift. So, for instance, if I were to draw coordinate axes and then on that we were going to plot a sine wave, then let's imagine that it's a two-dimensional sine wave traveling through this space in some particular direction. First of all, to specify which sine wave, we need to know what direction. Is it a sine wave going like that? Is it a sine wave moving like that? What direction is the sine wave going? So that's the first thing we need to know. The second thing that we need to know, is what is it's wavelength, or it's frequency. For instance, is it a sine wave with a very long wavelength? Or is it a very quickly oscillating sine wave? The wavelength or frequency has to be known. Next, the amplitude has to be known. Is it a very large sine wave with large amplitude? Or is it a small amplitude sine wave? And finally, we need to know the phase shift. So if one sine wave starts at the origin and oscillates like that, for instance, a phase shifted sine wave might look just like it in amplitude and direction and frequency, but it might be shifted along the axis, and so that's a phase shifted sine wave. So these are the four things you have to know to completely specify a sine wave. Now, let's talk about adding sine waves. So, let's start with the simplest, y=sin(x). And so here's sin(x) being plotted. An amplitude of 1 to -1. And here, these are just radians. Now, another slightly more complicated sine wave could be y=sin(2x). It looks just like this one, except the frequency is twice as fast. So this wave goes through two full oscillations in the time, in the space that this one did one oscillation. Now, another slightly more complicated sine wave is y=sin(3x). So here again, the amplitude is 1. They're all going the same direction. They all start at 0, they have the same phase, but in this case, there's three full oscillations in the space that this one used to do two and this one used to do one oscillation. Okay, now, if we were to just add up these three waves with different weights, so for instance, if we include, if we make a function that is sin(x)- 2.3sin(2x) + 1.8sin(3x), then we get something that looks like this. Doesn't look like a simple sine wave at all, it's more complicated, and yet it oscillates here and you notice that this also has a period. Namely, this pattern that it goes through is exactly repeated. And that period is just the same as the period of this longest wave that's embedded into it. And so, this is adding sine waves, pretty simple. Now, let's do the opposite, which is taking sine wave sums apart. And this is what is called a Fourier decomposition, or a Fourier transform. So, for instance, let's start with this function, and what's being plotted here is hypothetically an electron density as a function of position. You could think of it as electron density across a sample that was being imaged in an electron microscope. And so, the electron density goes from these relatively high numbers, down to zero, and then back up into these high numbers. And, we can imagine that what is being measured here is the electron density across a crystal, meaning that we have the same object here and then we have another copy of that object here, and another copy here, and it goes on infinitely on both sides. Copies of the same object, over and over. So, we have a function of electron density as a function of position. So our goal is to decompose this complex waveform into a series of sine waves, that if we added them up, we would get back to this complex form. So the first sine wave that's present embedded in this, like an ingredient in a recipe, the first ingredient here is actually a sine wave with an infinite wavelength, we call it infinite wavelength, and because of that, the sine wave itself is just flat, straight across. Now, so in this chart, this is the spatial axis like the x-axis, and this is the vertical axis, and so that's the origin. And the reason that this first sine wave with an infinite wavelength is above the 0 position, is because it actually measures the average value, the average density here that's being recorded above. So if you just had one sine wave that you could use to approximate this complicated form, the best one to pick is on that goes right through the middle, which represents the average value. Of the density across that region. Now the next sine wave that's embedded in this complex waveform is called the fundamental, and it's wavelength, it has a wavelength equal to the period of the original function here. You see how this function repeats itself over and over in the same pattern? And so the period here is as a. And so the fundamental frequency is one full oscillation in a box with the size a and so this is the sige wave that we would like to add. Now, one of our questions is, how big of a sign wave should it be? And so we have choose it's amplitude to match the amplitude up and down that we're seeing here. And in addition, we need to choose its phase, whether or not it should shift left or right. So, if we look at the function that we're trying to reproduce, we see that it starts low and it rises and then it goes low again over here. And so, the correct amplitude and phase is to be about this big, centered so that its peak comes in the middle. And that's why this fundamental frequency, we have a peak right in the middle and it has that amplitude. Now the next sine wave that's embedded in there, has a wavelength that is half the size of the original period. Mainly, it oscillates twice across this period, or twice across the box that we're trying to reproduce. And it has this amplitude because, if in this wave, this first component, if we were just to add these up, the first component looks like that. The second component changes this by giving it a bump here in the middle, and so that's getting closer to the original function, but it's still not everything we want. For instance, it is clear that there's some extra density up her that we're missing. There is too much density right there, there's some extra density over here that we're missing. And so it turns out that, the next wave that we should add to try to reproduce the original complex form, is a sine wave with two oscillations across the box, with this small amplitude and shifted so that it will add a little density right here. I've changed colors. So this second wave is going to add density there And it's gonna add density here and it's gonna subtract it in between. And so looking at what that's gonna do, is it's gonna add some density there, and it's gonna add some density there, and it's going to be subtracting it here and here and here. And that turns out to help us reproduce that original function. Now there's another sine wave component in there as well. And here it is. The next sine wave is a wave with a wavelength, which is a third of the box size. In other words, it oscillates three times across that box. And it is chosen in its amplitude and its phase shift, whether it goes left or right, in order to compensate for the deficiencies of these three added up together. And so you can see it's gonna add a little bit of density there, it's gonna add extra density here, here and here. And it turns out that's just what we need to match this little peak, that little peak, and this little peak. And so if you add this wave, this wave, and this wave, and this wave together, you get this wave. So what we mean by a Fourier transform, or a Fourier decomposition is that we take a complex wave form and we decompose it into it's separate sine waves. And we don't have to choose just any sine waves. It turns out that we know which sine waves are always included in a periodic function. It can be decomposed into sine waves with an infinite wavelength. With a wavelength of one wavelength in the period. Or whose wavelength is exactly one period. And a wave whose wavelength is a half of the period. And then others whose wave length is a third of the period, and a fourth, and a fifth, etc. So 48 transformations are decomposing a complicated wave form into a series of simpler sine waves. And the idea can also be understood readily in music and hearing. Let's imagine that you're playing a chord on the piano. And so you may choose a certain set of notes that you're playing for your chord. And you press those keys. Hammers hit strings that have tensions, such that when they are hit, they start oscillating at a certain frequency and all of and those produce pressure waves in the air. Those pressure waves combine in the air and come to your ear as a very complicated pattern of pressure waves. Now in your ear, it turns out that current theory as I understand it, is that your ear does a Fourier transform to decompose that complex pressure wave into its component notes. And this happens in the structure called the Cochlea. Simplified, the Cochlea is a tube that goes to smaller and smaller diameter. And next to this tube there are auditory neurons that are connected at different positions along the tube. And as sound, as pressure waves, let's draw them like this, hit upon the Cochlea, these pressure waves pass through the fluid and it causes a resonant frequencies, resonant signals to be built up at different tube diameters. So some notes cause disturbances at this point in the Cochlea and that causes this auditory neuron to fire. Other notes, for instance, this might have been the low note here. Other notes, further down the tube where the tube is smaller, other notes resonate at different positions along the tube. And they might excite a different auditory neuron down the tube, so maybe that one is this note that's being played. Further down the Cochlea, there may be resonances that excite a neuron down here, and these are the higher notes that are being played. And finally the last residence might be picked up down there and so that's a very high note. So basically, when you play the notes on the piano, the different pressure waves that are produced, add together in space into a single complex pattern. That single complex pattern comes to your ear and your ear decomposes it. Into all the different notes that were present. That's like a Fourier transform, because each of these notes is like a sine wave, and these sine waves can add up in space. A Fourier transform takes a complex pattern and decomposes it into all of the individual sine waves that are present. Now Fourier decompositions may not be exact. It depends on the number of terms that you use, and this is related to the concept of resolution. So let's consider, you might be thinking, okay, I can see how gently increasing and decreasing waves can be decomposed into a series of sine waves. But is this true of all functions? And the answer is that any periodic function can be decomposed into a series of sine waves. The hardest one might be a step function, a function like this that goes immediately from a high value down into a low value. And that doesn't look very much like a sine wave at all, so could we do a Fourier transform of such a step function, and what kind of sine components would it have within it? Well, if I had to approximate that step function, and I only had one sine wave to do it, the sine wave I would choose is one that rose to a maximum and then fell and did a minimum right there, where the step function was at its lowest. Now it's not a very good approximation to the step function, but it's the best I can do with one sine wave. And notice that if a period of the step function is from here to here, because it would repeat itself here, it's a periodic step function, etc. Notice that the first sine wave that I use to try to approximate it also has a wavelength equal to the same distance as the period of that step function. So we'll draw it over here, there's our first approximation of that sine wave. But if I get to use two sine waves to approximate this step function, the next sine wave that I would like to add is this one here. Now why this one? Well, when I look at the first sine wave, the errors that it makes is that it's missing density here, and here, but it has too much density. Actually, so it's missing density there and there and here. But it has too much density here and here and here. So the next sine wave that we should add is this one. This sine wave. It has three wavelengths across the period. And you see it's chosen to reach a maximum here, where we need to add more density in the beginning. And then has a minimum here where we had too much density and we need to reduce it by a little bit. And then it has another maximum here which adds the density that we lacked here. It has a minimum right past halfway across the box, and that will reduce some of the extra. Here it has another maximum, which will give us the extra density that we needed there. And then it has another minimum here, which will help erase some of the extra that we have here. So if we add this first sine wave and now this second sine wave that were added, now the sum of those looks like this. And it is a better approximation to the step function than the first sine wave was. So basically by adding two together, we're getting closer, but there are still problems. When we add two sine waves, now we still have too little density there, too little density here, and too little density there. We have too little density here and here. Meanwhile, we have too much density there and there and there and there and there. So if we're allowed to add yet another sine wave to the mix, which sine wave should we choose? The answer is this wave is the next best to add, this one here. This one has a wavelength so it oscillates five times across the period. And it's just right so that it has a maximum here, to add a little bit more density to try to make up for this problem. Then it has a minimum right here, which will help compensate for the overshoot that existed here. Then it has a maximum to help compensate for the undershoot there, etc., etc. So this wave, if you add this one to this one to this one, now we have three sine waves added together. Now our sum looks like this, and that's getting even closer to the original step function that we had. Now it still isn't perfect. It has some undershoots and some overshoots, but it's looking better. If we're allowed to add yet another sine wave, actually it's not shown explicitly this was three terms, but you can see the pattern. Each additional sine wave that we would add would have two more oscillations within the period. And if we're allowed to add seven different sine waves and choose them just right to compensate for the overshoots and undershoots that the others left, eventually we can get a wave which is the sum of those seven terms that pretty closely matches the original step function. It's still not perfect, but it pretty closely matches it. And the theory is that if we could add an infinite number of sine waves, each with a higher and higher frequency, we could eventually exactly reproduce any wave form that is periodic. So given the theory that we could decompose any periodic function into a series of sine waves which, when added together, would perfectly reproduce the original function. The question arises, how do we know which sine waves to use, and what should their amplitude and phase shifts be? And so here are the formulas, the mathematical details of how those are found. Given any function f(x) that's periodic and continuous, it can be decomposed into a series of sine, and in this case cosine, waves. I'll explain that in a moment. First of all, there is a flat wave, the wave with infinite wavelength that simply gives the average value of the function. And then there are a series of, let's focus on this term first, a series of sine waves. And in order to perfectly reproduce any periodic function we need to be able to include an infinite number of sine waves. So we'll let the summation be from 1 to infinity, an infinite number of sine waves. Each one has its own particular amplitude, here we'll say B sub m. And the argument of the sine function will be 2 pi, a full, in radians, all the way around a phase circle, times m, the index of that sine wave, times the spatial variable x divided by the wavelength. So what this means is that if, for instance, m was equal to 1, cuz it's the first sine wave that we're trying to generate, as x goes from 0 to 1 full wavelength. Wavelength being the period of that original function that we're trying to reproduce. So x will go from 0 to that wavelength. Then the argument of sine, you see, will go from 0 to 2 pi. So if the function that we're trying to reproduce. Looks, I'll try to draw it somewhat similar to the other one we had looked at. Then, this distance is 1 wavelength and x is the coordinate that goes from 0 to 1 wavelength across the box. And as x goes from 0 to a wavelength, this first sine wave when m is equal to 1, the argument will go from 0 to 2 pi. And it'll give us one oscillation. So when m equals 1 that gives us our first sine wave. That has one wavelength across the box. Then when m advances and is 2, that's the second sine wave. And when m is equal to 2, as x goes from 0 to 1 wavelength, I'll change colors, then the argument of the sine will now go from 0 to 4 pi. Meaning that the sine function will oscillate twice. And so that's a wave that is going to have two oscillations across the box. Then when m is equal to 3. We'll change colors again. When m is equal to 3, as x goes from 0 to a wavelength, this argument in total will go from 0 to 6 pi, meaning three oscillations across the box. So that will be a wave that looks like that. And so as m goes from 1 to infinity, what these sine waves are, are sine waves with integral numbers of oscillations across the box going from 1 to infinity. And each one has their own amplitude. What I've told you is that a Fourier transform is to decompose any complex function, periodic function into a series of sine waves. Which sine waves are involved? Well, they're the set of sine waves that have an integral number of wavelengths within the period of the original function. And each one has its own amplitude. In addition to having its own amplitude, saying how much of each wave is present, each one also has its own phase shift, which would slide it back and forth, left or right, as necessary to match the original function that's being decomposed. Now, this phase shift can be introduced either as a phase term, I could have written that equation sine of 2 pi m x over lambda plus some phase shift. In which case, that phase shift and that would be a phase shift sub-m, because each of the sine waves would have its own phase shift and its own amplitude. So I could have written it this way, but it turns out that another way to introduce a phase shift is to add a sine wave and a cosine wave of the same wavelength. And so in this particular formulation, as it's written, instead of each term having its own phase, we write that the original function can be decomposed into a series of cosine waves and sine waves. But these sine and cosine waves are closely related, cuz where m is equal to 1, they each have the same frequency. And in this way of writing it, it turns out that you can find the amplitudes in a pretty straightforward way. The amplitude of each cosine wave in the series is 2 divided by the wavelength, a normalization function, times the integral from 0 to a wavelength, and the variable that we're integrating over is x, dx. So basically, what it means is, we're gonna go from 0 to a wavelength in x, 0 to wavelength dx. And we simply multiply the original function that we're trying to match, that's the f(x). In other words, this original function that we're trying to match, we multiply it at each x position with the cosine wave 2 pi mx over lambda. So in this first case, this first wave here that has one oscillation across the box, we simply integrate the product of the target function with the sine wave we're interested in. And we integrate that from 0 to 1 wavelength. And that times a normalization factor is the coefficient, the amplitude of the cosine wave here. Another way to put it is a sub-m means how much of a cosine wave with one wavelength across the box, how much of this wave is present in this complex function that we're trying to match? Similarly, you can find the coefficients b sub-m as 2 over wavelength, the normalization factor, times the integral from 0 to a wavelength again, times the original function f(x) times the sine wave of interest here. And so a sine wave, I'm gonna show a sine wave is shifted relative to a cosine wave. By 90 degrees, or pi over 4. And so, this second integral just is the product of this target function times a sine wave from 0 to 1 wavelength. And this coefficient turns out to be, how much of this sine wave Is present in the original function that we're trying to reproduce? And it comes out with a coefficient and that's its amplitude. And then, to find the other coefficients, you just increase the index instead of looking at m equals 1, you look at the m equals 2 sine wave. And so if m was equal to 2 here, now, we're going to integrate from 0 to a wavelength, the product of the original function, times a cosine wave with 2 wavelengths across the box. In other words, this red curve. We multiply this red. We integrate the product of the red curve with the blue curve from 0 to 1 wavelength, and that gives us the result, how much of the red curve is present in the blue curve. We can do this for any value of m we like. This is how you find out how much each of these possible component sine waves is present in the original. And you can do this for as high m as you like.