## Calculus Of One Real Variable By Pheng Kim Ving Chapter 16: Differential Equations Group 16.3: Second-Order Linear Non-Homogeneous Equations Section 16.3.1: Equations With Constant Coefficients – Undetermined Coefficients

16.3.1
Equations With Constant Coefficients – Undetermined Coefficients

 1. Second-Order Linear Non-Homogeneous Differential Equations With     Constant Coefficients

In this section, we'll use the abbreviations:

 “DE” for “differential equation”, “GS” for “general solution”, “HDE” for “homogeneous differential equation”, “HE” for “homogeneous equation”, “NHDE” for “non-homogeneous differential equation”, “NHE” for “non-homogeneous equation”, and “PS” for “particular solution”.

Definition 1.1 – Second-Order Linear Non-Homogeneous Differential Equations With
Constant Coefficients

 A differential equation of the form:   y'' + by' + cy = f (x),   where b and c are constants and f is a continuous function that isn't identically 0, is called a second-order linear non-homogeneous differential equation with constant coefficients.

Note that there are only the terms for y, y', and y'' on the left-hand side. Everything else must be on the right-hand side and is
a part of f. Distinguish between the functions y and f. Observe that while the equation is linear, each function y, y', y'', and
f (x) doesn't have to be linear. For example, y = 2x + 3 is linear while y = x2 + 3 and y = e2x + 3 aren't.

 2. General Solutions Of The Non-Homogeneous Equations

Suppose yn1 is a PS of the NHE:

y'' + by' + cy = f (x)

and yh is the GS of the corresponding HE:

y'' + by' + cy = 0.

Then intuitively the sum yh + yn1 should be the GS of the NHE, because: (1) when we substitute yh + yn1 into the NHE, the
expression containing yh and its derivatives equals 0, since yh is the GS of the HE, (2) the expression containing yn1 and its
derivatives equals f (x), since yn1 is a PS of the NHE, and (3) there are 2 arbitrary constants in yh + yn1, they're the arbitrary
constants of yh. And so the substituted sum equals 0 + f (x) = f (x). This intuition is confirmed true in the theorem below.

Theorem 2.1 – General Solutions Of The Non-Homogeneous Equations

 Let:     ((GS Of NHE) = (GS Of HE) + (A PS Of NHE)).

Proof
First let's prove that yh + yn1 is a solution of the NHE [2.1]. We have:

Thus yn2yn1 is a PS of the HE. Let yh1 be that PS, so that yn2yn1 = yh1, or yn2 = yh1 + yn1. Now yh1 can be obtained from yh.
As a consequence, yn2 can be obtained from yh + yn1. Hence yh + yn1 is the GS of the NHE [2.1].
EOP

 3. Principle Of Superposition

Because 0 + f (x) = f (x), by Theorem 2.1 we see that:

