You are on page 1of 11

Nonhomogeneous Linear Equations

In this section we learn how to solve second-order nonhomogeneous linear differential equations with constant coefcients, that is, equations of the form
1

ay by cy G x

where a, b, and c are constants and G is a continuous function. The related homogeneous equation
2

ay by cy 0

is called the complementary equation and plays an important role in the solution of the original nonhomogeneous equation (1).
3 Theorem The general solution of the nonhomogeneous differential equation (1) can be written as

y x yp x yc x where yp is a particular solution of Equation 1 and yc is the general solution of the complementary Equation 2.
Proof All we have to do is verify that if y is any solution of Equation 1, then y yp is a solution of the complementary Equation 2. Indeed

a y yp b y yp c y yp ay ayp by byp cy cyp ay by cy ayp by p cyp t x t x 0 We know from Additional Topics: Second-Order Linear Differential Equations how to solve the complementary equation. (Recall that the solution is yc c1 y1 c2 y2 , where y1 and y2 are linearly independent solutions of Equation 2.) Therefore, Theorem 3 says that we know the general solution of the nonhomogeneous equation as soon as we know a particular solution yp . There are two methods for nding a particular solution: The method of undetermined coefcients is straightforward but works only for a restricted class of functions G. The method of variation of parameters works for every function G but i0s usually more difcult to apply in practice. The Method of Undetermined Coefficients We rst illustrate the method of undetermined coefcients for the equation ay by cy G x where G x) is a polynomial. It is reasonable to guess that there is a particular solution yp that is a polynomial of the same degree as G because if y is a polynomial, then ay by cy is also a polynomial. We therefore substitute yp x a polynomial (of the same degree as G ) into the differential equation and determine the coefcients.
EXAMPLE 1 Solve the equation y y 2y x 2.
SOLUTION The auxiliary equation of y y 2y 0 is

r 2 r 2 r 1r 2 0
1

2 NONHOMOGENEOUS LINEAR EQUATIONS

with roots r 1, 2. So the solution of the complementary equation is yc c1 e x c2 e2 x Since G x x 2 is a polynomial of degree 2, we seek a particular solution of the form yp x Ax 2 Bx C Then yp 2 Ax B and yp 2 A so, substituting into the given differential equation, we have 2 A 2 Ax B 2Ax 2 Bx C x 2 or
Figure 1 shows four solutions of the differential equation in Example 1 in terms of the particular solution yp and the functions f x e x and t x e2 x.

2 Ax 2 2 A 2 B x 2 A B 2C x 2

Polynomials are equal when their coefcients are equal. Thus 2 A 1 2A 2B 0 2 A B 2C 0

The solution of this system of equations is A 1 2 B 1 2 C 3 4

8 yp+2f+3g yp+3g _3 yp _5 yp+2f 3

A particular solution is therefore


1 3 2 yp x 1 2x 2x 4

and, by Theorem 3, the general solution is


1 3 2 y yc yp c1 e x c2 e2 x 1 2x 2x 4

FIGURE 1

If G x (the right side of Equation 1) is of the form Ce k x, where C and k are constants, then we take as a trial solution a function of the same form, yp x Ae k x, because the derivatives of e k x are constant multiples of e k x.
EXAMPLE 2 Solve y 4 y e 3 x.
SOLUTION The auxiliary equation is r 2 4 0 with roots 2i, so the solution of the
Figure 2 shows solutions of the differential equation in Example 2 in terms of yp and the functions f x cos 2 x and t x sin 2 x. Notice that all solutions approach as x l and all solutions resemble sine functions when x is negative.

complementary equation is yc x c1 cos 2 x c2 sin 2 x For a particular solution we try yp x Ae 3x. Then yp 3Ae 3x and yp 9Ae 3x. Substituting into the differential equation, we have 9Ae 3x 4 Ae 3x e 3x

yp+f+g _4 yp+f

yp+g yp 2

1 so 13Ae 3x e 3x and A 13 . Thus, a particular solution is 1 3x yp x 13 e

_2

and the general solution is


1 3x y x c1 cos 2 x c2 sin 2 x 13 e

FIGURE 2

If G x is either C cos kx or C sin kx, then, because of the rules for differentiating the sine and cosine functions, we take as a trial particular solution a function of the form yp x A cos kx B sin kx

