If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Harmonic motion part 2 (calculus)

We test whether Acos(wt) can describe the motion of the mass on a spring by substituting into the differential equation F=-kx. Created by Sal Khan.

Want to join the conversation?

  • spunky sam blue style avatar for user anvay12
    in some books its given x= A sin wt and in some books it is x= Acos(wt). which one is right or are both of them correct??
    (11 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user Rishi Ragsdale
      The thing is, the only difference between the two is where you start. The function A sin wt is just the function A cos wt displaced by 90 degrees (graph it on a calculator, you'll see). So, both are right. It just depends on how you decide to graph it.
      If you start the oscillation by compressing a spring some distance and then releasing it, then x = A cos wt, because at time t=0, x=A (A being whatever distance you compressed the spring). But if you start the oscillation by suddenly applying a force to the spring at rest and then letting it oscillate, at t=0, x must equal 0. So in that case, x = A sin wt (sin0 = 0)
      (38 votes)
  • leaf green style avatar for user Ahmed Yaseen
    what is the purpose of omega in the equation?
    x(t) = A cos(wt)
    (9 votes)
    Default Khan Academy avatar avatar for user
    • spunky sam red style avatar for user Garam Lee
      The omega is a constant in the equation that stretches the cosine wave left and right (along the x axis), just as the A at the front of equation scales the cosine wave up and down. The bigger the omega, the more squashed the cosine wave showing the spring's position (and thus quicker the spring's movement).
      (5 votes)
  • leaf green style avatar for user sg60847
    Why w=square root of k/m not plus or minus square root of k/m ?. Isn't angular velocity a vector
    (3 votes)
    Default Khan Academy avatar avatar for user
  • piceratops sapling style avatar for user Meghna
    why x(t)= A*cos(omega*t)? and wat is 'T'?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Rishabh Dev
    If I keep a block attached to a horizontal spring on the floor of an elevator going up with an acceleration ‘a’, and then displace the block slightly by stretching the spring-block system horizontally, will the time period of oscillation change as compared to the (T=2π√m/k)?
    I don't think it should, because the time period depends on the horizontal force, and the elevator changes it in the vertical direction, but my friend asserts that it should change, though she can't explain why. Which of us, if either, is correct?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user Andrew M
      Here is a simulation of a mass on a vertical spring
      Go to the simulation and try it out. You can measure the period of oscillation by clicking on the box for "stopwatch". To measure the period, measure the time for 10 or 20 bounces and divide by 10 or 20.
      Now look over on the right side and you will see that you can change gravity from that of Earth to that of Jupiter. Go ahead and do that and see if gravity makes a difference to the period.

      Now how does this apply to acceleration? When you are in an elevator accelerating up at a rate of a, that is exactly the same as if gravity increased from g to g+a. You can tell this by figuring out what your weight would be in the elevator - if you work it out you will see it will be m(g+a).

      So if the period is the same on jupiter, that means it will also be the same in an accelerating elevator, and if it is different on jupiter, that means it will also be different in the elevator.

      Once you know the answer by experiment, see if you can figure out why the answer is what it is.
      (4 votes)
  • male robot johnny style avatar for user Miguel Hernandez
    How would we solve a problem that is an oscillation but doesn't start where cos(wt) and sin(wt) start?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • blobby blue style avatar for user Ananya A
      That's a good question. The function would then be Asin(wt+k) where k is some constant.

      If the graph is just shifted (horizontally) slightly, you add or subtract a constant that is equal to the amount by which it has been shifted on the x-axis.

      When to add and when to subtract?
      - Add when it is shifted to the left
      - Subtract when it is shifted to the right

      Hope this answers your doubt! :)
      (1 vote)
  • piceratops sapling style avatar for user Meghna
    why acceleration= second derivative of the function x(t)?
    (1 vote)
    Default Khan Academy avatar avatar for user
  • mr pink red style avatar for user Yosharma999
    Why do we have to take a double derivative?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user bmurraybruce95
      Because in the problem we are given the position of the particle. And it's known that if you differentiate the position of a particle (with respect to time), you get the velocity of the particle. You differentiate the result (the velocity of the particle) which then gives you the acceleration of the particle, which is why we have to take the double derivatie.
      (2 votes)
  • primosaur seedling style avatar for user Harikrishnan PV
    at i understood with the differentiation of ω but why didn't the amplitude get squared?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • piceratops ultimate style avatar for user Quantized
      The amplitude is just a constant. The ω was squared because it appeared inside of sin(ωt), and by the chain rule, (each time we differentiate a sin or cos) it falls out. It might be better if you saw the differentiation with and without A included in the original function:

      f(t) = cos(ωt), f'(t) = -ω sin(ωt), f''(t) = -ω^2 cos(ωt).

      Multiplying by a constant doesn't change the inner working of the derivative, so we just have:

      x(t) = Acos(ωt), x'(t) = -Aω sin(ωt), x''(t) = -Aω^2 cos(ωt).

      Hope this helped!
      (3 votes)
  • blobby green style avatar for user hraza31
    So how would you find the frequency of a harmonic function?
    (1 vote)
    Default Khan Academy avatar avatar for user

Video transcript

