# Differential Equations: Finding Particular Solutions via Fourier Series

## Finding Particular Solutions via Fourier Series

**Transcript:**

I'd like to talk. Thank you. One of the things I'd like to give a little insight into today is the mathematical basis for hearing. For example, if a musical tone, a pure musical tone would consist of a pure oscillation in terms of the vibration of the air. It would be a pure oscillation. So, [SINGS], and if you superimpose upon that, suppose you sing a triad, [SINGS], those are three tones.

Each has its own period of oscillation, and then another one, which is the top one, which is even faster. The higher it is, the faster the thing. Anyway, what you hear, then, is the sum of those things. So, C plus E plus G, let's say, what you hear is the wave form. It's periodics, still, but it's a mess. I don't know, I can't draw it. So, this is periodic, but a mess, some sort of mess. Now, of course, if you hear the three tones together, most people, if they are not tone deaf, anyway, can hear the three tones that make up that.

So, in other words, if this is the function which is the sum of those three, some sort of messy function, f(t), you're able to do Fourier analysis on it, and break it up. You're able to take that f of t, and somehow mentally express it as the sum of three pure oscillations. That's Fourier analysis. We've been doing it with an infinite series, but it's okay. It's still Fourier analysis if you do it with just three.

So, in other words, the f(t) is going to be the sum of, let's say, sine, I don't know, it's going to be the sign of one frequency plus the sine of another frequency plus the sine of a third, maybe with coefficients here. So, somehow, since you were born, you have been able to take the f(t), and express it as the sum of the three signs. And, here, therefore, the three tones that make up the triad. Now, the question is, how did you do that Fourier analysis? In other words, does your brain have a little integrator in it, which calculates the coefficients of that series? Of course, the answer is no.

It has to do something else. So, one of the things I'd like to aim at in this lecture is just briefly explaining what, in fact, actually happens to do that. Now, to do that, we'll have to make some little detours, as always. So, first I'm going to, throughout the lecture, in fact, I gave you last time a couple of shortcuts for calculating Fourier series based on evenness and oddness, and also some expansion of the idea of Fourier series where we use the different, but things didn't have to be periodic or period two pi, but it can have an arbitrary period, 2L, and we could still get a Fourier expansion for it.

Let me, therefore, begin just as a problem, another type of shortcut exercise, to do a Fourier calculation, which we are going to be later in the period to explain the music problem. So, let's suppose we're starting with the function, f(t), which is a real square wave, and I'll make its period different from the one, not two pi. So, suppose we had a function like this. So, this is one, and this is one. So, the height is one, and this point is one as well. And then, it's periodic ever after that. I'll tell you what, let's do like the electrical engineers do and put these vertical lines there even though they don't exist. Okay, so the height is one and it goes over. The half period is one. This really is a square wave. I mean, it's really a square, not what they usually call a square wave.

So, my question is, what's its Fourier series? Well, it's neither even nor odd. That's a little dismaying. It sounds like we're going to have to calculate an's and bn's. So, the shortcuts I gave you last time don't seem to be applicable. Now, of course, nor is the period two pi, but that shouldn't be too bad. In fact, you ought to look for an expansion in terms of things that look like sin(n), well, what should it be? Since L is equal to one, the half period is equal to one. Remember, the period is 2L, not L. It's n pi over L, but if L is one, we should be looking for an expansion in terms of functions that look like this. Now, since we've already done the work for the official square way, which looks something like this, what you always try to do is reduce these things to problems that you've already solved.

This is a legitimate one, since I solved it in lecture for you. So, we can consider it as something we know. So, I observed that since I am very lazy, that if I lower this function by one half, it will become an odd function. Now it's an odd function. Okay, I just cut the work in half. So, let's call this function, let's call this, I don't know, S(t). The green one is the one we wanted to start with. So, f(t) is a green function. But, I can improve things even more because the function that we calculated in the lecture is a lot like this salmon function. That's why I called it S. But, the difference is that the function we calculated with this one. In the first place, it went down further.