NONHOMOGENEOUS LINEAR EQUATIONS 3

EXAMPLE 3 Solve y y 2 y sin x.


SOLUTION We try a particular solution

yp x A cos x B sin x Then yp A sin x B cos x yp A cos x B sin x

so substitution in the differential equation gives A cos x B sin x A sin x B cos x 2 A cos x B sin x sin x or This is true if 3A B 0 The solution of this system is
1 A 10 3 B 10

3A B cos x A 3B sin x sin x

and

A 3B 1

so a particular solution is
1 3 yp x 10 cos x 10 sin x

In Example 1 we determined that the solution of the complementary equation is yc c1 e x c2 e2 x. Thus, the general solution of the given equation is
1 y x c1 e x c2 e2 x 10 cos x 3 sin x

If G x is a product of functions of the preceding types, then we take the trial solution to be a product of functions of the same type. For instance, in solving the differential equation y 2 y 4 y x cos 3x we would try yp x Ax B cos 3x Cx D sin 3x If G x is a sum of functions of these types, we use the easily veried principle of superposition, which says that if yp1 and yp2 are solutions of ay by cy G1 x respectively, then yp1 yp2 is a solution of ay by cy G1 x G2 x
EXAMPLE 4 Solve y 4 y xe x cos 2 x.

ay by cy G2 x

plementary equation is yc x c1 e 2 x c2 e2 x. For the equation y 4 y xe x we try yp1 x Ax Be x 1 Ax A Be x, yp 1 Ax 2 A Be x, so substitution in the equation Then yp gives Ax 2 A Be x 4 Ax Be x xe x or 3Ax 2 A 3Be x xe x

SOLUTION The auxiliary equation is r 2 4 0 with roots 2, so the solution of the com-

4 NONHOMOGENEOUS LINEAR EQUATIONS

2 Thus, 3A 1 and 2 A 3B 0, so A 1 3 , B 9 , and 2 x yp1 x ( 1 3 x 9 )e

For the equation y 4 y cos 2 x, we try yp2 x C cos 2 x D sin 2 x


In Figure 3 we show the particular solution yp yp1 yp 2 of the differential equation in Example 4. The other solutions are given in terms of f x e 2 x and t x e2 x.

Substitution gives 4 C cos 2 x 4 D sin 2 x 4 C cos 2 x D sin 2 x cos 2 x or Therefore, 8C 1, 8 D 0, and 8C cos 2 x 8 D sin 2 x cos 2 x

5 yp+2f+g yp+g yp+f _4 yp _2 1

yp2 x 1 8 cos 2 x By the superposition principle, the general solution is

FIGURE 3

2 1 x y yc yp1 yp2 c1 e 2 x c2 e2 x ( 1 3 x 9 )e 8 cos 2 x

Finally we note that the recommended trial solution yp sometimes turns out to be a solution of the complementary equation and therefore cant be a solution of the nonhomogeneous equation. In such cases we multiply the recommended trial solution by x (or by x 2 if necessary) so that no term in yp x is a solution of the complementary equation.
EXAMPLE 5 Solve y y sin x.
SOLUTION The auxiliary equation is r 2 1 0 with roots i, so the solution of the com-

plementary equation is yc x c1 cos x c2 sin x Ordinarily, we would use the trial solution yp x A cos x B sin x but we observe that it is a solution of the complementary equation, so instead we try yp x Ax cos x Bx sin x Then y p x A cos x Ax sin x B sin x Bx cos x yp x 2 A sin x Ax cos x 2 B cos x Bx sin x
The graphs of four solutions of the differential equation in Example 5 are shown in Figure 4.

Substitution in the differential equation gives yp yp 2 A sin x 2B cos x sin x so A 1 2 , B 0, and

_2 yp _4

yp x 1 2 x cos x The general solution is y x c1 cos x c2 sin x 1 2 x cos x

FIGURE 4

NONHOMOGENEOUS LINEAR EQUATIONS 5

We summarize the method of undetermined coefcients as follows:


1. If G x e kxP x, where P is a polynomial of degree n, then try yp x e kxQ x,

where Q x is an nth-degree polynomial (whose coefcients are determined by substituting in the differential equation.) polynomial, then try yp x e kxQ x cos mx e kxR x sin mx where Q and R are nth-degree polynomials.

