Steply

Solve y'' + 4y = 8x, y(0) = 1, y'(0) = 4

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

Step by step

The question

Question: solve y″ + 4y = 8x, with y(0) = 1 and y′(0) = 4.

y″ + 4y = 8x
y(0) = 1, y′(0) = 4

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

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

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

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

r = −b ± √b² − 4ac2a

Put the numbers in.

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

Under the root: −16.

r = 0 ± √−162

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

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

Divide both parts by 2: r = ±2i.

Two complex roots.

r = ±2i

Complex roots give cosines and sines.

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

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

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

yc = C1cos(2x) + C2sin(2x)

2 Guess the extra part

The extra part has the same shape as the right side: a polynomial of the same size, with every lower power too.

x → Ax + B

Careful!

Every lower power is needed too: the derivatives make them.

Careful: not yp = Ax ✗

So we guess Ax + B for the extra part.

A and B are the numbers we must find.

yp = Ax + B

3 Put the guess in

Its derivative.

y′p = A

And once more.

y″p = 0

Put them into the left side.

0 + 4(Ax + B) = 8x

Multiply out and put like parts together.

4Ax + 4B = 8x

4 Match the parts

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

x parts: 4A = 8
number parts: 4B = 0
same shape → same number

So A = 2.

A = 2

So B = 0.

B = 0

So the extra part is 2x.

yp = 2x

5 Add the parts

Add the parts first.

The starting values are for the whole y.

y = C1cos(2x) + C2sin(2x) + 2x

6 Use the starting values

We need y′ too: the derivative of our y.

y′ = −2C1sin(2x) + 2C2cos(2x) + 2
at x = 0: e^(0) = 1, cos 0 = 1, sin 0 = 0

Put x = 0 into y: C₁ = 1.

So C₁ is known at once.

① C1 = 1

Put x = 0 into y′: 2C₂ + 2 = 4.

② 2C2 + 2 = 4

Move the 2 over.

② 2C2 = 2

So C₂ = 1.

C2 = 1

Put them in: y = cos(2x) + sin(2x) + 2x.

y = cos(2x) + sin(2x) + 2x

7 Check

Let's check the extra part: put 2x into the left side.

put in yp: 0 + 4 × 2x

It gives 8x: the right side.

Right!

= 8x

And the starting values: 1 and 4.

Right!

y(0) = 1, y′(0) = 4

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.

Then: use the starting values.

Last: check.

Answer
y = cos(2x) + sin(2x) + 2x

Your turn

Try this one yourself, then check:

Solve y″ + 4y = 12x
Show the answer
y = 3cos(2x) + 3x

More from Undetermined coefficients

The whole lesson: Undetermined coefficients →