It went not to negative one half, which is where that one goes. But, it went down to negative one, and then went up here to plus one. And, it went over to pi. So, it came down again, but not, but at the point, pi. And here, negative pi went up again. Okay, let me remind you what this one was. Suppose we call it, O doesn't look good, I don't know, how about g(u)? Let's, for a secret reason, call the variable u this time, okay? So, the previous knowledge that I'm relying on was that I derived the Fourier series for you by an orthodox calculation. And, it's not too hard to do because this is an odd function. And therefore, you only have to calculate the bn's.

And, half of them turn out to be zero, although you don't know that in advance. But anyway, the answer was 4 / pi times the sum of just the odd ones, the sin(nu) / n. So, this is the expansion of g, this function, g of u, the Fourier expansion of this function. Since it's an odd function, it only involves the signs. There's no funny stuff here because the period is now two pi. And, this came from the first lecture on Fourier series, or from the book, wherever you want it, or solutions to the notes. There are lots of sources for that. The solution's in the notes. Okay, now, that looks so much like the salmon function, ---

-- I ought to be able to convert one into the other. Now, I will do that by shrinking the axis. But, since this can get rather confusing, what I'll do is overlay this. What I prefer to do is I think u, okay, I'm changing, I'm keeping the thing the same. But, I'm going to change the name of the variable, the t, in such a way that on the t-axis, this becomes the point, one. If I do that, then this function will turn exactly into that one, except it will go not from minus a half to a half, but it will go from negative one to one, since I haven't done anything to the vertical axis. So, how I do that? What's the relation between u and t? Well, u is equal to pi times t, or the other way around. You know that it's going to be approximately this. Try one, and then check that it works. When t is equal to one, u is pi, which is what it's supposed to be.

So, this is the relation between the two. And therefore, without further ado, I can say that, let's write the relation between them. f(t) is what I want. Well, what's f of t if I subtract one half of that? So, that's going to be equal to the salmon function plus one half, right, or the salmon function is f of t lowered by one half. One thing is the same as the other. And, what's the relation between this salmon function and the orange function? Well, the salmon function is, so, let's convert, so, S(t) -- it's more convenient, as I wrote the formula g(u). Let's start it from that end. If I start from g of u, what do I have to do to convert it into S of-- into the salmon function?

Well, take one half of it. So, if I put them all together, the conclusion is that f(t) = 1/2 + S(t), which is 1/2 g(u), but u is pi t. So, it's, 4 / pi * sum(sin(n)). And, for u, I will write pi t / n. And, sorry, I forgot to say that sum is only over the odd values of n, not all values of n. So, the sum over n odd of that, and, of course, the two will cancel that. So, here we have, in other words, just by this business of shrinking or just stretching or shrinking the axis, lowering it and squishing it that way a little bit.

We get from this Fourier series, we get that one just by this geometric procedure. I'd like you to be able to do that because it saves a lot of time. Okay, so let's put this answer up in, I'm going to need it in a minute, but I don't really want to recopy it. So, let me handle it by erasing. So, let's call that +2 / pi, and there is our formula for that green function that we wrote before. So, I'll put that in green. So, we'll have a color-coded lecture again. Now, what we're going to be doing ultimately, to getting at the music problem that I posed at the beginning of the lecture, is we want to solve, and this is what a study of Fourier series has been aiming at, to solve second-order linear equations with constant coefficients were the right-hand side was a more general function than the kind we've been handling.

So, now, in order to simplify, and we don't have a lot of time in the course, I'd have to take another day to make more complicated calculations, which I don't want to do since you will learn a lot from them, anyway. I think you will find you've had enough calculation by the time Friday morning rolls around. So, let's look at the undamped case, which is simpler, or undamped spring, or undamped anything because it doesn't have that extra term, which requires extra calculations. So, I'll follow the book now and some of the notes and the visuals, and called the independent variable-- the dependent variable I'm going to call x now. And, the independent variable is, as usual, time.