So where I left off in the last video, I'd just rewritten the spring equation. And I just wrote force is mass times acceleration. And I was in the process of saying, well if x is a function of t, what's acceleration? Well, velocity is this derivative of x with respect to time, right? Your change in position over change of time. And acceleration is the derivative of velocity, or the second derivative of position. So you take the derivative twice of x of t, right? So let's rewrite this equation in those terms. Let me erase all this--I actually want to keep all of this, just so we remember what we're talking about this whole time. Let me see if I can erase it cleanly. That's pretty good. Let me erase all of this. All of this. I'll even erase this. That's pretty good, all right. Now back to work. So, we know that-- or hopefully we know-- that acceleration is the second derivative of x as a function of t. So we can rewrite this as mass times the second derivative of x. So I'll write that as-- well, I think the easiest notation would just be x prime prime. That's just the second derivative of x as a function of t. I'll write the function notation, just so you remember this is a function of time. Is equal to minus k times x of t. And what you see here, what I've just written, this is actually a differential equation. And so what is a differential equation? Well, it's an equation where, in one expression, or in one equation, on both sides of this, you not only have a function, but you have derivatives of that function. And the solution to a differential equation isn't just a number, right? A solution to equations that we've done in the past are numbers, essentially, or a set of numbers, or maybe a line. But the solution to differential equations is actually going to be a function, or a class of functions, or a set of functions. So it'll take a little time to get your head around it, but this is as good an example as ever to be exposed to it. And we're not going to solve this differential equation analytically. We're going to use our intuition behind what we did earlier in the previous video. We're going to use that to guess at what a solution to this differential equation is. And then, if it works out, then we'll have a little bit more intuition. And then we'll actually know what the position is, at any given time, of this mass attached to the spring. So this is exciting. This is a differential equation. When we drew the position-- our intuition for the position over time-- our intuition tells us that it's a cosine function, with amplitude A. So we said it's A cosine omega t, where this is the angular velocity of-- well, I don't want to go into that just yet, we'll get a little bit more intuition in a second. And now, what we can do is, let's test this expression-- this function-- to see if it satisfies this equation. Right? If we say that x of t is equal to A cosine of wt, what is the derivative of this? x prime of t. And you could review the derivative videos to remember this. Well, it's the derivative of the inside, so it'll be that omega, times the outside scalar. A omega. And then the derivative-- I'm just doing the chain rule-- the derivative of cosine of t is minus sine of whatever's in the inside. I'll put the minus outside. So it's minus sine of wt. And then, if we want the second derivative-- so that's x prime prime of t. Let me do this in a different color, just so it doesn't get monotonous. That's the derivative of this, right? So what's the derivative of-- these are just scalar values, right? These are just constants. So the derivative of the inside is an omega. I multiply the omega times the scalar constant. I get minus A omega squared. And then the derivative of sine is just cosine. But the minus is still there, because I had the minus to begin with. Minus cosine of omega t. Now let's see if this is true. So if this is true, I should be able to say that m times the second derivative of x of t, which is in this case is this, times minus Aw squared cosine wt. That should be equal to minus k times my original function-- times x of t. And x of t is a cosine wt. I'm running out of space. Hopefully you understand what I'm saying. I just substituted x prime prime, the second derivative, into this, and I just substituted x of t, which I guess that's that, in here. And now I got this. And let me see if I can rewrite. Maybe I can get rid of the spring up here. I'm trying to look for space. I don't want to get rid of this, because I think this gives us some intuition of what we're doing. One of those days that I wish I had a larger blackboard. Erase the spring. Hopefully you can remember that image in your mind. And actually, I can erase that. I can erase that. I can erase all of this, just so I have some space, without getting rid of that nice curve I took the time to draw in the last video. Almost there. OK. Back to work. Make sure my pen feels right, OK. So all I did is I took-- we said that by the spring constant, if you rewrite force as mass times acceleration, you get this. Which is essentially a differential equation, I just rewrote acceleration as the second derivative. Then I took a guess, that this is x of t, just based on our intuition of the drawing. I took a guess. And then I took the second derivative of it. Right? This is the first derivative, this is the second derivative. And then I substituted the second derivative here, and I substituted the function here. And this is what I got. And so let me see if I can simplify that a little bit. So if I rewrite there, I get minus mAw squared cosine of wt is equal to minus kA cosine of wt. Well it looks good so far. Let's see, we can get rid of the minus signs on both sides. Get rid of the A's on both sides. Right? We can divide both sides by A. Let me do this in black, just so it really erases it. So if we get rid of A on both sides, we're left with that. And then-- so let's see, we have mw squared cosine of omega t is equal to k cosine of omega t. So this equation holds true if what is true? This equation holds true if mw squared-- or omega squared, I think that's omega. I always forget my-- is equal to k. Or another way of saying it, if omega squared is equal to k over m. Or, omega is equal to the square root of k over m. So there we have it. We have figured out what x of t has to be. We said that this differential equation is true, if this is x of t, and omega is equal to this. So now we've figured out the actual function that describes the position of that spring as a function of time. x of t is going to be equal to-- we were right about the A, and that's just intuition, right, because the amplitude of this cosine function is A-- A cosine-- and instead of writing w, we can now write the square root of k over m. The square root of k over m t. That to me is amazing. We have now, using not too sophisticated calculus, solved a differential equation. And now can-- if you tell me at 5.8 seconds, where is x, I can tell you. And I just realized that I am now running out of time, so I will see you in the next video.