Step by step
The question
Question: solve y′ + 2xy = 4x, with y(0) = 5.
y(0) = 5 is the starting value.
1 Standard form
Linear means this form: y′ + P y = Q.
P and Q have only x.
Here P = 2x and Q = 4x.
2 The integrating factor
The integrating factor is e to the integral of P.
Multiplying by it makes the left side one derivative.
First the integral of P: the integral of 2x is x².
So the integrating factor is e^(x²).
3 Multiply both sides
Multiply both sides by e^(x²).
Every term, on both sides.
Careful!
The right side is multiplied by e^(x²) too.
Both sides, always.
4 One derivative on the left
By the product rule, the derivative of e^(x²) × y is exactly our left side.
So the left side is just (e^(x²)y)′: one derivative.
5 Integrate both sides
This integral needs u-substitution: the power's derivative, 2x, is outside.
Integrate both sides.
The integral of a derivative is the function itself.
On the right: 2e^(x²), and + C.
6 Solve for y
Divide both sides by e^(x²).
Divide each term.
Dividing by e to a power is the same as e to minus that power.
7 Use the starting value
Put in x = 0 and y = 5.
e⁰ = 1.
So C = 3.
So y = 2 + 3e^(−x²).
8 Check
Let's check with a calculator.
At x = 1: y is about 3.104, and its slope about −2.207.
The equation wants y′ = Q − Py: about −2.207.
The same.
Right!
Let's look back.
First: standard form.
Then: the integrating factor.
Then: multiply both sides.
Then: one derivative on the left.
Then: integrate both sides.
Then: solve for y.
Then: use the starting value.
Last: check.