So, this is going to be, in general, f(t), and I'm going to use it by calculating example, this is the actual f of t I'm going to be using. But, the general problem for a general f of t is to solve this, or at least to find a particular solution. That's what most of the work is, because we already know how from that to get the general solution by adding the solution to the reduced equation, the associated homogeneous equation.

So, all our work has been, this past couple of weeks, in how you find a particular solution. Now, the case in which we know what to do is, so we can find our particular solution. Let's call that x sub p. We could find x sub p if the right hand side is cosine omega, well, in general, an exponential, but since we are not going to use complex exponentials today, all these things are real.

And I'd like to keep them real. If it's either cos(omega t) or sin(omega t), or some multiple of that by linearity, it's just as good. We already know how to find the thing, and to find a particular solution. So, the procedure is use complex exponentials, and that magic formula I gave you. But, right now, just to save a little time, since I already did that on the lecture on resonance, I solved it explicitly for that, and you've had adequate practice I think in the problem sets. Let's simply write down the answer that comes out of that. The answer for the particular solution is cos(omega t) or sin(omega t).

That's the top. And, it's over a constant. And, the constant is (omega0)^2. That's the natural frequency which comes from the system, minus the imposed frequency, the driving frequency that the system, the spring or whatever it is, undamped spring, is being driven with. Okay, understand the notation. Cosine this over that, or sine, depending on whether you started driving it with cosine or sine. So, this is from the lecture, if you like, from the lecture on resonance, but again it's, I hope by now, a familiar fact. Let me remind you what this had to do with resonance. Then, the observation was that if omega, the driving frequency is very close to the natural frequency, then this is close to that.

The denominator is almost zero, and that makes the amplitude of the response very, very large. And, that was the phenomenon of resonance. Okay, now what I'd like to do is apply those formulas to finding out what happens for a general f(t), or in particular this one. So, in general, I'll keep using the notation, f(t), even though I've sorted used it for that. But in general, what's the situation? If f of t is a sine series, cosine series, all right, let's do everything. Suppose it's, in other words, the procedure is, take your f of t, expand it in a Fourier series.

Well, doesn't that assume it's periodic? Yes, sort of. So, suppose it's a Fourier series. I'll make a very general Fourier series, write it this way: cos( (omega)n t), and then the sine terms, sin( (omega)n t) from one to infinity where the omegas are, omega n is short for that. Well, it's going to have the n in it, of course, but I want, now, to make the general period to be 2L. So, it would be n pi / L. Of course, if L is equal to one, then it's n pi. Or, if L equals pi, those are the two most popular cases, by far. Then, it's simply n itself, the driving frequency. But, this would be the general case, n pi / L if the period is the period of f(t) is 2L.

So, that's what the Fourier series looks like. Okay, then the particular solution will be what? Well, I got these formulas. In other words, what I'm using is superposition principle. If it's just this, then I know what the answer is for the particular solution, the response. So, if you make a sum of these things, a sum of these inputs, you are going to get a sum of the responses by superposition. So, let's write out the ones we are absolutely certain of. What's the response to here? Well, it's (a)n cos((omega)n t). The only thing is, now it's divided by (omega0)^2. This constant has changed, and the same thing here.

Of course, by linearity, if this is multiplied by a, then the answer is multiplied by, the response is also multiplied by a. So, the same thing happens here. Here, it's (b)n and over, again, (omega0)^2 - omega sin(omega t). So, in other words, as soon as you have the Fourier expansion, the Fourier series for the input, you automatically get this by just writing it down the Fourier series for the response.

That's the fundamental idea of Fourier series, at least applied in this context. They have many other contexts, approximations, so on and so forth. But, that's the idea here. All right, what about that constant term? Well, this formula still works if omega equals zero. If omega equals zero, then this is the constant, one. The formula is still correct. Omega is zero here. The only thing you have to remember is that the original thing is written in this form. So, the response will be, what will it be? Well, it's one divided by omega naught squared, if I'm in the case omega0 = 0. So, it's a zero divided by two omega naught squared. And, as you will see, it looks just like the others. You're just taking omega, and making it equal to zero for that particular case. Sorry, this should be omega n's all the way through here.

