I need to find the solution to the following differential equation:
$$y'+a(x)y=R(x)$$
With $a(x)$ and $R(x)$ smooth functions.
I can re-order this to the following:
$$1.dy+(a(x)y-R(x))dx=0$$
$Q:=1$
$P:=(a(x)y-R(x))$
First thing I need to do is finding out if the equation is exact by checking if $\frac{\partial P}{\partial y}=\frac{\partial Q}{\partial x}$ is true. I didn't add the calculation because it's pretty easy.
I now need to find an integrating factor.
If the following function:
$$g(x):= \frac{1}{Q}(\frac{\partial P}{\partial y}-\frac{\partial Q}{\partial x})=a(x)$$
Is not dependent of y, then $e^{\int g(x)dx} = e^{\int a(x)dx}$ is a valid integrating factor.
This means that
$$(a(x)y-R(x)).e^{\int a(x)dx}dx+e^{\int a(x)dx}dy=0$$
should be an exact differential equation.
Applying the same formulas as earlier (with the new $P$ and $Q$) verifies that since the result to both partial derivatives is $a(x)e^{\int a(x)dx}$
Now to find the solution I need to integrate $P$ for $x$ and $Q$ for $y$ but here's where I get in trouble:
$\int P\ dx =\int (a(x).y-R(x))e^{\int a(x)dx}dx$
How do I integrate this? Is it even possible?