The Periodically—Forced Harmonic Oscillator S. F. Ellermeyer Kennesaw State University July 15, 2003 Abstract We study the differential equation d2 y dy + p + qy = A cos (ωt − θ) dt2 dt which models a periodically—forced harmonic oscillator. 1 General Solution of the Unforced Harmonic Oscillator Equation The harmonic oscillator without external forcing is modelled by the differential equation d2 y dy + p + qy = 0 (1) 2 dt dt where p = b/m, q = k/m, m is the mass of the bob, k is the spring constant, and b is the damping coefficient. Due to the physical interpretations of p and q, we assume that p ≥ 0 and that q > 0. The characteristic equation for the differential equation (1) is λ2 + pλ + q = 0 and the eigenvalues are p p2 − 4q λ1 = p2 −p + p2 − 4q λ2 = 2 −p − 1 Due to the assumptions p ≥ 0 and q > 0, no eigenvalue can have a positive real part. There are thus four possibilities: 1. λ1 < λ2 < 0 — in which case the harmonic oscillator is overdamped and the general solution of (1) is N (t) = c1 eλ1 t + c2 eλ2 t . 2. λ = α + βi is an imaginary eigenvalue with α < 0 and β > 0 — in which case the harmonic oscillator is underdamped and the general solution of (1) is N (t) = c1 eαt cos (βt) + c2 eαt sin (βt) . 3. λ = βi is an imaginary eigenvalue with β > 0 — in which case the harmonic oscillator is undamped and the general solution of (1) is N (t) = c1 cos (βt) + c2 sin (βt) . 4. λ < 0 is a repeated eigenvalue — in which case the harmonic oscillator is critically damped and the general solution of (1) is N (t) = c1 eλt + c2 teλt . Note: We use the notation N (t) to denote the general solution of (1) because we are thinking of this solution as the “natural” response when the harmonic oscillator experiences no external forcing. 2 General Solution of the Forced Harmonic Oscillator Equation If we add an external forcing function, f (t), to the harmonic oscillator, we obtain the differential equation d2 y dy + p + qy = f (t) . 2 dt dt The general solution of the differential equation (2) is y (t) = N (t) + F (t) 2 (2) where N is the natural response (the general solution of the corresponding unforced equation) and F is any particular solution of the forced equation (2). We use the notation F (t) to remind us that this a “forced” response. Once we have found a particular forced response, F (t), we will have found the general solution to (2). 3 Some Useful Facts From Trigonometry Lemma 1 If a and b are any real numbers with a 6= 0, then µ µ ¶¶ |a| b cos arctan =√ a a2 + b2 and µ µ ¶¶ b |a| b = √ . sin arctan a a a2 + b2 Proof. We use the fact that if x is any real number, then 1 cos (arctan (x)) = √ 1 + x2 and x sin (arctan (x)) = √ . 1 + x2 Setting x = b/a, we obtain √ µ µ ¶¶ |a| a2 b 1 √ √ cos arctan =q = = . ¡ b ¢2 2 + b2 2 + b2 a a a 1+ a and µ µ ¶¶ b b |a| b a sin arctan =q = √ . ¡ ¢ 2 a a a2 + b2 1 + ab Lemma 2 If a, b, and ω are any real numbers, then for all real numbers, t, we have a cos (ωt) + b sin (ωt) = K cos (ωt − φ) 3 where K= and φ= ½ ( √ |a| a2 +b2 a b arctan π 2 ¡b¢ a if a 6= 0 if a = 0 if a 6= 0 . if a = 0 Proof. First suppose that a 6= 0 and let √ |a| a2 + b2 K= a and µ ¶ b φ = arctan . a Then µ µ ¶¶ b K cos (φ) = K cos arctan a √ |a| |a| a2 + b2 ·√ = a a2 + b2 =a and µ µ ¶¶ b K sin (φ) = K sin arctan a √ b |a| |a| a2 + b2 · √ = a a a2 + b2 =b We conclude that K cos (ωt − φ) = K (cos (ωt) cos (φ) + sin (ωt) sin (φ)) = K cos (φ) cos (ωt) + K sin (φ) sin (ωt) = a cos (ωt) + b sin (ωt) which is what we wanted to prove. 4 Now we consider the case a = 0. In this case, we define K=b and φ= π 2 and observe that K cos (φ) = 0 K sin (φ) = b. Thus K cos (ωt − φ) = K (cos (ωt) cos (φ) + sin (ωt) sin (φ)) = K cos (φ) cos (ωt) + K sin (φ) sin (ωt) = 0 cos (ωt) + b sin (ωt) = a cos (ωt) + b sin (ωt) . Remark 3 It is useful to write a function a cos (ωt) + b sin (ωt) in the form K cos (ωt − φ) because it allows us to tell the amplitude and the phase shift of the oscillations very easily. In fact, since µ µ ¶¶ φ K cos (ωt − φ) = K cos ω t − , ω we see that the amplitude is |K| and the phase shift is φ/ω. (Also, the period is 2π/ω and the frequency is ω/ (2π).) Example 4 A graph of the function F (t) = 2 cos (2t) − 5 sin (2t) is shown below. 5 4 2 -4 0 -2 2 t 4 -2 -4 This function has period 2π/2 = π and frequency 1/π ≈ 0.3. The amplitude of the oscillations is q √ |K| = 22 + (−5)2 = 29 ≈ 5.385 and the phase shift is arctan φ = ω 2 ¡ −5 ¢ 2 ≈ −1.2 = −0.6. 2 In fact, we can write the formula for the function F (exactly) as µ µ ¶¶ √ 5 F (t) = 29 cos 2t − arctan − 2 or (approximately) as F (t) = 5.385 cos (2t + 1.2) or as F (t) = 5.385 cos (2 (t + 0.6)) and we see that the graph of F is the graph of y = cos (2t) amplified by a factor of 5.385 and shifted to the left by about 0.6 units. ¡ ¢ ¡ ¢ Exercise 5 A graph of F (t) = −3 cos 12 t + 5 sin 12 t is shown below. 6 6 4 2 -10 -8 -6 -4 -2 0 2 4 t 6 8 10 -2 -4 -6 Write the formula for F in the form F (t) = K cos (ωt − φ) and determine the period, frequency, amplitude, and phase shift for this function. 4 Solving the Forced Equation with Periodic Forcing We now consider the problem of finding a particular solution of the forced equation with periodic forcing: d2 y dy + qy = cos (ωt) + p (3) dt2 dt with given parameters p ≥ 0, q > 0, and ω > 0. Note that we are restricting our attention to a forcing function (cos (ωt)) that has amplitude 1 and no phase shift. As will be seen, we will be able to handle more general forcing functions (sines and cosines with any amplitude or phase shift) once we understand how to find a solution to equation (3). We claim that (in most circumstances) equation (3) has a solution of the form F (t) = a cos (ωt) + b sin (ωt) . We can show that this is correct once we find the right values of a and b. Keep the comment “in most circumstances” in mind. In the calculations that we are about to do, we will do some division operations. As we know, division is okay as long as we are not dividing by zero. In the calculations that follow, we will assume that when we are never dividing by zero. Then, when we are done, we will go back over our calculations and deal with cases where there may have been a danger of dividing by zero. 7 Defining the function F as F (t) = a cos (ωt) + b sin (ωt) , we observe that dF = −aω sin (ωt) + bω cos (ωt) dt and d2 F = −aω 2 cos (ωt) − bω 2 sin (ωt) . dt2 If F is to be a solution of equation (3), then we must have ¡ ¢ −aω 2 cos (ωt) − bω2 sin (ωt) + p (−aω sin (ωt) + bω cos (ωt)) + q (a cos (ωt) + b sin (ωt)) = cos (ωt) for all t. This gives us ¢ ¢ ¡ ¡ −aω 2 + bpω + aq cos (ωt) + −bω 2 − apω + bq sin (ωt) = cos (ωt) or, equivalently, ¡¡ ¢ ¢ ¡¡ ¢ ¢ q − ω 2 a + pωb cos (ωt) + q − ω 2 b − pωa sin (ωt) = cos (ωt) . Since the above equation must be true for all real numbers t, it must be true when t = 0. This gives us ¢ ¡ q − ω 2 a + pωb = 1. Using t = π/ (2ω), we obtain ¡ ¢ −pωa + q − ω 2 b = 0. Multiplying both sides of the first equation by pω, and multiplying both sides of the second equation by q − ω2 gives ¡ ¢ pω q − ω 2 a + (pω)2 b = pω ¡ ¢ ¡ ¢2 −pω q − ω 2 a + q − ω 2 b = 0. 8 Adding these two equations gives us ³ ¡ ¢2 ´ (pω)2 + q − ω 2 b = pω or pω . (pω) + (q − ω 2 )2 Having found b, we can now determine that b= a= 2 q − ω2 . (pω)2 + (q − ω 2 )2 We thus claim that a solution of equation (3) is F (t) = pω q − ω2 sin (ωt) . 2 2 cos (ωt) + 2 2 (pω) + (q − ω ) (pω) + (q − ω2 )2 Let us check that this correct: Defining F as above, we have and and −ω (q − ω 2 ) dF pω2 sin (ωt) + cos (ωt) = dt (pω)2 + (q − ω 2 )2 (pω)2 + (q − ω2 )2 d2 F −ω2 (q − ω 2 ) pω3 = cos (ωt) − sin (ωt) dt2 (pω)2 + (q − ω2 )2 (pω)2 + (q − ω 2 )2 dF d2 F + qF +p 2 dt dt −ω2 (q − ω2 ) pω3 cos (ωt) − sin (ωt) = (pω)2 + (q − ω 2 )2 (pω)2 + (q − ω2 )2 −pω (q − ω 2 ) p2 ω 2 + sin (ωt) + cos (ωt) (pω)2 + (q − ω 2 )2 (pω)2 + (q − ω2 )2 q (q − ω 2 ) pqω + sin (ωt) 2 2 cos (ωt) + 2 2 (pω) + (q − ω ) (pω) + (q − ω 2 )2 −ω2 (q − ω 2 ) + p2 ω2 + q (q − ω 2 ) = cos (ωt) (pω)2 + (q − ω2 )2 µ ¶ −pω 3 − pω (q − ω2 ) + pqω + sin (ωt) (pω)2 + (q − ω2 )2 = cos (ωt) . 9 (4) The above computation shows that the function (4) is indeed a solution of the differential equation (3). Observe that the formula for F can be written as ¡¡ ¢ ¢ 1 2 q − ω cos (ωt) + pω sin (ωt) F (t) = . (5) (pω)2 + (q − ω2 )2 Assuming that q − ω 2 6= 0, we can use Lemma 2 to conclude that ¡ ¢ q − ω 2 cos (ωt) + pω sin (ωt) = K cos (ωt − φ) where K= and By observing that we can conclude that |q − ω 2 | (6) q (pω)2 + (q − ω2 )2 q − ω2 µ pω φ = arctan q − ω2 ¶ . ¡ ¢2 K 2 = (pω)2 + q − ω2 , 1 cos (ωt − φ) K where K and φ are as defined above. Thus, the function F has phase shift φ/ω and amplitude ¯ ¯ ¯1¯ 1 ¯ ¯= q . ¯K ¯ (pω)2 + (q − ω2 )2 F (t) = Now let us consider the case that q − ω 2 = 0. In this case, we have ³ 1 1 π´ F (t) = sin (ωt) = cos ωt − , pω pω 2 showing that F has phase shift π/ (2ω) and amplitude 1/ (pω). All of the above discussion relies on the assumption that either pω 6= 0 q or − ω 2 6= 0. Note that if at least one of pω or q − ω 2 is not zero, then (pω)2 +(q − ω2 ) > 0 and we are thus justified in dividing by this quantity and in taking its square root. In particular, if p > 0 (meaning that the harmonic oscillator has damping present), then (pω)2 + (q − ω2 ) > 0 (because we are also assuming that ω > 0). We have therefore found a complete solution to our problem in the case that damping is present. We summarize as follows: 10 Theorem 6 Consider the differential equation d2 y dy + p + qy = cos (ωt) 2 dt dt where p ≥ 0, q > 0, and ω > 0. Also, assume that either p > 0 or q−ω 2 6= 0. Under the above assumptions, a solution of this differential equation is F (t) = q − ω2 pω sin (ωt) . 2 2 cos (ωt) + 2 2 (pω) + (q − ω ) (pω) + (q − ω 2 )2 Furthermore, F has amplitude 1 q (pω)2 + (q − ω 2 )2 and phase shift φ/ω where ´ ³ ( pω 6 0 if q − ω 2 = arctan q−ω2 φ= . π 2 if q − ω = 0 2 Theorem 6 shows us how to find a particular solution of the periodically— forced harmonic oscillator differential equation if p > 0 (meaning that damping is present) or if q 6= ω2 (even if damping is not present). We must still consider the case in which p = 0 (meaning that damping is not present) and q = ω 2 . This is the special case in which we get the phenomenon known as resonance. Before proceeding to study the case of resonance, let us make some observations about the conclusions of Theorem 6: First, suppose that p > 0 (meaning that damping is present). In this case, the forced response has amplitude 1 q . 2 2 2 (pω) + (q − ω ) It can be seen from this formula for the amplitude that if p is very large or ω is very large, then the amplitude of the forced response is very small. Next, suppose that p = 0 (meaning that no damping is present) and that q 6= ω2 : In this case, the forced response has amplitude 1 . |q − ω 2 | 11 and we see that if q is very close to ω2 , then the amplitude of the forced response is very large. This is what we call the “near—resonant” case. Example 7 Consider the undamped, forced harmonic oscillator differential equation d2 y + 4y = cos (t) . dt2 A particular solution of this equation is F (t) = 1 cos (t) . 3 The general solution is y (t) = c1 cos (2t) + c2 sin (2t) + 1 cos (t) . 3 Suppose that we wish to find the particular solution that satisfies initial conditions y (0) = y 0 (0) = 0. Since y 0 (t) = −2c1 sin (2t) + 2c2 cos (2t) − 1 sin (t) , 3 we must solve 1 =0 3 2c2 = 0. c1 + This gives us c1 = − 1 3 c2 = 0 and the particular solution 1 1 y (t) = − cos (2t) + cos (t) , 3 3 whose graph is shown below. 12 0.2 t 20 10 30 40 0 -0.2 -0.4 -0.6 Example 8 In the previous example, we had q = 4 and ω = 1 so q − ω2 = 3 is fairly large, meaning that the forced response has fairly small amplitude (1/3). Let us see what happens if we choose ω such that ω2 is closer to q. For example consider d2 y + 4y = cos (1.9t) . dt2 In this case, q − ω2 = 4 − (1.9)2 = 0.39 and the forced response is F (t) = 1 cos (1.9t) . 0.39 This forced response has amplitude 1/0.39 ≈ 2.5641. The general solution of the above differential equation is y = c1 cos (2t) + c2 sin (2t) + 1 cos (1.9t) . 0.39 Suppose that we wish to find the particular solution that satisfies initial conditions y (0) = y 0 (0) = 0. Since y 0 (t) = −2c1 sin (2t) + 2c2 cos (2t) − we must solve c1 + 1 =0 0.39 2c2 = 0. 13 1.9 sin (1.9t) , 0.39 This gives us c1 = − 1 0.39 c2 = 0 and the particular solution y (t) = − 1 1 cos (2t) + cos (1.9t) , 0.39 0.39 whose graph is shown below. 4 2 0 10 20 30 40 t 50 60 70 80 -2 -4 Forced harmonic oscillators are fascinating, are they not? 5 The Case of Resonance We now consider the differential equation dy d2 y + p + qy = cos (ωt) 2 dt dt where p = 0 and q = ω 2 . Thus, the differential equation that we are considering is d2 y + ω 2 y = cos (ωt) dt2 with parameter ω > 0. We claim that this differential equation has a solution of the form F (t) = t (a cos (ωt) + b sin (ωt)) . 14 As before, we determine what a and b must be in order to make this be true: Letting F be as defined above, we obtain dF = t (−ωa sin (ωt) + ωb cos (ωt)) + (a cos (ωt) + b sin (ωt)) dt = (a + ωtb) cos (ωt) + (−ωta + b) sin (ωt) and ¢ ¡ d2 F = − ωa + ω2 tb sin (ωt) + ωb cos (ωt) 2 dt ¡ ¢ + −ω 2 ta + ωb cos (ωt) − ωa sin (ωt) ¡ ¢ ¡ ¢ = −ω 2 ta + 2ωb cos (ωt) + −2ωa − ω2 tb sin (ωt) . If F is to be a solution, we must have ¡ 2 ¢ ¡ ¢ −ω ta + 2ωb cos (ωt) + −2ωa − ω2 tb sin (ωt) + ω 2 (ta cos (ωt) + tb sin (ωt)) = cos (ωt) for all real numbers t. Simplification of the above equation gives us 2ωb cos (ωt) − 2ωa sin (ωt) = cos (ωt) . Setting t = 0 yields 2ωb = 1 and setting t = π/ (2ω) yields −2ωa = 0. We conclude that a = 0 and b = 1/ (2ω). Let us check that 1 F (t) = t sin (ωt) 2ω is a solution of our differential equation: First note that dF 1 = (ωt cos (ωt) + sin (ωt)) dt 2ω 15 and Thus ¢ 1 ¡ 2 d2 F −ω = t sin (ωt) + ω cos (ωt) + ω cos (ωt) dt2 2ω ¢ 1 ¡ 2 −ω t sin (ωt) + 2ω cos (ωt) . = 2ω ¢ d2 F 1 ¡ 2 2 −ω + ω F = t sin (ωt) + 2ω cos (ωt) + ω2 2 dt 2ω = cos (ωt) µ ¶ 1 t sin (ωt) 2ω showing that F is indeed a solution. We remark that since ³ π´ sin (ωt) = cos ωt − , 2 we can also write the formula for F as F (t) = ³ π´ 1 t cos ωt − . 2ω 2 This forced response has a phase shift of π/ (2ω) and an amplitude that grows linearly as time goes on. If ω is very large, then the amplitude grows slowly; whereas, if ω is small, then the amplitude grows quickly. Example 9 Consider the undamped, forced harmonic oscillator differential equation d2 y + 4y = cos (2t) . dt2 A particular solution of this equation (whose graph is shown below) is 1 F (t) = t sin (2t) . 4 16 10 8 6 4 2 0 -2 10 20 t 30 40 -4 -6 -8 -10 The general solution is 1 y (t) = c1 cos (2t) + c2 sin (2t) + t sin (2t) . 4 Suppose that we wish to find the particular solution that satisfies initial conditions y (0) = y 0 (0) = 0. Since 1 1 y 0 (t) = −2c1 sin (2t) + 2c2 cos (2t) + t cos (2t) + sin (2t) , 2 4 we must solve c1 = 0 2c2 = 0. This gives us c1 = 0 c2 = 0 and the particular solution is 1 y (t) = t sin (2t) 4 whose graph is shown above. 17 6 More General Periodic Forcing Functions Now that we know how to solve and study solutions of the forced harmonic oscillator equation d2 y dy + p + qy = cos (ωt) , (7) dt2 dt we would like to be able to solve harmonic oscillator equations with more general sinusoidal forcing functions. In particular, we would like to be able to solve d2 y dy + p + qy = A cos (ωt − θ) (8) 2 dt dt where A, ω, and θ are given constants. Fortunately, it is easy to find a solution of equation (8) once we have found a solution of equation (7). In particular, suppose that F is a solution of equation (7) and define µ ¶ θ G (t) = AF t − . ω Then µ µ ¶ ¶ µ ¶ θ θ θ 0 G (t) + pG (t) + qG (t) = AF t − + pAF t − + qAF t − ω ω ω µ ¶ ¶ µ ¶¶ µ µ θ θ θ 00 0 + pF t − + qF t − =A F t− ω ω ω ¶¶ µ µ θ = A cos ω t − ω = A cos (ωt − θ) 00 0 00 which shows that G is a solution of equation (8). In summary, if F is a solution of the forced equation dy d2 y + p + qy = cos (ωt) , 2 dt dt ¡ ¢ then G (t) = AF t − ωθ is a solution of the forced equation dy d2 y + p + qy = A cos (ωt − θ) . 2 dt dt 18 Example 10 Solve the forced equation d2 y dy + 5 + 6y = 3 cos (t − 5) . 2 dt dt Solution 11 First, we note that the general solution of the unforced equation d2 y dy + 5 + 6y = 0 2 dt dt is N (t) = c1 e−3t + c2 e−2t . Next, we consider the forced equation d2 y dy + 5 + 6y = cos (t) . 2 dt dt 2 Since p = 5, q = 6, ω = 1, q − ω 2 = 5, and (pω)2 + (q − ω 2 ) = 50, we see by equation (4) that a particular solution of this forced equation is F (t) = 1 1 cos (t) + sin (t) . 10 10 Finally, we consider the forced equation d2 y dy + 5 + 6y = 3 cos (t − 5) . 2 dt dt A particular solution of this equation is µ ¶ θ G (t) = AF t − ω ¶ µ 1 1 cos (t − 5) + sin (t − 5) . =3 10 10 In conclusion, the general solution of the forced equation d2 y dy + 6y = 3 cos (t − 5) + 5 dt2 dt is y (t) = c1 e−3t + c2 e−2t + 3 (cos (t − 5) + sin (t − 5)) . 10 19 Example 12 Solve the forced equation d2 y dy + 5 + 6y = 2 sin (4t − π) . 2 dt dt Solution 13 First we use the trigonometric identity ³ π´ sin (α) = cos α − 2 to obtain ³ π´ 2 sin (4t − π) = 2 cos 4t − π − . 2 Thus, we can rewrite our problem as µ ¶ d2 y 3π dy . + 5 + 6y = 2 cos 4t − dt2 dt 2 Thus, A = 2, ω = 4, and θ = 3π/2. The general solution of the unforced equation, d2 y dy + 5 + 6y = 0 2 dt dt is N (t) = c1 e−3t + c2 e−2t . 2 Also, since p = 5, q = 6, q − ω 2 = −10, and (pω)2 + (q − ω 2 ) = 500, we see a solution of the forced equation d2 y dy + 5 + 6y = cos (4t) 2 dt dt is −1 1 cos (4t) + sin (4t) . 50 25 This means that a solution of the forced equation µ ¶ d2 y dy 3π + 5 + 6y = 2 cos 4t − dt2 dt 2 F (t) = 20 is µ ¶ θ G (t) = AF t − ω µ µ ¶¶ µ µ ¶¶¶ µ −1 3π 3π 1 cos 4 t − + sin 4 t − =2 50 8 25 8 µ ¶ µ ¶ 3π 3π 2 1 + sin 4t − . = − cos 4t − 25 2 25 2 In conclusion, the general solution of the forced equation µ ¶ d2 y dy 3π + 5 + 6y = 2 cos 4t − dt2 dt 2 is −3t y (t) = c1 e −2t + c2 e µ µ µ ¶ ¶¶ 3π 3π 1 − cos 4t − 2 sin 4t − . + 25 2 2 21