All right, well, let's apply this to the green function. So, what have we got? We have its Fourier series. So, if the green function is, if the input in other words is this square wave, the green square wave, so in your notes, this guy, this particular f(t) is the input. And, the equation is x'' + (omega0)^2 x = f(t). Then, the response is, well, I can't draw you a picture of the response because I don't know what the Fourier series actually looks like. But, let's at least write down what the Fourier series is.

The Fourier series will be, well, what is it? It's one half. The constant out front is one half, except it's 1 / (2 omega0^2). So, this is my function, f(t). That's the general formula for how the input is related to the response. And, I'm applying it to this particular function, f(t). And, the answer is plus. Well, my Fourier series involves only odd sums, only the summation over odd, and only of the sign. So, it is going to be 2 / pi, sorry, so it's going to be two over pi out front.

That constant will carry along by linearity. And, I'm going to sum over odd, n odd values only. The basic thing in the upstairs is going to be the sin( (omega)n t). But, what is (omega)n? Well, (omega)n is n pi. So, it's n pi t. And, how about the bottom? The bottom is going to be (omega0)^2 - (omega)n^2. And, this is my (omega)n, - (n pi)^2. What's that? Well, I don't know. All I could do would be to calculate it. You could put it on Matlab and ask Matlab to calculate and plot for you the first few terms, and get some vague idea of what it looks like. That's nice, but it's not what's interesting to do.

What's interesting to do is to look at the size of the coefficients. And, again, rather than do it in the abstract, let's take a specific value. Let's suppose that the natural frequency of the system, in other words, the frequency at which that little spring wants to go vibrate back and forth, whatever you got vibrating. Let's suppose the natural frequency that's omega naught is ten for the sake of definiteness, as they say.

Okay, if that's ten, all I want to do is calculate in the crudest possible way what a few of these terms are. So, the response is, so let's see, we've got to give that a name. The response is (x)p (t). What's (x)p of t? I'm just going to calculate it very approximately. This means, you know, throwing caution to the winds because I don't have a calculator with me. And, I want you to look at this thing without a calculator. The first term is 1/200. Okay, that's the only term I can get exactly right. [LAUGHTER] Or, I could if I could calculate. I suppose it's 0.005, right? That's the constant term.

Okay, so the next term, let's see, two over pi is two thirds. I'll keep that in mind, right? Plus two thirds, 0.6, let's say, that's an indication of the accuracy with which these things are going to be performed. I think in Texas for a long while, the legislature declared pi to be three, anyways. One of those states did it to save calculation time. I'm not kidding, by the way. All right, so what's the first term? If n equals one, I have the sin(pi t). That's the n equals one term. What's the denominator like? That's about 100 - 9^2. Let's say it's 91, sine t over 91. What's the next term? sin(3 pi t), remember, I am omitting, I'm only using the odd values of n because those are the only ones that enter into the Fourier expansion for this function, which is at the bottom of everything.

All right, what's the sin(3 pi t)? Well, now, I've got 100 minus three pi, -- -- that's 9 squared is 81. So, no, what am I doing? So, we have 100 minus three times pi is 9, squared. Well, let's say a little more. Let's say 85. So, that's 15. How bout the next one? Well, it's sin(5 pi t). I think I'll stop here as soon as we do this one because at this point it's clear what's happening. This is 100 squared minus, that's 15 squared is 225, so that's about 125 with a negative sign. So, minus this divided by 125. And, after this they are going to get really quite small because the next one will be (7 pi)^2. That's 400, and this is becoming negligible.

So, what's happening? So, it's approximately, in other words, 0.005 plus the next coefficient is, let's see, 6/10, let's say 100, sine pi t. And, what comes next? Well, it's now 1/20th. It's about a 20th. Let's call that 0.005 sin(3 pi t), and now so small, minus 0.01, let's say times this last one, sine 5 pi t. What you find, in other words, is that the frequencies which make up the response do not occur with the same amplitude.

