Forced second order ordinary differential equations You should already be familiar with solving simple second order differential equations of the form: a d2y dy b cy 0. 2 dx dx When the differential equation is equal to zero on the RHS we refer to it as homogeneous. Often however we are interested in forced differential equations of the form: a d2y dy b cy f x , 2 dx dx where a , b and c are simply numbers and f x is a function of x . The right-hand side can be any function but we will confine ourselves to looking at the three most common categories: polynomials, trigonometric and exponential. The first problem we come across is trying to find a function which, when put through the differential equation, correctly gives us the right-hand side. This is not as straightforward as we may like and often comes down to little more than guessing a general form of a solution then trying to make it fit. We call this function the particular solution, y p . There are some general rules to follow when dealing with the three categories of function given above. The particular solution is not enough to fully solve the problem as it will not have any arbitrary constants which would satisfy the boundary conditions. However, if we find a general solution to the homogeneous form of the same equation we already know that we can use it to satisfy the boundary conditions. Also, as this second solution is reduced to zero by the differential equation it will not affect the particular solution’s ability to give the correct RHS. We call the function that solves the homogeneous equation the complementary function, yc . The general solution to the differential equation is given by adding the particular and homogeneous parts together: y yc y p . We now demonstrate this method with an example of each of the types of function most commonly found on the RHS. Example 1 – Polynomials Q) Find the solution to the equation: d 2 y dy 2 y x2 , 2 dx dx subject to boundary conditions y0 0 and y' 0 0 . A) We will start by finding the particular solution. As we have an x 2 on the RHS we will guess that the particular solution is of the form: y p Ax 2 Bx C. To substitute this into the function we will also need the first and second derivative of yp : y p ' 2 Ax B, y p ' ' 2 A. This gives us: 2 A 2 Ax B 2 Ax2 Bx C x 2 . If we multiply out the LHS and collect powers of x we get: 2 Ax2 2 A 2B x 2 A B 2C x 2 . Now we can equate the powers of x on both sides of the equal sign: 2 A 1, 2 A 2 B 0, 2 A B 2C 0. This is now a set of three simultaneous equations to be solved. In this case we can use 1 1 the first equation to find A , then substitute that into the second to find B 2 2 3 and then use the third equation to find C . This gives us our particular solution: 4 1 1 3 y p x2 x 2 2 4 This is the solution that is in perfect balance to produce a single x when substituted into the differential equation, and has no room to allow us to solve the boundary conditions. Therefore we seek a solution to the homogeneous equation also: d 2 yc dyc 2 yc 0 dx 2 dx the subscript c indicating this is the complementary solution. The auxiliary equation is: m2 m 2m 0, giving m1 1 and m2 2 . The complementary solution is therefore: yc Ae x Be 2 x . Note that we must solve the boundary condition with the full solution and not just the complementary solution! So before solving for A and B we form the full general solution: y x y c y p Ae x Be 2 x 1 2 1 3 x x . 2 2 4 To solve the second boundary condition we will also need the first differential: 1 y ' x Ae x 2 Be 2 x x . 2 Thus the boundary conditions give us: y 0 A B 3 0, 4 1 y ' 0 A 2 B 0. 2 From the first we find A B 3 1 B ; using this in the second we find 3B 0 , so 4 4 1 2 and A , giving us a final answer of: 12 3 y 2 x 1 2 x 1 2 1 3 e e x x . 3 12 2 2 4 Example 2 – exponentials Q) Find the general solution to: d2y 4 y e3 x 2 dx A) Again we start by finding the particular solution. The only function which can differentiate to give a term containing e 3 x is Ae3 x , so we will take this as our guess and substitute it in: 9 Ae3x 4 Ae3x e3x , or, after collecting up like terms: 13 Ae3 x e3 x so we find that A 1 and our particular solution is: 13 yp 1 3x e . 13 Once again there are no arbitrary constants so to this we add the complementary solution, given by: d 2 yc 4 yc 0. dx 2 Forming the auxiliary equation: m2 4 0, the roots of this are purely complex, m 2i , thus the complementary solution is given by: yc A cos2 x B sin 2 x . As this question didn’t come with any boundary conditions we cannot solve for A and B , so it is sufficient to give the full general solution: y yc y p , y A cos2 x B sin 2 x Example 3 – trigonometric Q) Find the general solution to: 1 3x e . 13 d 2 y dy 2 y sin x dx 2 dx A) This time in our search for a particular solution we will try: y p A sin x B cos x . We must include both the sin x and cosx terms as one can differentiate into the other. In order to substitute the particular solution into the equation we calculate the first and second differentials: y p ' A cosx B sin x , y p ' ' A sin x B cosx . Substituting this into the question we find: A sin x B cosx A cosx B sin x 2A sin x B cosx sin x, then collecting on sin x and cosx : A B 2 Asin x B A 2Bcosx sin x. Equating coefficients we find: 3 A B 1, A 3B 0. Solving these simultaneously gives: A 3 1 ,B . 10 10 Thus our particular solution is: yp 3 1 sin x cos x . 10 10 Next we look to solve the homogeneous equation: d 2 yc dyc 2 yc 0. dx 2 dx Forming the auxiliary equation: m2 m 2 0, we find m1 2 and m2 1 , giving the complementary solution: y c Ae 2 x Be x . Hence the full general solution is: y Ae 2 x Be x 3 1 sin x cos x . 10 10 Example 4 – Mixed Q) Find the general solution to: d2y dy 4 3 y 4 x 3e2 x 2 dx dx A) This time we have a mix of an exponential with a linear term on the RHS. Thus when we are guessing for a particular solution we will need both an exponential term and a linear term. So we will try: y p Ae2 x Bx C Substituting this in to the equation we find: 4 Ae2 x 4 2 Ae2 x B 3 Ae2 x Bx C 4 x 3e2 x . After expanding out and collecting the e 2 x terms, the x terms and the constants, we have: Ae 2 x 3Bx 4 B 3C 4 x 3e 2 x . Equating coefficients on both sides we find: A 3, 3B 4, 4B 3C 0. Solving these gives us A 3 , B 4 / 3 and C 16 / 9 , so the particular solution is: y p 3e 2 x 4 x 16 . 3 9 To complete our solution we will solve the homogenous equation: d 2 yc dy 4 c 3 yc 0, 2 dx dx with the auxiliary: m2 4m 3 0, giving m1 1 and m2 3 giving the complementary solution: yc Ae x Be 3x . Finally we can form the general solution to the differential equation: y Ae x Be 3 x 3e2 x 4 x 16 3 9