2. If G x e kxP x cos mx or G x e kxP x sin mx, where P is an nth-degree

Modication: If any term of yp is a solution of the complementary equation, multiply yp by x (or by x 2 if necessary).
EXAMPLE 6 Determine the form of the trial solution for the differential equation

y 4y 13y e 2 x cos 3x.


SOLUTION Here G x has the form of part 2 of the summary, where k 2, m 3, and

P x 1. So, at rst glance, the form of the trial solution would be yp x e 2 x A cos 3x B sin 3x

But the auxiliary equation is r 2 4r 13 0, with roots r 2 3i, so the solution of the complementary equation is yc x e 2 xc1 cos 3x c2 sin 3x This means that we have to multiply the suggested trial solution by x. So, instead, we use yp x xe 2 x A cos 3x B sin 3x

The Method of Variation of Parameters Suppose we have already solved the homogeneous equation ay by cy 0 and written the solution as
4

y x c1 y1 x c2 y2 x

where y1 and y2 are linearly independent solutions. Lets replace the constants (or parameters) c1 and c2 in Equation 4 by arbitrary functions u1 x and u2 x. We look for a particular solution of the nonhomogeneous equation ay by cy G x of the form
5

yp x u1 x y1 x u2 x y2 x

(This method is called variation of parameters because we have varied the parameters c1 and c2 to make them functions.) Differentiating Equation 5, we get
6

yp u1 y1 u2 y2 u1 y1 u2 y2

Since u1 and u2 are arbitrary functions, we can impose two conditions on them. One condition is that yp is a solution of the differential equation; we can choose the other condition so as to simplify our calculations. In view of the expression in Equation 6, lets impose the condition that
7

y1 u2 y2 0 u1

6 NONHOMOGENEOUS LINEAR EQUATIONS

Then

yp u1 y1 u2 y2 u1 y1 u2 y2

Substituting in the differential equation, we get a u1 y1 u2 y2 u1 y1 u2 y2 b u1 y1 u2 y2 c u1 y1 u2 y2 G or


8

u1ay1 by1 cy1 u2ay2 by2 cy2 a u1 y1 u2 y2 G

But y1 and y2 are solutions of the complementary equation, so ay1 by1 cy1 0 and Equation 8 simplies to
9

and

ay2 by2 cy2 0

a u1 y1 u2 y2 G

Equations 7 and 9 form a system of two equations in the unknown functions u 1 and u 2. After solving this system we may be able to integrate to nd u1 and u2 and then the particular solution is given by Equation 5.
EXAMPLE 7 Solve the equation y y tan x, 0 x 2.

y y 0 is c1 sin x c2 cos x. Using variation of parameters, we seek a solution of the form yp x u1 x sin x u2 x cos x Then Set
10

SOLUTION The auxiliary equation is r 2 1 0 with roots i, so the solution of

yp u1 sin x u2 cos x u1 cos x u2 sin x

u1 sin x u2 cos x 0 yp u1 cos x u2 sin x u1 sin x u2 cos x

Then

For yp to be a solution we must have


11

yp yp u1 cos x u2 sin x tan x

Solving Equations 10 and 11, we get


Figure 5 shows four solutions of the differential equation in Example 7.

u1 sin 2x cos 2x cos x tan x u1 sin x u1 x cos x

2.5

(We seek a particular solution, so we dont need a constant of integration here.) Then, from Equation 10, we obtain
0 yp _1
2

u2

sin x sin 2x cos 2x 1 u1 cos x sec x cos x cos x cos x u2 x sin x lnsec x tan x

FIGURE 5

So

NONHOMOGENEOUS LINEAR EQUATIONS 7

(Note that sec x tan x 0 for 0 x 2.) Therefore yp x cos x sin x sin x lnsec x tan x cos x cos x lnsec x tan x and the general solution is y x c1 sin x c2 cos x cos x lnsec x tan x

Exercises
A Click here for answers.
110

Click here for solutions.

16. y 3 y 4 y x 3 xe x 17. y 2 y 10 y x 2ex cos 3 x 18. y 4 y e 3x x sin 2 x


