Steply

Solve y'' + y = 5sin(2x)

Step by step, with the reason for every step · Undetermined coefficients · Differential Equations

Step by step

The question

Question: solve y″ + y = 5sin(2x).

y″ + y = 5sin(2x)

The answer has two parts: the plain part, which solves the equation with 0 on the right, plus one extra solution that makes 5sin(2x).

y = yc + yp: the plain part + one extra solution

1 Solve with 0 on the right

Try y = e^(rx): the characteristic equation is r² + 1 = 0.

r2 + 1 = 0
y″ → r², y′ → r, y → 1

It does not factor nicely, so we use the formula, with a = 1, b = 0, c = 1.

r = −b ± √b² − 4ac2a

Put the numbers in.

r = 0 ± √0² − 4 × 1 × 12 × 1

Under the root: −4.

r = 0 ± √−42

A minus under the root: √(−4) = 2i, because i = √(−1).

√−4 = √4 × √−1 = 2i
r = 0 ± 2i2

Divide both parts by 2: r = ±i.

Two complex roots.

r = ±i

Complex roots give cosines and sines.

The real part 0 goes in the e, the 1 goes inside cos and sin.

α ± βi: e^(αx)(C₁cos βx + C₂sin βx)

So the plain part is C₁cos x + C₂sin x.

yc = C1cos x + C2sin x

2 Guess the extra part

The extra part has the same shape: a cosine and a sine, both, with the same 2x inside.

sin or cos → A cos(bx) + B sin(bx)

Careful!

Both cos and sin are needed: each derivative turns one into the other.

Careful: not yp = Bsin(2x) ✗

So we guess Acos(2x) + Bsin(2x) for the extra part.

A and B are the numbers we must find.

yp = Acos(2x) + Bsin(2x)

3 Put the guess in

Its derivative.

y′p = −2Asin(2x) + 2Bcos(2x)

And once more.

y″p = −4Acos(2x) − 4Bsin(2x)

Put them into the left side.

−4Acos(2x) − 4Bsin(2x) + (Acos(2x) + Bsin(2x)) = 5sin(2x)

Multiply out and put like parts together.

−3Bsin(2x) − 3Acos(2x) = 5sin(2x)

4 Match the parts

The two sides must match, part by part: the same amount of each shape.

sin(2x) parts: −3B = 5
cos(2x) parts: −3A = 0
same shape → same number

So B = −5/3.

B = −53

So A = 0.

A = 0

So the extra part is −5/3 × sin(2x).

yp = −53sin(2x)

5 Add the parts

Add the parts: y = C₁cos x + C₂sin x − 5/3 × sin(2x).

y = C1cos x + C2sin x − 53sin(2x)

6 Check

Let's check the extra part: put −5/3 × sin(2x) into the left side.

put in yp: 203sin(2x) + (−53sin(2x))

It gives 5sin(2x): the right side.

Right!

= 5sin(2x)

Let's look back.

First: solve with 0 on the right.

Then: guess the extra part.

Then: put the guess in.

Then: match the parts.

Then: add the parts.

Last: check.

Answer
y = C1cos x + C2sin x − 53sin(2x)

Your turn

Try this one yourself, then check:

Solve y″ + y = 4sin(2x)
Show the answer
y = C1cos x + C2sin x − 43sin(2x)

More from Undetermined coefficients

The whole lesson: Undetermined coefficients →