The Differential Equation for Harmonic Oscillators

Newton’s second law states that F = ma, where F is the force, m is the mass of the object the force is acting on, and a is the acceleration. As a = s, where s is the position, this is a second order differential equation. You can use this equation to find a differential equation for oscillations, particularly for oscillations with a spring.

To show you how to do this, let’s look at an example. The actual calculations are taken out so you can see the steps of the method more clearly.

Example 1

A weight with mass m = 1kg hangs in a spring with a spring constant of k = 1N/m and a friction of F. You pull the mass two meters out and let go, which makes the spring bounce up and down. This can be thought of as an oscillation. The oscillation y(x) can be expressed by the differential equation

y + Fy + y = 0 y(0) = 2y(0) = 0

y + Fy + y = 0y(0) = 2y(0) = 0

The oscillation behaves differently for different values of the friction F. You will now look at what happens when the friction F has different values.

You start by solving the characteristic equation, which is:

r2 + Fr + 1 = 0

You solve it and get

r = F ±F 2 4 2

Then, you need to check if the characteristic equation has one or two real solutions to determine which formula to use for the solution of the differential equation. This is done by checking if F2 4 is positive, negative or zero.

F2 4 is Negative

In this case the equation has no solutions as the value under the square root is negative. For F2 4 < 0 you must have |F | < 2. That means that in this case we can get two types of oscillations. If F = 0, there is no friction, which is called undamped oscillation. If F is posititve (but less than 2) you get an underdamped oscillation.

F = 0, undamped oscillation:

When F is zero there is no friction, so the weight will not slow down at all. The spring will contract and expand the same distance every time. It will never stop. In this case the solution to the equation is

y(x) = 2 cos(x)

Graph of undamped oscillaion

0 < F < 2,

underdamped oscillations:

0 < F < 2, underdamped oscillations:

In this case there is a bit of friction, so the weight will oscillate, but with a smaller and smaller distance from the equilibrium. The spring will first contract, then expand and then contract again, but with smaller and smaller distances from the equilibrium. For F = 0.44, the solution of the differential equation is

y(x) = 2.05e0.22x sin(x + 1.35)

y(x) = 2.05e0.22x sin(x + 1.35),

and looks like this:

Graph underdamped oscillaion

F2 4 is Zero—Critically Damped Oscillation

In this case there is exactly enough friction to make the weight slow down just enough to not overshoot the equilibrium. The weight will stop exactly at the point of equilibrium. You can see this from the characteristic equation, as the critically dampened oscillation has one double solution, which in this case is r = 1. The solution of the differential equation is then

y(x) = 2ex + 2xex

Graph with critically damped oscillation

F2 4 is Positive—Overdamped Oscillation

In this case there is “more friction than necessary”, which stops the spring from overshooting the equilibrium. You can see this from the characteristic equation, as it has two different real solutions. For F = 4 the solution to the differential equation is

y(x) = (1 2 3) e(2+3)x + (1 + 2 3) e(23)x

y(x) = (1 2 3) e(2+3)x + (1 + 2 3) e(23)x

Graph of overdamped oscillation

Note! Critical damping and overdamping are very similar. The difference is that with overdamping, the weight takes a lot more time to get back to the point of equilibrium.

To separate the two cases, you need to check if the characteristic equation has one or two solutions. Here is an overview of all the different types of oscillations. Take some time to study the difference between them.

Graphs of all types of oscillations

Graphs of all types of oscillations

Note! Remember that in this example, you looked at a weight with a mass of 1 kg and a spring constant of 1 N/m. Generally, when a weight has a mass m, friction F and spring constant k, the calculations become slightly different, but you get the same four types of oscillations.

The differential equation is

x + F mx + k mx = 0

and the types of oscillations are:

F = 0:

Undamped oscillation

F2 4mk is negative:

Underdamped oscilliation

F2 4mk is zero:

Critically damped oscillations

F2 4mk is positive:

Overdamped oscillation

Example 2

You’re given the following differential equation:

4y + 4y + 5y = 0

You are then given the following exercises:

1.
Find the characteristic equation, solve it, and use the solution to find a general expression for y.
2.
Find the constants of integration when you know that y(0) = 3 and y (3π 4 ) = 0.
3.
Draw the graph of y = f(x) for x [0, 3π).
4.
Determine any zeros of f and the coordinates of any maxima or minima of the graph f for x [0, 3π).

Exercise 1

You get the characteristic equation

4r2 + 4r + 5 = 0

You can solve this by using the quadratic formula, which gives you