(GS of y'' + by' + cy = 0 + f (x)) = (GS of y'' + by' + cy = 0) + (PS of y'' + by' + cy = f (x)).

This leads us to investigate to see if the property:

(solution of y'' + by' + cy = f1 (x) + f2 (x)) = (solution of y'' + by' + cy = f1 (x)) + (solution of y'' + by' + cy = f2 (x))

is also true for any functions f1 (x) and f2 (x). Intuitively this is obviously true. Let y1 be a solution of y'' + by' + cy = f1 (x) and
y2 a solution of y'' + by' + cy = f2 (x). Substituting y1 + y2 for y in the expression y'' + by' + cy, we get f1 (x) + f2 (x), because
the expression containing y1 and its derivatives equals f1 (x) and the expression containing y2 and its derivatives equals f2 (x).

It turns out that this property is indeed true, as asserted by Theorem 3.1 below, which establishes the relationship between the
solutions of the equations:

y'' + by' + cy = f 1(x),
y'' + by' + cy = f 2(x), and
y'' + by' + cy = f 1(x) + f 2(x),

the relationship being that the sum of a solution of the 1st equation and a solution of the 2nd equation is a solution of the 3rd
equation. Letting “RHS” stands for “right-hand side”, this property can be thought of as:

(solution when RHS is) ( f1(x) + f2(x)) = (solution when RHS is) ( f1(x)) + (solution when RHS is) ( f2(x)).

This linearity property of the solutions is called the principle of superposition, as a solution of the 3rd equation is obtained by
superimposing a solution of 1st equation on a solution of the 2nd equation.

Theorem 3.1 – Principle Of Superposition

 If y1 is a solution of the equation:     This property is called the principle of superposition, because a solution of Eq. [3.3] is obtained by superimposing a solution of Eq. [3.1] on a solution of Eq. [3.2].

Proof

So y1 + y2 is a solution of y'' + by' +  cy = f1(x) + f2(x).

EOP

##### Remarks 3.1

a. The sum of a solution of Eq. [3.1] and a solution of Eq. [3.2] is a solution of Eq. [3.3], not a solution of the equation that's
the sum of Eqs. [3.1] and [3.2], which is 2( y'' + by' + cy) = f1(x) + f2(x), or y'' + by' + cy = (1/2)( f1(x) + f2(x)).

b. It's straightforward to show that the principle of superposition is valid for any number of equations. Let n be any integer
greater than or equal to 2. If y1, y2, ..., and yn are the solutions of the equations y'' + by' +  cy = f1(x), y'' + by' +  cy =
f2(x), ..., and y'' + by' + cy = fn(x) respectively, then y1 + y2 + ... + yn is a solution of the equation y'' + by' +  cy = f1(x) +
f2(x) + ... + fn(x).

 4. The Method Of Undetermined Coefficients

Clearly Theorem 2.1 tells us that to solve (find the GS of) a second-order linear NHDE with constant coefficients, we have to
find the GS of the corresponding HE and a PS of the NHE, then we add them up to get the GS of the NHDE. We already know
how to find the GS of a HE. We'll present a method to determine a PS of the NHE, called the method of undetermined
coefficients
. The reason for this naming is clear later on. This method applies only to some types of functions on the right-hand
side of the NHE, ie the function f (x).

When f (x) Is A Non-0 Constant

##### Solving By Inspection

First we show that when f (x) is constant, we can find a PS of the NHE simply by inspection. Suppose we're to find a PS of the
NHE:

y'' – 7y' + 10y = 20.

Since a non-0 constant, 20 in this case, is a polynomial (of degree 0), finding a PS of the NHE where f (x) is a polynomial can
be done by the method of undetermined coefficients, as illustrated in Example 4.2 below.

Finding a PS of the NHE where f (x) is a non-0 constant can also be done by inspection. The function f (x) is the constant 20. If
y is a constant say k, then y' = 0 and y'' = 0, so when we compute y'' – 7y' + 10y, it's a constant, namely 10k, and thus we
can choose k so that y'' – 7y' + 10y = 20. We'll then have 10k = 20, consequently k = 20/10 = 2. Hence we'll try the function
y = 2 as a PS of the NHE. We use inspection in Example 4.1 below.

##### Example 4.1

Find the GS of the equation y'' – 7y' + 10y = 20. Check the answer.

Solution

For a PS of the given NHE y'' – 7y' + 10y = 20, let's try y = 20/10 = 2. Then y' = 0, y'' = 0, and y'' – 7y' + 10y = 0 – 7(0)
+ 10(2) = 20. So a PS of the NHE is y = 2.

Thus the GS of the NHE is y = c1e5x + c2e2x + 2.

Check:

y = c1e5x + c2e2x + 2,
y' = 5c1e5x + 2c2e2x,
y'' = 25c1e5x + 4c2e2x,
y'' – 7y' + 10y = (25c1e5x + 4c2e2x) – 7(5c1e5x + 2c2e2x) + 10(c1e5x + c2e2x + 2) = 20.

Indeed the GS y = c1e5x + c2e2x + 2 is correct.
EOS

##### Finding A Particular Solution By The Method Of Undetermined Coefficients

When f (x) Is A Polynomial Function

Let's find a PS of the NHE:

y'' + 2y' – 3y = 2x.

The function f (x) is a linear function, f (x) = 2x. So y should also be a linear function y = a1x + a0, so that when we compute
y'' + 2y' – 3y, it's also a linear function, and thus we can select the coefficients a1 and a0 that make y'' + 2y' – 3y equal 2x.
Let's try y = ax, where a is a constant to be determined such that y'' + 2y' – 3y = 2x. We have:

y = ax,     y' = a,     y'' = 0,
2x = y'' + 2y' – 3y = 0 + 2a – 3ax = – 3ax + 2a,
– 3ax + 2a = 2x,
these 2 linear functions are the same thing if the coefficients of like powers of x are equal; so let's equate the coefficients of
like powers of x:

a = –2/3 and a = 0, impossible,

the system has no solutions.

The trial PS y = ax doesn't work.

So what do we do? Ok, there's one remaining thing to do: it's to try the linear function of the general form y = a1x + a0, where
a1 and a0 are constants to be determined such that y'' + 2y' – 3y = 2x. We have:

y = a1x + a0,     y' = a1,     y'' = 0,

2x = y'' + 2y' – 3y = 0 + 2a1 – 3(a1x + a0) = – 3a1x + 2a1 – 3a0,
– 3a1x + 2a1 – 3a0 = 2x,
these 2 linear functions are the same thing if the coefficients of like powers of x are equal; so let's equate the coefficients of
like powers of x:

solving this system we get a1 = –2/3 and a0 = 2(–2/3)/3 = –4/9.

The trial PS y = a1x + a0 works. A PS of the NHE is y = – (2/3)x – 4/9.

##### Example 4.2

Solve the NHE y'' + 2y' – 3y = 2x by going thru the following steps:
a. Solve the HE y'' + 2y' – 3y = 0.
b. Find a PS of the given NHE. Verify the answer.
c. Form the GS of the NHE. Verify the answer.

Solution

Verification:

Indeed the GS is correct.

EOS

##### The Method Of Undetermined Coefficients

In Example 4.2 part b, since 2x is a linear function, a PS y should also be a linear function, so that y' and y'' also are, then y''
+ 2y' – 3y also is, thus we can make it equal the linear function 2x. Consequently, as a PS, we try the linear function of the
general form y = a1x + a0, not of the non-general form y = ax, as seen in the discussion preceding Example 4.2. We compute
y', y'', then y'' + 2y' – 3y. For y'' + 2y' – 3y to equal 2x, its x-expression must equal 2x. Hence we equate its x-expression
with 2x. For the 2 expressions to be the same thing, ie to be equal for all x, the coefficients of like powers of x must be equal.
It follows that we equate the coefficients of like powers of x (the constants are the coefficients of x0 = 1), get a system of 2
equations in a1 and a0, solve it, obtain a1 = –2/3 and a0 = –4/9. Therefore the PS is y = – (2/3)x – 4/9.

We try the trial solution y = a1x + a0, where the coefficients a1 and a0 are to be determined. Of course initially they're
undetermined. Hence this method of trying a PS with initially-undetermined coefficients is called the method of
undetermined coefficients
.

As asked, we verify the PS and the GS of the NHE, and find that indeed they're correct. The procedure to determine a PS
assures that the PS must be correct, and thus, by Theorem 2.1, the GS must also be correct. Example 4.2 asks to verify simply
because at the first contact with the method, it's good to assure you clearly that of course the method works. In solutions to
problems, if you're not asked to verify, then you don't have to verify.

Solve y''y = x2.

## Note

The function f (x) is a quadratic function, f(x) = x2. So y should also be a quadratic function, so that when we compute y''y,
it's also a quadratic function and thus has a chance to equal x2. This convinces us, in using the method of undetermined
coefficients, to try as a PS of the given NHE the quadratic function of the general form y = a2x2 + a1x + a0, where a2, a1, and a0
are constants to be determined in such a way that y''y = x2. As in the case for f (x) being a linear function, we must try the
general form of the polynomial, in this case the general form of the quadratic function.

Solution

a2 = –1,     a1 = 0,     a0 = 2a2 = 2(–1) = –2,
y = – x2 – 2.

The GE of the NHE is y = c1ex + c2exx2 – 2.
EOS

When f (x) Is An Exponential Function

Let's find the working trial solution of the NHE:

y'' – 3y' + y = 7e2x.

The function f (x) is an exponential function with exponent 2x, f (x) = 7e2x. So y should also be an exponential function with
the same exponent 2x, so that when we compute y'' – 3y' + y, it's also an exponential function with the same exponent 2x, as
the derivative of any order of e2x is a constant multiple of e2x, and thus y'' – 3y' + y can be made to equal 7e2x. The trial
solution is the general form of the exponential function e2x, which is y = ae2x. This trial solution works, as shown in Example
4.4 below. Note that the trial solution when
f (x) = kesx, where k and s are constants, is aesx, not akesx.

##### Example 4.4

Solve the DE y'' – 3y' + y = 7e2x.

Solution

EOS

When f (x) Is A Sine Or Cosine Function

Let's determine the working trial solution of the NHE:

y'' + 5y' + 4y = 2 sin x.

The function f (x) is a sine function, f (x) = 2 sin x. So the x-expression of y'' + 5y' + 4y must be able to equal 2 sin x. This
suggests that we should use a sine function as a trial solution. The derivative of any order of sin x is a constant multiple of
either sin x or cos x. This re-enforces the suggestion to use a sine function. Thus let's try y = a sin x, where a is a constant to
be determined so that y'' + 5y' + 4y = 2 sin x. We have:

y = a sin x,     y' = a cos x,     y'' = – a sin x,
2 sin x = y'' + 5y' + 4y = – a sin x + 5a cos x + 4a sin x = 3a sin x + 5a cos x,
3a sin x + 5a cos x = 2 sin x,
equate the coefficients of like trigonometric functions of x:

this system has no solutions.

So the trial solution y = a sin x doesn't work. The reason is discussed after the Solution of Example 4.5 below.

So what do we do? Ok, there's one remaining thing to do: it's to try the cosine+sine function of the general form y = A cos x +
B sin x, where A and B are constants to be determined so that y'' + 5y' + 4y = 2 sin x. This trial PS works, as seen in
Example 4.5 below. The reason is discussed after the Solution of Example 4.5.

##### Example 4.5

Solve y'' + 5y' + 4y = 2 sin x.

Solution

EOS

##### Why y = asinx Doesn't Work But y = Acosx + Bsinx Does

For the trial solution y = ax, the x-expression of y'' + 5y' + 4y is 3a sin x + 5a cos x, where the coefficients of cos x and
sin x are products containing the same factor a. When we remove the term 5a cos x by setting a = 0, the term 3a sin x will
also disappear. That's the reason why
y = a sin x doesn't work.

For the trial solution y = A cos x + B sin x, the x-expression of y'' + 5y' + 4y is (– 5A + 3B) sin x + (3A + 5B) cos x, where
the coefficients of
cos x and sin x aren't products containing the same factor that has to be set to 0. When we remove the
term
(3A + 5B) cos x by setting 3A + 5B = 0, the term (– 5A + 3B) sin x won't disappear. That's the reason why y = A cos x
+
B sin x works.

##### Example 4.6

Find the general solution of the DE y'' – 3y' + 2y = 2 cos 4x.

## Note

Similar to the discussions surrounding Example 4.5. The general form of the cosine+sine function cos 4x + sin 4x is A cos 4x
+ B sin 4x.

Solution

EOS

Eligible Functions

In this section, eligible functions refer to functions that are eligible for the method of undetermined coefficients. They're
represented by the function f (x) in the NHE:

y'' + by' + cy = f (x).

They're the polynomial, sine, cosine, and exponential functions.

If f (x) is a polynomial function of degree n: derivatives of orders 0 thru to 2, which appear on the left-hand side of the
equation, of the polynomial function f (x) of degree n are polynomial functions of degree n and less; so the trial PS of the NHE
is a polynomial function of degree n of the general form:

y = anxn + an–1xn–1 + an–2xn–2 + ... + a2x2 + a1x + a0,

so that the two sides can be made equal by equating the coefficients of like powers of x.

If f (x) is a sine or cosine function: derivatives of the sine function f (x) = r sin sx and of the cosine function f (x) = r cos sx
are each constant multiples of the sine and cosine functions sin sx and cos sx; so the trial PS is the cosine+sine function of the
general form:

y = A cos sx + B sin sx.

If f (x) is an exponential function: derivatives of the exponential function f (x) = resx are constant multiples of the exponential
function esx; so the trial PS is the exponential of the general form:

y = aesx.

For non-eligible functions, consider the following example:

If f (x) = ln x, letting the trial solution be y = a ln x would lead to y'' + by' + cy containing a constant multiple of –1/x2, and
thus y'' + by' + cy can't be made equal to ln x.

There are situations where the trial PSs have to be modified. This modification is discussed in the next section, where part 2 of
this topic is presented. Thus if you're encountering this topic for the first time, you're reminded that your knowledge of it will be
complete only after you successfully finish its part 2.

When f (x) Is A Sum Of Eligible Functions

##### Example 4.7

Consider the equation y''y = x2 + 3 cos x.
a. Solve the equation y''y = x2.
b. Solve the equation y''y = 3 cos x.
c. Solve the equation y''y = x2 + 3 cos x using the principle of superposition.
d. Solve the equation y''y = x2 + 3 cos x using the method of undetermined coefficients.

##### Note

For part d. The function f (x) is the sum of a quadratic function and a cosine function, f (x) = x2 + 3 cos x. So naturally, as a
PS of the NHE y''y = x2 + 3 cos x, we'll try the sum of the general quadratic function and the general form of the
cosine+sine function, that sum being y = a2x2 + a1x + a0 + A cos x + B sin x, so that when we compute y''y, it'll contain x2
and cos x, and thus it'll be possible to make it equal x2 + 3 cos x by the process of equating coefficients.

Solution

a2 = –1, a1 = 0, a0 = 2(–1) = –2,
a PS of the NHE is y = – x2 – 2.

So the required GS is:

y = c1ex + c2exx2 – 2.

b. By part a, the GS of the HE y''y = 0 is y = c1ex + c2ex.

For a PS of the NHE y''y = 3 cos x, let y = A cos x + B sin x. We have:

y = A cos x + B sin x,     y' = – A sin x + B cos x,     y'' = – A cos xB sin x,

3 cos x = y''y = (– A cos xB sin x) – (A cos x + B sin x) = – 2A cos x – 2B sin x,
– 2A cos x – 2B sin x = 3 cos x,

d. By part a, the GS of the HE y''y = 0 is y = c1ex + c2ex.

For a PS of the NHE y''y = x2 + 3 cos x, let y = a2x2 + a1x + a0 + A cos x + B sin x. We have:

y = a2x2 + a1x + a0 + A cos x + B sin x,     y' = 2a2x + a1A sin x + B cos x,     y'' = 2a2A cos xB sin x,

EOS

##### Using The Principle Of Superposition

As Example 4.7 part c shows, when f (x) is the sum of two or more eligible functions, we can use the principle of
superposition, as shown in Theorem 3.1. A PS of:

y'' + by' + cy = f1(x) + f2(x) + ... fn(x)

equals the sum of PSs of:

y'' + by' + cy = f1(x),     y'' + by' + cy = f2(x),     ...,     and     y'' + by' + cy = fn(x).

When f (x) Is A Product Of A Polynomial Function And An Exponential Function

Let's find a PS of the NHE:

y'' + y = xe2x.

The function f (x) is the product of a polynomial function of degree 1 and an exponential function, f (x) = xe2x. So naturally, as
a PS of this equation, we'll try the product of the general polynomial function of degree 1 and the general form of the
exponential function e2x, that product being y = (a1x + a0)ae2x, so that when we compute y'' + y, it'll contain the product xe2x,
and thus it'll be possible to make it equal xe2x by the process of equating coefficients. We have:

y = (a1x + a0)ae2x,
y' = aa1e2x + (2aa1x + 2aa0)e2x,
y'' = 2aa1e2x + 2aa1e2x + (4aa1x + 4aa0)e2x = 4aa1e2x + (4aa1x + 4aa0)e2x,

xe2x = y'' + y = 4aa1e2x + (4aa1x + 4aa0)e2x + (a1x + a0)ae2x = (5aa1x  + 4aa1 + 5aa0)e2x,
(5aa1x  + 4aa1 + 5aa0)e2x = xe2x,
5aa1x  + 4aa1 + 5aa0 = x,

a1 = 1/(5a), a0 = – 4a(1/(5a)) / (5a) = – 4/(25a),
letting a = 1 we get a1 = 1/5 and a0 = –4/25, and a PS is y = ((1/5)x – (4/25))e2x.

Now (a1x + a0)(ae2x) = (aa1x + aa0)e2x, and aa1 and aa0 are constants. Thus we can simply use y = (A1x + A0)e2x, where A1
and A0 are constants, as the trial PS. Re-utilizing the letters a1 and a0 in place of A1 and A0 respectively, our trial PS is y = (a1x
+ a0)e2x. This is the same as using a = 1. It works all right, giving the same PS, as seen in Example 4.8 below. When a
constant can be combined with all the remaining constants, it can be removed.

##### Example 4.8

Consider the equation y'' + y = xe2x.
a. Solve the equation y'' + y = x.
b. Solve the equation y'' + y = e2x.
c. Solve the equation y'' + y = xe2x.
d. Does the GS of y'' + y = xe2x equal the product of the GS of y'' + y = x and the GS of y'' + y = e2x?

Solution

a1 = 1, a0 = 0,
a PS of the NHE is y = x.

So the GS of y'' + y = x is:

y = x + c1 cos x + c2 sin x.

b. By part a, the GS of the HE y'' + y = 0 is y = c1 cos x + c2 sin x.

For a PS of the NHE y'' + y = e2x, let y = ae2x. We have:

y = ae2x,     y' = 2ae2x,     y'' = 4ae2x,

e2x = y'' + y = 4ae2x + ae2x = 5ae2x,
5ae2x = e2x,
5a = 1,
a = 1/5,

a PS of the NHE is y = (1/5)e2x.

So the GS of y'' + y = e2x is:

a1 = 1/5,

a0 = – 4(1/5)/5 = –4/25,
a PS of the NHE is
y = ((1/5)x – (4/25))e2x.

So the GS of
y'' + y = xe2x is:

The product  x  contains the term x(c1 cos x) = c1x cos x, which  doesn't contain. So the product  x  can't
equal . Thus the answer is no.

EOS

When f (x) Is A Product Of A Polynomial Function And A Sine Or Cosine Function

Let's determine the working trial PS of the NHDE:

y''y = x sin x.

Let's try y = (a1x + a0)(A cos x + B sin x). We have:

y = (a1x + a0)(A cos x + B sin x),
y' = a1(A cos x + B sin x) + (a1x + a0)(– A sin x + B cos x),
y'' = a1(– A sin x + B cos x) + a1(– A sin x + B cos x) + (a1x + a0)(– A cos xB sin x)
= 2a1(– A sin x + B cos x) – (a1x + a0)(A cos x + B sin x),
x sin x = y''y
= 2a1(– A sin x + B cos x) – (a1x + a0)(A cos x + B sin x) – (a1x + a0)(A cos x + B sin x)
= 2a1(– A sin x + B cos x) – 2(a1x + a0)(A cos x + B sin x),
= (– 2a1A – 2a1xB – 2a0B) sin x + (2a1B – 2a1xA – 2a0A) cos x
= (– 2a1Bx – 2a1A – 2a0B) sin x + (– 2a1xA + 2a1B – 2a0A) cos x
(– 2a1Bx – 2a1A – 2a0B) sin x + (– 2a1Ax + 2a1B – 2a0A) cos x = x sin x,

as  and  show, the system has no solution, the trial solution y = (a1x + a0)(cos x + sin x) fails too.

In Example 4.8, we have f (x) = xe2x, and the working trial solution is y = (a1x + a0)e2x, obtained by multiplying the coefficient
of e2x into the polynomial, so that e2x has a coefficient of 1. Let's try the same strategy: move A and B from A cos x + B sin x
to the polynomial, so that cos x and sin x each have a coefficient of 1. We have:

y = (a1x + a0)(A cos x + B sin x) = (a1x + a0)A cos x + (a1x + a0) B sin x = (a1Ax + a0A) cos x + (a1Bx + a0B) sin x.

Let's re-use the letters a1 and a0 for the products a1A and a0A respectively, and let b1 = a1B and b0 = a0B. Then y =
(a1x + a0) cos x + (b1x + b0) sin x. That's what we want! Let's try it: y = (a1x + a0) cos x + (b1x + b0) sin x, done in
Example 4.9 below. It works, as seen in the Solution! Wow!

Example 4.9

Solve the NHDE y''y = x sin x.

## Solution

For a PS of the given NHE y'' – y = x sin x, let y = (a1x + a0) cos x + (b1x + b0) sin x. We have:

y = (a1x + a0) cos x + (b1x + b0) sin x,
y' = a1 cos x – (a1x + a0) sin x + b1 sin x + (b1x + b0) cos x,
y'' = – a1 sin xa1 sin x – (a1x + a0) cos x + b1 cos x + b1 cos x – (b1x + b0) sin x
= (– a1xa0 + 2b1) cos x + (– b1x – 2a1b0) sin x,
x sin x = y''y
= ((– a1xa0 + 2b1) cos x + (– b1x – 2a1b0) sin x) – ((a1x + a0) cos x + (b1x + b0) sin x)
= (– 2b1x – 2a1 – 2b0) sin x + (– 2a1x – 2a0 + 2b1) cos x,
(– 2b1x – 2a1 – 2b0) sin x + (– 2a1x – 2a0 + 2b1) cos x = x sin x,

b1 = –1/2, a1 = 0, b0 = 0, a0 = – 2(–1/2) / (–2) = –1/2,
a PS of the NHE is y = – (1/2) cos x – (1/2)x sin x, or y = – (1/2)(cos x + x sin x).

Thus the GS of the given NHE is y = c1ex + c2ex – (1/2)(cos x + x sin x).

## EOS

When f (x) Is A Product Of An Exponential Function And A Sine Or Cosine Function

Let's find a PS of the NHE:

y'' – 3y' + 2y = ex sin x.

Let y = aex(A cos x + B sin x). Then y = ex(aA cos x + aB sin x). So we can simply utilize y = ex(A cos x + B sin x). It
works ok, as evidenced in Example 4.10 below.

Example 4.10

Determine the GS of y'' – 3y' + 2y = ex sin x.

Solution

EOS

 5. Modification Of The Method Of Undetermined Coefficients

##### When f(x) Is A Polynomial

Let's find a PS of the NHE:

y'' + y' = x3x2.

Let's try y = a3x3 + a2x2 + a1x + a0. We have:

y = a3x3 + a2x2 + a1x + a0,     y' = 3a3x2 + 2a2x + a1,     y'' = 6a3x + 2a2,

x3x2 = y'' + y' = (6a3x + 2a2) + (3a3x2 + 2a2x + a1) = 3a3x2 + (6a3 + 2a2)x + 2a2 + a1,
3a3x2 + (6a3 + 2a2)x + 2a2 + a1 = x3x2.

We may add the term 0x3 to the left-hand side, but then we can't equate 0 to the coefficient 1 of x3 on the right-hand side, and
so the process of equating coefficients can't be done.

The trial solution y = a3x3 + a2x2 + a1x + a0 doesn't work. That's because when we compute (the x-expressions of ) y' and y'',
they're polynomials of degree 2, and so is y'' + y', while x3x2 is a polynomial of degree 3. The term containing y, which is of
degree 3 in x, is absent from the left-hand side.

So what do we do? Ok, let's try a polynomial of degree 4, so that when we compute y'' + y', it'll be a polynomial of degree 3,
the same as that of x3x2. Let y = a4x4 + a3x3 + a2x2 + a1x + a0. We have:

y = a4x4 + a3x3 + a2x2 + a1x + a0,     y' = 4a4x3 + 3a3x2 + 2a2x + a1,     y'' = 12a4x2 + 6a3x + 2a2,

x3x2 = y'' + y' = (12a4x2 + 6a3x + 2a2) + (4a4x3 + 3a3x2 + 2a2x + a1) = 4a4x3 + (12a4 + 3a3)x2 + (6a3 + 2a2)x + 2a2 + a1,
4a4x3 + (12a4 + 3a3)x2 + (6a3 + 2a2)x + 2a2 + a1 = x3x2.

The constant term a0 is absent from the left-hand side, and thus can't be determined. The trial solution y = a4x4 + a3x3 + a2x2
+ a1x + a0 doesn't work either.

So, again, what do we do? Ok, let's multiply the initial trial solution a3x3 + a2x2 + a1x + a0 by x to get the modified trial solution
y = a3x4 + a2x3 + a1x2 + a0x. This trial PS works, as will be seen in Example 5.1 below.

When f (x) is a polynomial and y is absent from the left-hand side (because its coefficient is 0), the modified trial solution is a
polynomial of degree greater than that of the polynomial f (x) by 1 and with the constant coefficient equal to 0. In the term
aixi+1, the subscript i of the coefficient ai is less than the exponent i + 1 of xi+1 by 1, to reveal the multiplication by x and to
stop at a0x where the subscript is already the lowest 0. This is an example where the method of undetermined coefficients
must be modified.

##### Example 5.1

Find the GS of the DE y'' + y' = x3x2.

Solution

a3 = 1/4,     a2 = (– 1 – 12(1/4)) / 3 = –4/3,     a1 = –6(–4/3)/2 = 4,     a0 = –2(4) = –8,
a PS of the NHE is y = (1/4)x4 – (4/3)x3 + 4x2 – 8x.

So the GS of the given NHE is y = c1 + c2ex + (1/4)x4 – (4/3)x3 + 4x2 – 8x.
EOS

##### When The Initial Trial PS Of The NHE Is A PS Of The HE

Multiplying By x

Let's determine a PS of the NHE:

y''y = 2ex.

Let's try y = aex. We have:

y = aex,     y' = aex,     y'' = aex,

2ex = y''y = aexaex = 0.

The case of the polynomial in Example 5.1 suggests that we can try the multiplication of the initial trial solution aex by x. Let's
try y = axex. This trial solution works quite well, as shown in Example 5.2 below. Note that axex isn't a PS of the HE for any
values of c1 and c2.

In the solution we of course first find the GS of the HE. If we observe that the initial trial PS g(x) of the NHE is a PS of the HE,
then we multiply it by x, if xg(x) obtained isn't a PS of the HE, then we use it as the modified trial PS. This is another example
where the method of undetermined coefficients must be modified.

##### Example 5.2

Solve y''y = 2ex.

Solution

For a PS of the given NHE y''y = 2ex. The function aex is a PS of the HE and the function axex isn't. So let's try y = axex.
We have:

y = axex,     y' = aex + axex,     y'' = aex + (aex + axex) = 2aex + axex,

2ex = y''y = (2aex + axex) – axex = 2aex,
2aex = 2ex,
a = 1,
a PS is y = xex.

So the GS of the given NHE is y = c1ex + c2ex + xex, or y = (x + c1)ex + c2ex.
EOS

##### Example 5.3

Solve the initial-value problem y'' + y = cos x, y(0) = 2, y'(0) = –3.

##### Note

For a PS of the given NHE. Let's try y = A cos x + B sin x. We have:

y = A cos x + B sin x,     y' = – A sin x + B cos x,     y'' = – A cos xB sin x,

cos x = y'' + y = (– A cos xB sin x) + (A cos x + B sin x) = 0.

Solution

c1 = 2,

c2 = –3.

Thus the unique solution of the given initial-value problem is y = 2 cos x – 3 sin x + (1/2)x sin x.

EOS

##### Multiplying By xn

Let's find a PS of the equation:

y'' – 2y' + y = ex.

Let's try y = aex. We have:

y = aex,     y' = aex,     y'' = aex,

ex = y'' – 2y' + y = aex – 2aex + aex = 0.

The trial PS y = aex fails. It's a PS of the HE y'' – 2y' + y = 0, and thus can't be a PS of the NHE. Let's determine the GS of the
HE. We have (–2)2 – 4(1) = 0, –b/2 = –(–2)/2 = 1, and the GS is y = c1ex + c2xex. The trial PS y = aex of the NHE is a PS of
the HE, obtained from the GS of the HE by letting c1 = a and c2 = 0.

Now let's multiply the initial trial PS aex by x to get axex. But axex is still a PS of the HE, obtained by letting c1 = 0 and c2 = a.
So y = axex would fail too. Let's check:

y = axex,     y' = aex + axex,     y'' = aex + aex + axex = 2aex + axex,

ex = y'' – 2y' + y = 2aex + axex – 2(aex + axex) + axex = 0.

Indeed y = axex fails too.

So what do we do? Ok, let's multiply the initial trial PS aex by x2 to get ax2ex. Now ax2ex isn't a PS of the HE. Thus let's try y =
ax2ex. This trial solution works, as evidenced in Example 5.4 below. Note that ax2ex isn't a PS of the HE for any values of c1
and c2. This is another example where the method of undetermined coefficients must be modified.

In the solution we of course first find the GS of the HE. If we observe that the initial trial PS g(x) of the NHE is a PS of the HE,
then we multiply it by xn, where n is the smallest positive integer such that xng(x) isn't a PS of the HE, and we use the
modified trial PS y = xng(x).

##### Example 5.4

Determine the GS of the DE y'' – 2y' + y = ex.

Solution
For the GS of the HE y'' – 2y' + y = 0, we have (–2)2 – 4(1) = 0, –b/2 = –(–2)/2 = 1, and the GS is y = c1ex + c2xex.

For a PS of the given NHE y'' – 2y' + y = ex. The functions y = aex and axex are PSs of the HE. So let's try y = ax2ex. We
have:

y = ax2ex,     y' = 2axex + ax2ex,     y'' = (2aex + 2axex) + (2axex + ax2ex) = 2aex + 4axex + ax2ex,

ex = y'' – 2y' + y = (2aex + 4axex + ax2ex) – 2(2axex + ax2ex) + ax2ex = 2aex,
2aex = ex,
2a = 1,
a = 1/2,
a PS of the NHE is y = (1/2)x2ex.

Thus the GS of the given NHE is y = c1ex + c2xex + (1/2)x2ex, or y = ((1/2)x2 + c2x + c1)ex.

## EOS

When One Or More Terms Of The Initial Trial PS Of The NHE Is A PS Of The HE

Let's determine a PS of the equation:

y'' + y = x sin x.

Let's try y = (a1x + a0) cos x + (b1x + b0) sin x. We have:

y = (a1x + a0) cos x + (b1x + b0) sin x,
y' = a1 cos x – (a1x + a0) sin x + b1 sin x + (b1x + b0) cos x = (b1x + a1 + b0) cos x + (– a1xa0 + b1) sin x,

y'' = b1 cos x – (b1x + a1 + b0) sin xa1 sin x + (– a1xa0 + b1) cos x = (– a1xa0 + 2b1) cos x + (– b1x – 2a1b0) sin x,

x sin x = y'' + y = 2b1 cos x – 2a1 sin x,
2b1 cos x – 2a1 sin x = x sin x.

Now the factor x in x sin x is a polynomial of degree 1, but there's no polynomial of degree 1 as a factor in – 2a1 sin x. The
process of equating coefficients can't be done. The trial PS y = (a1x + a0) cos x + (b1x + b0) sin x doesn't work. Let's find the
GS of the HE y'' + y = 0. As done in Example 5.3, it's y = c1 cos x + c2 sin x. The trial PS is:

y = (a1x + a0) cos x + (b1x + b0) sin x = a1x cos x + a0 cos x + b1x sin x + b0 sin x.

Clearly the terms a0 cos x and b0 sin x are solutions of the HE. They disappear from the x-expression of y'' + y. So the trial
solution is the same as if it's y = a1x cos x + b1x sin x. Let's check:

y = a1x cos x + b1x sin x,
y' = a1 cos xa1x sin x + b1 sin x + b1x cos x = (b1x + a1) cos x + (– a1x + b1) sin x,
y'' = b1 cos x – (b1x + a1) sin xa1 sin x + (– a1x + b1) cos x = (– a1x + 2b1) cos x + (– b1x – 2a1) sin x,

y'' + y = 2b1 cos x – 2a1 sin x,

which is the same as found above. Indeed the trial solution is the same as if it's y = a1x cos x + b1x sin x, which is
incomplete, and consequently doesn't work.

Let's multiply the initial trial solution by x to get the modified trial solution (a1x2 + a0x) cos x + (b1x2 + b0x) sin x. No term of
this modified trial solution is a solution of the HE. This modified trial solution works quite well, as shown in Example 5.5 below.

In the solution we of course first find the GS of the HE. If we observe that one or more terms of the initial trial PS g(x) of the
NHE are PSs of the HE, then we multiply g(x) by xn, where n is the smallest positive integer such that no term of xng(x) is a
solution of the HE, and we use the modified trial PS y = xng(x).

##### Example 5.5

Solve the equation y'' + y = x sin x.

Solution

b1 = 0,     a1 = –1/4,     b0 = –2(–1/4)/2 = 1/4,     a0 = 0,
a PS of the NHE is y = (–1/4)x2 cos x + (1/4)x sin x.

So the GS of the given NHE is y = c1 cos x + c2 sin x + (–1/4)x2 cos x + (1/4)x sin x, or y = (c1 – (1/4)x2) cos x +
(c2 + (1/4)x) sin x.

## EOS

##### Terms And Factors

Let's recall the following terminology. In the expression:

y = ax2ex + bx sin 3x,

ax2ex and bx sin 3x are terms of y. In the expression:

y = ax2ex,

a, x2 (or x, as x2 = xx), and ex are factors of y.

In Example 5.5, the modified trial solution of the NHE is:

y = (a1x2 + a0x) cos x + (b1x2 + b0x) sin x = x2(a1 cos x + b1 sin x) + x(a0 cos x + b0 sin x).

The items a1 cos x, b1 sin x, a0 cos x, and b0 sin x are solutions of the HE, but they cause no problem, because they're not
terms of y. (The terms are a1x2 cos x, b1x2 sin x, a0x cos x, and b0x sin x.)

In Example 5.2, the initial trial solution is y = aex, which is a solution of the HE. The modified trial solution is y = axex =
x(aex), where the factor aex is a solution of the HE, but it causes no problem, because it's not a term of y. Similarly for
Examples 5.3 and 5.4.

 6. Recap

We now recap the results of this section. Consider the NHE:

y'' + by' + cy = f (x)

and its associated HE:

y'' + by' + cy = 0.

Case 1. No part of the trial PS of the NHE is a solution of the HE. A PS of the NHE has the form of y as described in the table
below, where Pn(x) and Qn(x) are polynomials of degree n.

{6.1} Examples 4.2 and 4.3

{6.2} Example 5.1

{6.3} Example 4.4
{6.4}

{6.5} Example 4.6
{6.6} Example 4.8
{6.7} Example 4.9
{6.8} Example 4.10

Case 2. One or more terms of the initial trial PS of the NHE are solutions of the HE. Multiply the appropriate trial solution y in
the table above by xn, where n is the smallest positive integer such that no term of the obtained product is a solution of the HE.

# Problems & Solutions

1. Find the GS of y'' + 4y' + 4y = 12.

##### Solution

For the GS of the HE y'' + 4y' + 4y = 0, we have 42 – 4(4) = 0, –b/2 = –4/2 = –2, and the GS is y = c1e–2x + c2xe–2x.

For a PS of the given NHE y'' + 4y' + 4y = 12, let's try y = 12/4 = 3. Then y' = 0, y'' = 0, and y'' + 4y' + 4y = 0 + 4(0) + 4(3) =
12. So a PS of the NHE is y = 3.

Thus the GS of the NHE is y = c1e–2x + c2xe–2x + 3.

2. Determine the GS of y'' – 3y' + 2y = x + 1.

##### Solution

3. Find the unique solution of the initial-value problem:

##### Solution

a2 = 1,     a1 = 1,     a0 = 1 – 2(1) = –1,
a PS is y = 1x2 + 1x – 1 or y = x2 + x – 1.

So the GS of the NHE is y = c1 cos x + c2 sin x + x2 + x – 1. Then y' = – c1 sin x + c2 cos x + 2x + 1. We have:

3 = y(0) = c1 cos 0 + c2 sin 0 + 02 + 0 – 1 = c1 – 1, c1 = 4,

1 = y'(0) = – c1 sin 0 + c2 cos 0 + 2(0) + 1 = c2 + 1, c2 = 0.

Thus the required solution is y = 4 cos x + 0 sin x + x2 + x – 1, or y = 4 cos x + x2 + x – 1.

4. Solve y'' – 3y' + 2y = 6e3x.

Solution

For a PS of the given NHE y'' – 3y' + 2y = 6e3x, let y = ae3x. We have:

y = ae3x,     y' = 3ae3x,     y'' = 9ae3x,

6e3x = y'' – 3y' + 2y = 9ae3x – 3(3ae3x) + 2ae3x = 2ae3x,
2ae3x = 6e3x,
2a = 6,
a = 3,
a PS is y = 3e3x.

So the required GS is y = c1e2x + c2ex + 3e3x.

5. Find the GS of the equation y'' + 4y = 3 sin x.

##### Solution

A = 0, B = 1,
a PS is y = 0 cos x + 1 sin x or y = sin x.

So the GS of the given NHE is y = c1 cos 2x + c2 sin 2x + sin x.

6. Determine the GS of the DE y'' – 2y' = 2 sin x + 2e3x. Hint: use the principle of superposition.

Solution

For a PS of the NHE y'' – 2y' = 2 sin x, let y = A cos x + B sin x. We have:

y = A cos x + B sin x,     y' = – A sin x + B cos x,     y'' = – A cos xB sin x,
2 sin x = y'' – 2y' = (– A cos xB sin x)­ ­– 2(– A sin x + B cos x) = (2AB) sin x + (– A – 2B) cos x,
(2AB) sin x + (– A – 2B) cos x = 2 sin x,

7. Solve the initial-value problem y'' – 4y' + 4y = 6xe3x, y(0) = 0, y'(0) = 3.

Solution

For the GS of the HE y'' – 4y' + 4y = 0, we have (–4)2 – 4(4) = 0, –b/2 = –(–4)/2 = 2, and the GS is y = c1 e2x + c2xe2x.

For a PS of the given NHE, let y = (a1x + a0)e3x. We have:

y = (a1x + a0)e3x,
y' = a1e3x + 3(a1x + a0)e3x = (a1 + 3a0)e3x + 3a1xe3x,
y'' = 3(a1 + 3a0)e3x + 3a1e3x + 9a1xe3x = (6a1 + 9a0)e3x + 9a1xe3x,
6xe3x = y'' – 4y' + 4y = (6a1 + 9a0)e3x + 9a1xe3x – 4((a1 + 3a0)e3x + 3a1xe3x) + 4(a1x + a0)e3x = (a1x + 2a1 + a0)e3x,
(a1x + 2a1 + a0)e3x = 6xe3x,

a1x + 2a1 + a0 = 6x,

a1 = 6,     a0 = –2(6) = –12,
a PS of the NHE is y = (6x – 12)e3x, or y = 6(x – 2)e3x.

So the GS of the NHE is y = c1e2x + c2xe2x + 6(x – 2)e3x. We have:

0 = y(0) = c1e0 + 0 + 6(0 – 2)e0 = c1 – 12,     c1 = 12,
y' = 2c1e2x + c2e2x + 2c2xe2x + 6e3x + 18(x – 2)e3x = (2c1 + c2)e2x + 2c2xe2x + (18x – 30)e3x,
3 = y'(0) = (2(12) + c2)e0 + 0 + (0 – 30)e0 = c2 – 6,     c2 = 9.

Thus the unique solution of the given initial-value problem is y = 12e2x + 9xe2x + 6(x – 2)e3x.

8. Solve the NHE y'' + 4y = 16x sin 3x.

Solution

9. Find the GS of the NHDE y'' + 4y' + 4y = e2x cos x.

Solution

For the GS of the HE y'' + 4y' + 4y = 0, we have 42 – 4(4) = 0, –b/2 = –4/2 = –2, and the GS is y = c1e–2x + c2xe–2x.

For a PS of the given NHE, let y = e2x(A cos x + B sin x). We have:

y = e2x(A cos x + B sin x),
y' = 2e2x(A cos x + B sin x) + e2x(– A sin x + B cos x),
y'' = 4e2x(A cos x + B sin x) + 2e2x(– A sin x + B cos x) + 2e2x(– A sin x + B cos x) + e2x(– A cos xB sin x)
= 4e2x(A cos x + B sin x) + 4e2x(– A sin x + B cos x) – e2x(A cos x + B sin x)
= 3e2x(A cos x + B sin x) + 4e2x(– A sin x + B cos x),
4y' = 8e2x(A cos x + B sin x) + 4e2x(– A sin x + B cos x),
4y = 4e2x(A cos x + B sin x),
e2x cos x = y'' + 4y' + 4y
= 15e2x(A cos x + B sin x) + 8e2x(– A sin x + B cos x)
= e2x((15A + 8B) cos x + (– 8A + 15B) sin x),
e2x((15A + 8B) cos x + (– 8A + 15B) sin x) = e2x cos x,
(15A + 8B) cos x + (– 8A + 15B) sin x = cos x,

 x 8:  120A + 64B = 8,  
 x 15:  – 120A + 225B = 0,  
 + :  289B = 8, B = 8/289,
:  A = (1 – 8(8/289))/15 = 15/289,
a PS of the NHE is y = e2x((15/289) cos x + (8/289) sin x).

So the GS of the given NHE is y = c1e–2x + c2xe–2x + e2x((15/289) cos x + (8/289) sin x).

10. Determine the GS of the equation y'' + y' = 3x2.

##### Solution

a2 = 3/3 = 1, a1 = –6(1)/2 = –3, a0 = –2(–3) = 6,
a PS of the NHE is y = x3 – 3x2 + 6x.

So the GS of the given NHE is y = c1 + c2ex + x3 – 3x2 + 6x.

11. Solve the DE y'' + 4y = sin 2x.

##### Solution

B = 0, A = –1/4,
a PS of the NHE is y = –(1/4)x cos 2x.

Thus the GS of the given NHE is y = c1 cos 2x + c2 sin 2x – (1/4)x cos 2x, or y = (– (1/4)x + c1) cos 2x + c2 sin 2x.

12. Find the GS of x'' – 4x' + 4x = e2t.

##### Solution

For the GS of the HE x'' – 4x' + 4x = 0, we have (–4)2 – 4(4) = 0, –(–4)/2 = 2, and the GS of the HE is x = c1e2t + c2te2t.

For a PS of the given NHE. The functions x = ae2t and x = ate2t are PSs of the HE. So let's try x = at2e2t. We have:

x = at2e2t,
x' = 2ate2t +2at2e2t = (2at2 + 2at)e2t,
x'' = (4at + 2a)e2t + 2(2at2 + 2at)e2t = (4at2 + 8at + 2a)e2t,
–4x' = (– 8at2 – 8at)e2t,
4x = 4at2e2t,
e2t = x'' – 4x' + 4x = 2ae2t,
2ae2t = e2t,
2a = 1,
a = 1/2,
a PS of the NHE is x = (1/2)t2e2t.

Thus the GS of the given NHE is x = c1e2t + c2te2t + (1/2)t2e2t, or x = ((1/2)t2 + c2t + c1)e2t.

y'' + by' + cy = f (x)

has a PS that's a polynomial of degree n.

Solution

Suppose:

14. Prove that the GS of the NHDE:

Solution