Steply

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

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

Step by step

The question

Question: solve y″ + y′ = 2sin x.

y″ + y′ = 2sin x

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

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² + r = 0.

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

Every term has an r: take it out.

r(r + 1) = 0

A product is 0 when one part is 0: r = 0 or r = −1.

r = 0 or r = −1

Each root gives a solution e^(rx).

Any mix of the two works, so we add them with two numbers, C₁ and C₂.

two roots r₁, r₂: C₁e^(r₁x) + C₂e^(r₂x)

So the plain part is C₁e^(−x) + C₂.

yc = C1e^(−x) + C2

2 Guess the extra part

The extra part has the same shape: a cosine and a sine, both, with the same 1x 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 x ✗

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

A and B are the numbers we must find.

yp = Acos x + Bsin x

3 Put the guess in

Its derivative.

y′p = −Asin x + Bcos x

And once more.

y″p = −Acos x − Bsin x

Put them into the left side.

−Acos x − Bsin x + (−Asin x + Bcos x) = 2sin x

Multiply out and put like parts together.

−Bsin x − Asin x − Acos x + Bcos x = 2sin x

4 Match the parts

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

sin x parts: −B − A = 2
cos x parts: −A + B = 0
same shape → same number

From the first: B in terms of A.

B = 2 + A−1

Put it into the second and collect.

−2A = 2

So A = −1.

A = −1

Put in what we know.

−B = 1

So B = −1.

B = −1

So the extra part is −cos x − sin x.

yp = −cos x − sin x

5 Add the parts

Add the parts: y = C₁e^(−x) + C₂ − cos x − sin x.

y = C1e^(−x) + C2 − cos x − sin x

6 Check

Let's check the extra part: put −cos x − sin x into the left side.

put in yp: cos x + sin x + (sin x − cos x)

It gives 2sin x: the right side.

Right!

= 2sin x

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 = C1e^(−x) + C2 − cos x − sin x

Your turn

Try this one yourself, then check:

Solve y″ + y′ = 6sin x
Show the answer
y = C1e^(−x) + C2 − 3cos x − 3sin x

More from Undetermined coefficients

The whole lesson: Undetermined coefficients →