Solve the differential equation or initial-value problem using the method of undetermined coefcients.
1. y 3 y 2 y x 3. y 2 y sin 4 x 5. y 4 y 5 y e 7. y y e x x 3, 8. y 4 y e x cos x, 9. y y xe x,
x 2

2. y 9 y e

3x

1922

4. y 6 y 9 y 1 x 6. y 2 y y xex

Solve the differential equation using (a) undetermined coefcients and (b) variation of parameters.

19. y 4 y x 20. y 3 y 2 y sin x 21. y 2 y y e 2 x 22. y y e x


y 0 2, y 0 1,

y0 0 y0 2 y0 0

y 0 2,

y0 1 y 0 1,

10. y y 2 y x sin 2 x,

2328 Solve the differential equation using the method of variation of parameters.

; 1112

Graph the particular solution and several other solutions. What characteristics do these solutions have in common?

23. y y sec x, 0 x 2 24. y y cot x, 0 x 2 25. y 3 y 2 y

11. 4 y 5 y y e x 12. 2 y 3 y y 1 cos 2 x


1 1 ex

Write a trial solution for the method of undetermined coefcients. Do not determine the coefcients.
13. y 9 y e
2x

13 18

26. y 3 y 2 y sine x 27. y y

x sin x
2 x

1 x e2 x x3

14. y 9 y xe

cos x

28. y 4 y 4 y

15. y 9 y 1 xe 9 x

8 NONHOMOGENEOUS LINEAR EQUATIONS

Answers
S

Click here for solutions.


1 3 7 4

1. y c1 e2 x c2 ex 2 x 2 2 x 3. y c1 c2 e 2 x
2x 1 40

1 cos 4 x 20 sin 4 x 1 5. y e c1 cos x c2 sin x 10 ex 3 11 1 7. y 2 cos x 2 sin x 2 e x x 3 6x 1 9. y e x ( 2 x 2 x 2) 5 11. The solutions are all asymptotic to yp e x10 as x l . Except for yp , all solutions approach _2 4 yp either or as x l .

_4

13. 15. 17. 19. 21. 23. 25. 27.

yp Ae 2 x Bx 2 Cx D cos x Ex 2 Fx G sin x yp Ax Bx C e 9 x yp xex Ax 2 Bx C cos 3 x Dx 2 Ex F sin 3 x y c1 cos 2 x c2 sin 2 x 1 4x y c1e x c2 xe x e 2 x y c1 x sin x c2 ln cos x cos x y c1 ln1 ex e x c2 ex ln1 ex e 2 x x x x x y [c1 1 [c2 1 2 x e x dx]e 2 x e x dx]e

NONHOMOGENEOUS LINEAR EQUATIONS 9

Solutions: Nonhomogeneous Linear Equations


1. The auxiliary equation is r 2 + 3r + 2 = (r + 2)(r + 1) = 0, so the complementary solution is
0 = 2Ax + B and yc (x) = c1 e2x + c2 ex . We try the particular solution yp (x) = Ax2 + Bx + C , so yp 00 yp = 2A. Substituting into the differential equation, we have (2A) + 3(2Ax + B ) + 2(Ax2 + Bx + C ) = x2 or

2Ax2 + (6A + 2B )x + (2A + 3B + 2C ) = x2 . Comparing coefcients gives 2A = 1, 6A + 2B = 0, and 2A + 3B + 2C = 0, so A = 1 , B = 3 , and C = 2 2 y (x) = yc (x) + yp (x) = c1 e
2x 7 . 4 3 x 2

Thus the general solution is +7 . 4

+ c2 e

1 2 x 2

3. The auxiliary equation is r 2 2r = r (r 2) = 0, so the complementary solution is yc (x) = c1 + c2 e2x . Try the
0 particular solution yp (x) = A cos 4x + B sin 4x, so yp = 4A sin 4x + 4B cos 4x 00 and yp = 16A cos 4x 16B sin 4x. Substitution into the differential equation

gives (16A cos 4x 16B sin 4x) 2(4A sin 4x + 4B cos 4x) = sin 4x

A= sin 4x.
1 40 1 40

(16A 8B ) cos 4x + (8A 16B ) sin 4x = sin 4x. Then 16A 8B = 0 and 8A 16B = 1
1 and B = 20 . Thus the general solution is y(x) = yc (x) + yp (x) = c1 + c2 e2x +

