# Differential Equations and Linear Algebra, 1.4c: Response to Oscillating Input, cos(w*t)

From the series: Differential Equations and Linear Algebra

*
Gilbert Strang, Massachusetts Institute of Technology (MIT)
*

An oscillating input cos(ω*t*) produces an oscillating output with the same frequency ω (and a phase shift).

OK. So this is the next step for a first-order differential equation. We take-- instead of an exponential, now we have an oscillating. Exponentials, the previous lecture, grew or decayed, now we have an oscillate. We have AC, alternating current in this problem, instead of real exponentials, we have oscillation, vibration, all the applications that involve circular motion, going around and around instead of going off exponentially.

OK. So here's the point. Again I'm looking for a particular solution. The particular solution-- it would be nice if we could say the particular solution was just some multiple of the cosine. But that won't work. So that makes this problem one step harder than the exponential.

We need to allow the signs in there. Because, if I look for a cosine, if I tried only this part, I could match that. I'd have a times the cosine, that would be cosine. But the derivative of a cosine is a sine function. So signs are going to get in there and we have to allow them into the solution.

OK. So that's the right thing to assume. Actually there will be, you'll see, three different ways to write the answer to this problem. And this is the first sort of most straightforward, but not the best in the long run.

OK. Straightforward one, I'm going to substitute that into the equation and find M and N. That's my job. Find these numbers. So put that into the equation.

On the left side I want the derivative, so that we'll be omega-- well derivative of the cosine is minus omega m sine omega t. The derivative brought out this factor omega. The derivative of cosine was sine.

Now the derivative of this brings out a factor of omega-- omega N cosine omega t. And that should equal a times y-- there's y, so I just multiply by a-- a M cosine omega t, and a N sine omega t. That's the ay part. And now I have the source term plus cosine omega t. And that has to be true for all time.

And now I need the equation. What do I do with this? I'm looking for two things, M and N. I'm looking for two equations.

So I match the cosine terms. I match that term, that cosine term, and the source term. So they all multiply cosine omega t. So I want omega n-- so I bring this over on the other side-- minus a m plus omega n equals-- here I just have one cosine-- equals 1. Minus a M plus omega N equals 1.

And now I'll match the sine terms. So in the sine terms, I have a minus omega M, sine omega t. And I have to bring this on the other side, so that'll be a minus a N sine omega t. And there's no sine omega t in the source.

There's my two equations. Those are my two equations for M and N. So I just solve those two equations and I've got the particular solution that I look for.

So, it's two equations, two unknowns. It's the basic problem of linear algebra. I'm inclined to just write down the answer, which I prepared in advance. And it turns out to be minus a over omega squared plus a squared. And N turns out to have that same omega squared plus a squared, and above it goes omega.

If you check this equation, for example, omega times the M will give me a a omega with a minus with a minus. And then a times N will also have an a omega. And the same omega squared plus a squared, they cancel to give 0. And this equation is also solved.

So one more important problem solved. Well, we found the particular solution. I haven't added in-- I haven't match the initial condition.

Now in many, many cases, it's this particular solution that's of interest. This here-- let me put a box around our solution-- and we substituted that in the differential equation. We discovered M. We discovered N. We've got this particular solution.

And that's the oscillation that keeps going. That if we're listening to radio or if we have alternating current, this is what we see, the null solution. The thing that's coming with no source term.

Usually a is negative and that disappears. That's called the transient term. So the null solution would be have an ae to the at as always. But I'm not so interested in that because it disappears. You don't hear it after a minute. And this is the solution that you're-- this is what your ear is hearing.

OK. So we've got one form of the answer. Now, that's a pretty nice form, but it's not perfect. I can't see exactly-- this can be simplified in a really nice way. So when we work with sines and cosines, it's this next step that's important.

