Solving y’ + a(x) y = b(x), Part 2

In my previous post “Solving y’ + a(x) y = b(x), Part 1“, it was revealed that every solution of

y' + a(x) y = b(x)\quad\quad\quad(1)

is the sum of a particular solution,  e^{-\int a(x) dx}\int b(x) e^{\int a(x) dx}dx, with c e^{-\int a(x) dx}, a solution of the homogeneous equation y '+ a(x) y =0.

This structure suggests that (1) can be solved in two steps: solve y' +a(x) y= 0 first to get c e^{-\int a(x) dx}, then change the constant c in it to a function c(x) and solve for c(x) after submitting the variation into (1).

There is an alternative:

Let

y = u v

We have

(u v)' + a(x) (u v) = v u' + u (v' + a(x) v)=b(x)

From v' + a(x) v = 0, we obtain

v = c_1 e^{-\int a(x) dx}.

Solving

v u' = c_1 e^{-\int a(x) dx} u'= b(x)

subsequently for u yields

u = \int b(x) e^{\int a(x) dx} dx + c.

Hence,

y = u v  = e^{-\int a(x)dx} (\int b(x) e^{\int a(x) dx} dx + c).