cos 4x

1 20

5. The auxiliary equation is r 2 4r + 5 = 0 with roots r = 2 i, so the complementary solution is Aex 4(Aex ) + 5(Aex ) = ex y (x) = e (c1 cos x + c2 sin x) +
2x

0 00 = Aex and yp = Aex . Substitution gives yc (x) = e2x (c1 cos x + c2 sin x). Try yp (x) = Aex , so yp

10Aex = ex

A=

1 . 10

Thus the general solution is

1 x e . 10

7. The auxiliary equation is r 2 + 1 = 0 with roots r = i, so the complementary solution is Aex + Aex = ex

0 00 yc (x) = c1 cos x + c2 sin x. For y00 + y = ex try yp1 (x) = Aex . Then yp = yp = Aex and substitution gives 1 1 00 3 3 2 1 x A= 1 2 , so yp1 (x) = 2 e . For y + y = x try yp2 (x) = Ax + Bx + Cx + D.

0 00 = 3Ax2 + 2Bx + C and yp = 6Ax + 2B . Substituting, we have Then yp 2 2

6Ax + 2B + Ax3 + Bx2 + Cx + D = x3 , so A = 1, B = 0, 6A + C = 0 C = 6, and 2B + D = 0


x 3 y (x) = yc (x) + yp1 (x) + yp2 (x) = c1 cos x + c2 sin x + 1 2 e + x 6x. But 2 = y (0) = c1 + 1 2

D = 0. Thus yp2 (x) = x3 6x and the general solution is 6 c2 =


11 . 2

1 2

c1 =

3 2

and 0 = y0 (0) = c2 + y (x) =


3 2

Thus the solution to the initial-value problem is

cos x +

11 2

sin x + 1 ex + x3 6x. 2

9. The auxiliary equation is r 2 r = 0 with roots r = 0, r = 1 so the complementary solution is yc (x) = c1 + c2 ex . Try yp (x) = x(Ax + B )ex so that no term in yp is a solution of the complementary equation. Then
0 00 yp = (Ax2 + (2A + B )x + B )ex and yp = (Ax2 + (4A + B )x + (2A + 2B ))ex . Substitution into the

differential equation gives (Ax2 + (4A + B )x + (2A + 2B ))ex (Ax2 + (2A + B )x + B )ex = xex 2 (2Ax + (2A + B ))ex = xex A = 1 , B = 1. Thus yp (x) = 1 x x ex and the general solution is 2 2 2 y (x) = c1 + c2 ex + 1 x x ex . But 2 = y (0) = c1 + c2 and 1 = y0 (0) = c2 1, so c2 = 2 and c1 = 0. The 2 2 2 solution to the initial-value problem is y (x) = 2ex + 1 x x ex = ex 1 x x+2 . 2 2

10 NONHOMOGENEOUS LINEAR EQUATIONS

11. yc (x) = c1 ex/4 + c2 ex . Try yp (x) = Aex . Then 10Aex = ex , so A =


1 10

and the general solution is


1 x e . 10

y (x) = c1 ex/4 + c2 ex +

The solutions are all composed

of exponential curves and with the exception of the particular solution (which approaches 0 as x ), they all approach either or as x . As x , all solutions are asymptotic to yp =
1 x e . 10

13. Here yc (x) = c1 cos 3x + c2 sin 3x. For y00 + 9y = e2x try yp1 (x) = Ae2x and for y 00 + 9y = x2 sin x try yp2 (x) = (Bx2 + Cx + D) cos x + (Ex2 + F x + G) sin x. Thus a trial solution is yp (x) = yp1 (x) + yp2 (x) = Ae2x + (Bx2 + Cx + D) cos x + (Ex2 + F x + G) sin x. 15. Here yc (x) = c1 + c2 e9x . For y 00 + 9y0 = 1 try yp1 (x) = Ax (since y = A is a solution to the complementary equation) and for y 00 + 9y0 = xe9x try yp2 (x) = (Bx + C )e9x . 17. Since yc (x) = ex (c1 cos 3x + c2 sin 3x) we try yp (x) = x(Ax2 + Bx + C )ex cos 3x + x(Dx2 + Ex + F )ex sin 3x (so that no term of yp is a solution of the complementary equation).
Note: Solving Equations (7) and (9) in The Method of Variation of Parameters gives

