solving first order ODE with integrating factor

Posted: April 3, 2013 in Mathematics

Personally, I don’t like DEs because they are boring, a bit too much of calculation for my liking.  Maybe this is my first and last post on DEs here.

Anyway, this is for a friend’s request…

So how do we solve non-separable ODE of this type?

$\dfrac{dy}{dx}+p(x)y=q(x)$

The answer is multiplying both sides by the integrating factor.

$e^{\int p(x)\, dx}$

The idea comes from the product rule and this, since

$\frac{d}{dx}ye^x = y'e^x+ye^x$

and if we replace the exponent of $e$ with $\int p(x)\,dx$, then

$\dfrac{d}{dx}e^{\int p(x)\, dx}=p(x)e^{\int p(x)\, dx}$ by chain rule

Therefore

$y'+p(x)y=q(x)$

becomes

$y'e^{\int p(x)\, dx}+p(x)ye^{\int p(x)\, dx}=q(x)e^{\int p(x)\, dx}$

$\dfrac{d}{dx} ye^{\int p(x)\, dx} = q(x)e^{\int p(x)\, dx}$

then

$\displaystyle y=e^{-\int p(x)\, dx}\int q(x)e^{\int p(x)\, dx} \,dx$

For example

$y'+y=e^{-x}, \quad y(0)=1$

then the integrating factor is

$e^{\int p(x)\, dx} = e^{\int dx} = e^x$

hence, we have

$y'e^x+ye^x=e^{-x}e^x$

$\dfrac{d}{dx} ye^x = 1$

$\displaystyle ye^x=\int dx = x+C$

since the initial value $y(0)=1$, we have

$(1)e^0=0+C$

$C=1$

Therefore

$ye^x=x+1$

$y=\dfrac{x+1}{e^x}$