r = 4 ±16 80 8 = 4 ±64 8 = 4 ± 8i 8 = 0.5 ± i

You can see that the equation has two solutions. There is an i in both solutions, which indicates that these are complex solutions, not real ones.

To use these to find a general expression for y, you take the following:

y = eAx(C 1 sin Bx + C2 cos Bx)

with A = 0.5 and B = 1. The general solution is then

y(x) = e0.5x(C 1 sin(x) + C2 cos(x))

Exercise 2

The constants of integration are C1 and C2. To determine these, you need to solve the system of equations you get from the initial conditions, which are y(0) = 3 and y (3π 4 ) = 0. This becomes a system of equations where C1 and C2 are the two unknowns. To get the equations, you use the values x = 0 and x = 3π 4 from the initial conditions. First you use x = 0, which gives you

3 = y(0) = e0.50(C 1 sin(0) + C2 cos(0)) = 1 (C1 0 + C2 1) = C2

The first equation is C2 = 3. The next equation is

0 = y (3π 4 ) = e0.53π 4 (C1 sin (3π 4 ) + C2 cos (3π 4 )) = e0.53π 4 (C12 2 + C2 2 2 ) ,

0 = y (3π 4 ) = e0.53π 4 (C 1 sin (3π 4 ) + C2 cos (3π 4 )) = e0.53π 4 (C 12 2 + C2 2 2 ) ,

which becomes

e0.53π 4 (C 12 2 + C2 2 2 ) = 0

This equation is a bit tricky, so it might be a good idea to simplify it slightly before you solve the system of equations as usual.

You see that you can divide by e0.53π 4 and by 2 2 . This makes the equation much simpler:

C1 C2 = 0

This means that the system of equations you get from the initial conditions is

C2 = 3 C1 C2 = 0

You solve this as usual and get

C1 = C2 = 3

By inserting these values into the general solution, you get the particular solution that fulfill your initial conditions:

f(x) = e0.5x(C 1 sin(x) + C2 cos(x)) = 3e0.5x(sin(x) + cos(x))

Exercise 3

In this exercise you must plot the graph for x [0, 3π). By doing that, you get this graph:

Example of harmonic oscillation

Example of harmonic oscillation

Exercise 4

You are to find the zeros of f. These are found by solving f(x) = 0. You get the equation

3e0.5x(sin(x) + cos(x)) = 0

You can see that 3e0.5x is always positive. This means that you can divide by 3e0.5x and get

sin(x) + cos(x) = 0

You then solve this as a normal trigonometric equation. The easiest way is to divide by cos(x), which gives you

tan(x) + 1 = 0 tan(x) = 1

This is only true for

x = tan 1(1) = π 4 + n π

Now, you need to find the values of x that are in the interval [0, 3π). You do this and find that

x {3π 4 , 7π 4 , 11π 4 }

You now know the zeros of f. Next, you need to find the extrema of the function. To do this, you set f(x) = 0. First you find f(x) by using the product rule. You get

f(x) = 1.5e0.5x(sin(x) + cos(x)) + 3e0.5x(cos(x) sin(x))

f(x) = 1.5e0.5x(sin(x) + cos(x)) + 3e0.5x(cos(x) sin(x))

Then you need to solve the equation f(x) = 0. You get

0 = 1.5e0.5x(sin(x) + cos(x)) + 3e0.5x(cos(x) sin(x))

1.5e0.5x(sin(x) + cos(x)) + 3e0.5x(cos(x) sin(x)) = 0

Like before, you can see that 3e0.5x is always positive, so you can divide the entire equation by it. By doing this and then multiplying the equation by 2, you get the equation

(sin(x) + cos(x)) + 2 cos(x) 2 sin(x) = 0 3 sin(x) = cos(x)

(sin(x) + cos(x)) + 2 cos(x) 2 sin(x) = 0 3 sin(x) = cos(x)

You solve this by dividing by cos(x), and end up with the equation

tan(x) = 1 3

This only happens when

x = tan 1 (1 3) 0.32 + n π

You need to find the values of x that are between 0 and 3π. That gives you

x = {0.32, 3.46, 6.60}

You have now found the x-values of the extrema of f. From the graph you can see that x = 3.46 is a minimum, and that x = 0.32 and x = 6.60 are maxima. You now need to find the y-values of these points. You do that by inserting the values for x at the extrema into the function f(x). By doing this, you find that the minimum is (3.46,0.67), and that the maxima are (0.32, 3.23) and (0.32, 0.14).

Want to know more?Sign UpIt's free!