What happens is that this amplitude is roughly five times larger than any of the neighboring ones. And after that, it's a lot larger than the ones that come later. In other words, the main frequency which occurs in the response is the frequency three pi. What's happened is, in other words, near resonance has occurred. So, if omega is ten, very near resonance, that is, it's not too close, but it's not too far away either, occurs for the frequency three pi in the input. Now, where's the frequency three pi in the input? It isn't there. It's just that green thing. Where in that is the frequency three pi?

I can't answer that for you, but that's the function of Fourier series, to say that you can decompose that green function into a sum of frequencies, as it were, and the Fourier coefficients tell you how much frequency goes into each of those f of t's. Now, so, f of t is decomposed into the sum of frequencies by the Fourier analysis. But, the system isn't going to respond equally to all those frequencies. It's going to pick out and favor the one which is closest to its natural frequency. So, what's happened, these frequencies, the frequencies and their relative importance in f(t) are hidden, as it were. They're hidden because we can't see them unless you do the Fourier analysis, and look at the size of the coefficients.

But, the system can pick out. The system picks out and favors, picks out for resonance, or resonates with, resonates with the frequencies closest to its natural frequency. Well, suppose the system had natural frequency, not ten. This is a put up job. Suppose it had natural frequency five. Well, in that case, none of them are close to the hidden frequencies in f(t), and there would be no resonance. But, because of the particular value I gave here, I gave the value ten, it's able to pick out n equals three as the most important, the corresponding three pi as the most important frequency in the input, and respond to that.

Okay, so this is the way we hear, give or take a few thousand pages. So, what does the ear do? How does the ear, so, it's got that thing, messy curve, which I erased, which has a secret, which just has three hidden frequencies. Okay, from now on I hand wave, right, like they do in other subjects. So, we got our frequency. So, it's got a [SINGS]. That's one frequency. [SINGS] And, what goes in there is the sum of those three, and the ear has to do something to say out of all the frequencies in the world, I'm going to respond to that one, that one, and that one, and send a signal to the brain, which the brain, then, will interpret as a beautiful triad.

Okay, so what happens is that the ear, I don't talk physiology, and I never will again. I know nothing about it, but anyway, the ear, when you get far enough in there, there are little three bones, bang, bang, bang; this is the eardrum, and then there's the part which has wax. Then, there's the eardrum which vibrates, at least if there is not too much wax in your ear. And then, the vibrations go through three little bones which send the vibrations to the inner ear, which nobody ever sees.

And, the inner ear, then, is filled with thick fluid and a membrane, and the last bone hits up against the membrane, and the membrane vibrates. And, that makes the fluid vibrate. Okay, good. So, it's vibrating according to the function f(t). Well, what then? Well, that's the marvelous part. It's almost impossible to believe, but there is this, sort of like a snail thing inside. I've forgotten the name. It's cochlea. And, it has these hairs. They are not hairs really. I don't know what else to call them. They're not hairs. But, there are things so long, you know, they stick up. And, there are 20,000 of them. And, they are of different lengths. And, each one is tuned to a certain frequency.

Each one has a certain natural frequency, and they are all different, and they are all graded, just like a bunch of organ pipes. And, when that complicated wave hits, the complicated wave hits, each one resonates to a hidden frequency in the wave, which is closest to its natural frequency. Now, most of them won't be resonating at all. Only the ones close to the frequency [SINGS], they'll resonate, and the nearby guys will resonate, too, because they will be nearby, almost have the same natural frequency. And, over here, there will be a few which resonate to [SINGS], and finally over here a few which go [SINGS], and each of those little hairs, little groups of hairs will signal, send that signal to the auditory nerve somehow or other, which will then carry these three inputs to the brain, and the brain, then, will interpret that as you are hearing [SINGS].

So, the Fourier analysis is done by resonance. You here resonance because each of these things has a certain natural frequency which is able, then, to pick out a resonant frequency in the input. I'd like to finish our work on Fourier series. So, for homework I'm asking you to do something similar. Taken an input. I gave you a frequency here, a different omega0, a different input, as you by means of this Fourier analysis to find out which it will resonate, which of the hidden frequencies in the input the system will resonate to, just so you can work it out yourself and do it.