I believe that that same yp of t can be written in a different way as what also-- another form, a different-- well I should say, another form for the same y of t. Another form will be the same y of t. You see what I don't like is having a cosine and a sine because those are out of phase, and they're combining it into something, and I want to find out what their combining into. And it's really nice. They're combining into a single cosine, but not just omega t, there's a lag, a phase shift. The angle involved is often called the phase.

So the two, sine and cosine, combine to give a phase shift with some amplitude, maybe I'll call it G, the gain. Or often it would be called capital R just for-- because it's-- sort of what you're seeing here is polar coordinates. So I want to match this, which has the G and the alpha-- polar coordinates is really the right way to think of this. G and an alpha, a magnitude and an angle. I want to match that with the form I already had.

So I'll use a little trigonometry here to remember that this is equal to-- I have a G. Do you remember a formula for the cosine of a minus b? The cosine of a difference is cosine of omega t, cosine of alpha, plus-- it's a plus here because it's a minus there-- sine omega t sine alpha. So I have just written this out in the two-term form, and I did that so that I could match the two-term form I already had.

So can I just do that matching? The cosine omega t, the M must be G cosine alpha. And they N must be G sine alpha.

So I now have two equations. The M and the N, I still remember what those are. I figured those out.

But now I want to convert the M N form to the G alpha form, and this is what I have to do. And it's the usual thing with polar coordinates. How can I get-- how do I discover what G is there, and what alpha is? The trick is-- the one fundamental identity when you see cosines and sines-- is to remember that cosine squared plus sine squared is 1. I'm going to use that, have to use it.

So I'll square both sides. I'll have M squared, and I'll add. So I'll have M squared plus N squared is G squared cosine squared alpha. G squared times cosine squared alpha-- when I square that one-- and sine squared alpha when I square that one. And again, the point is that's one. So that's just G squared.

So what do I learned? G is the square root of this. G is the square root of M squared plus N squared. And I'm always freedom plug-in the M and the N that I found.

OK that's-- ah, what about alpha? That's the angle. So I have to-- again, I'm thinking trig here. How am I going to get alpha here? I want to get G out of this formula now, and just focus on the alpha. Previously I got alpha out of it and got the G.

Now the way to do is take the ratio. If I take the ratio of that to that, divide one by the other, the G's will cancel. So I'll take the ratio of that to that to get G sine alpha divided by g cosine alpha is then N over M. And the G's cancel as I wanted.

So now I have an equation for alpha. Or more exactly, I have an equation for tangent of alpha. Sine over cosine is tangent of alpha is N over M.

So this is called the-- you could call it the sinusoidal identity. What is that word sinusoid? Sinusoid is a word for any mixture of sines and cosines, any mixture of sines and cosines of the same omega t.

So the sinusoidal identity says that I can rewrite that solution into this solution. And I really see the key number in the whole thing is the gain, the magnitude. It's how loud the station comes through if we're tuning a radio. So and again, this is the response that's keeps going because the cosine oscillates forever. There will be also something coming from the initial condition that we expect to die out.

So I mentioned at the very start that there were three forms of the answer to this cosine input, and I've given you two. I've given you the M and N form. You could say rectangular coordinates-- cosines and sines. I've given you the polar form, which is a gain, a magnitude, and a phase. And the third one involves complex numbers. I have to make that a separate lecture, maybe even two.

So complex numbers, where do they come in? It's a totally real equation. If I think about all this that I've done, it was all totally real, but there's a link-- the key fact about complex numbers, Euler's great formula will give me a connection between cosine omega t and sine omega t with e to the I omega t. So at the price of introducing that complex number, imaginary number i, or j for electrical engineers, we're back to exponentials. We're back to exponentials. So that'll come in the next lecture.

This is one more example of a nice source function. Maybe I could just say, what are the nicest source functions? So this is the source function here and it was nice. Exponential was even nicer. Constant was best of all.

And I want to-- another one I want to introduce is a delta function. So that's-- a delta function is an impulse, something that happens in an instant. And that's an interesting, very interesting and very important possibility.

OK. Thank you.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)

### Asia Pacific

- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)