u0 1 =

Gy2 0 0 a (y1 y2 y2 y1 )

and

u0 2 =

Gy1 0 0 a (y1 y2 y2 y1 )

We will use these equations rather than resolving the system in each of the remaining exercises in this section.

19. (a) The complementary solution is yc (x) = c1 cos 2x + c2 sin 2x. A particular solution is of the form yp (x) = Ax + B . Thus, 4Ax + 4B = x solution is y = yc + yp = c1 cos 2x + c2 sin 2x + 1 x. 4 A=
1 4

and B = 0 yp (x) = 1 x. Thus, the general 4

(b) In (a), yc (x) = c1 cos 2x + c2 sin 2x, so set y1 = cos 2x, y2 = sin 2x. Then
0 0 1 y1 y2 y2 y1 = 2 cos2 2x + 2 sin2 2x = 2 so u0 1 = 2 x sin 2x R 1 1 1 1 u1 (x) = 2 x sin 2x dx = 4 x cos 2x + 2 sin 2x [by parts] and u0 2 = 2 x cos 2x R u2 (x) = 1 x cos 2xdx = 1 x sin 2x + 1 cos 2x [by parts]. Hence 2 4 2 1 1 1 yp (x) = 4 x cos 2x + 2 sin 2x cos 2x + 4 x sin 2x + 1 cos 2x sin 2x = 1 x. Thus 2 4

x. y (x) = yc (x) + yp (x) = c1 cos 2x + c2 sin 2x + 1 4

21. (a) r 2 r = r (r 1) = 0
2x

r = 0, 1, so the complementary solution is yc (x) = c1 ex + c2 xex . A particular


x

solution is of the form yp (x) = Ae2x . Thus 4Ae2x 4Ae2x + Ae2x = e2x

yp (x) = e . So a general solution is y (x) = yc (x) + yp (x) = c1 e + c2 xe + e2x .

Ae2x = e2x
x

A=1

0 0 y2 y1 = e2x (1 + x) xe2x = e2x (b) From (a), yc (x) = c1 ex + c2 xex , so set y1 = ex , y2 = xex . Then, y1 y2 R x 0 x x x and so u1 = xe u1 (x) = xe dx = (x 1)e [by parts] and u0 2 = e R x x 2x 2x 2x u2 (x) = e dx = e . Hence yp (x) = (1 x)e + xe = e and the general solution is

y (x) = yc (x) + yp (x) = c1 ex + c2 xex + e2x .

NONHOMOGENEOUS LINEAR EQUATIONS 11

23. As in Example 6, yc (x) = c1 sin x + c2 cos x, so set y1 = sin x, y2 = cos x. Then sec x cos x 0 0 y1 y2 y2 y1 = sin2 x cos2 x = 1, so u0 = 1 u1 (x) = x and 1 = 1 R sec x sin x u0 . Hence = tan x u2 (x) = tan xdx = ln |cos x| = ln(cos x) on 0 < x < 2 = 2 1 yp (x) = x sin x + cos x ln(cos x) and the general solution is y (x) = (c1 + x) sin x + [c2 + ln(cos x)] cos x.
0 0 y2 y1 = e3x . So u0 25. y1 = ex , y2 = e2x and y1 y2 1 =

u1 (x) =

y (x) = [c1 + ln(1 + ex )]ex + [c2 ex + ln(1 + ex )]e2x .

yp (x) = ex ln(1 + ex ) + e2x [ln(1 + ex ) ex ] and the general solution is

ex ex ex dx = ln(1 + ex ). u0 = 3x so 2 = 1 + ex (1 + ex )e3x e + e2x Z ex ex + 1 u2 (x) = ex = ln(1 + ex ) ex . Hence dx = ln 3 x 2 x e +e ex

e2x ex = and x 3 x (1 + e )e 1 + ex

ex 0 ex 0 0 y2 y1 = 2. So u0 , u2 = and 27. y1 = ex , y2 = ex and y1 y2 1 = 2x 2x Z x Z x e e dx + ex dx. Hence the general solution is yp (x) = ex 2x 2x Z x Z x e e y (x) = c1 dx ex + c2 + dx ex . 2x 2x

You might also like