Now, I'd like to first try to match up what I just did by this formula with what's in your book, since your book handles the identical problem but a little differently, and it's essentially the same. But I think I'd better say something about it. So, the book's method, and to the extent which any of these problems are worked out in the notes, the notes do this, too. Use substitution. Base uses differentiation of Fourier series term by term. The work is almost exactly the same as here. And, it has a slight advantage, that it allows you, the book's method has a slight advantage that it allows you to forget this formula. You don't have to know this formula.

It will come out in the wash. Now, for some of you, that may be of colossal importance, in which case, by all means, use the book's method, term by term. So, it requires no knowledge of this formula because after all, I base this solution, I simply wrote down the solution and I based it on the fact that I was able to write down immediately the solution to this and put as being that response. And for that, I had to remember it, or be willing to use complex exponentials quickly to remind myself. There's very, very little difference between the two. Even if you have to re-derive that formula, the two take almost about the same length of time. But anyway, the idea is simply this. With the book, you assume. In other words, you take your function, f(t). You expand it in a Fourier series. Of course, which signs and cosines you use will depend upon what the period is.

So, you assume the solution of the form-- Well, if I, for example, carried out in this particular case, I don't know if I will do all the work, but it would be natural to assume a solution of the form, since the input looks like the green guy. Assume a solution which looks the same. In other words, it will have a constant term because the input does. But all the rest of the terms will be sines. So, it will be something like (c)n sin(n pi t). The only question is, what are the (c)n's? Well, I found one method up there. But, the general method is just plug-in. Substitute into the ODE. Substitute into the ODE.

You differentiate this twice to do it. So, I'll do the double differentiation and I won't stop the lecture there, but I will stop the calculation there because it has nothing new to offer. And, this is the way all the calculations in the books and the solutions and the notes are carried out. So, I don't think you'll have any trouble. Well, this term vanishes. This term becomes what? If I differentiate this twice, I get summation, so, this is one to infinity because I don't know which of these are actually going to appear. Summation one to infinity, (c)n times, well, if you differentiate the sine twice, you get negative sine, right? Do it once: you get cosine. Second time: you get negative sine. But, each time you will get this extra factor n pi from the chain rule. And so, the answer will be -(c)n * (n pi)^2 sin(n pi t).

And so, the procedure is, very simply, you substitute (x)p double prime into the differential equation. In other words, if you do it, we will multiply this by (omega0)^2. And, you add them. And then, on the left-hand side, you are going to get a sum of terms, sin(n pi t) times coefficients involving the (c)n's. And, on the right, so, you're going to get a sum involving the (c)n's, and the sines n pi t, and on the right, you're going to get the Fourier series for f(t), which is exactly the same kind of expression. The only difference is, now the sines have come with definite coefficients. And then, you simply click the coefficients on the left and the coefficients on the right, and figure out what the (c)n's are.

So, by equating coefficients, you get the (c)n's. Would you like me to carry it out? Yeah, okay, I was going to do something else, but I wouldn't have time to do it anyway. So, why don't I take two minutes to complete the calculation just so you can see you get the same answer? All right, what do we get? If you add them up, you get c naught, out front, plus (c)n is multiplied by what? Well, from the top it's multiplied by (omega0)^2. On the bottom, it's multiplied by (n pi)^2. Ah-ha, where have I seen that combination?

The sum is equal to, sorry, one half plus what is it, sum over n odd of sine sin(n pi t) / n. So, the conclusion is that-- I'm sorry, it should be c0 (omega0)^2. So, what's the conclusion? If c0 = 1 / (2 (omega0)^2), and that (c)n, only for n odd, the others will be even. The others will be zero. The (c)n = 2 / pi. So, it's going to be two pi, 2/pi * 1/n * 1/((omega0)^2 - (n pi)^2).

This is terrible, which is the same answer we got before, I hope. Did I cover it up? Same answer. So, that answer at the left-hand end of the board is the same one. I've calculated, in other words, what the c zeros are. And, I got the same answer as before.