Formal solution to general linear 1st order ODE Is there a closed (integral) form for solution of ODE of the following form -
$$a(x)f'(x)+b(x)f(x)=c(x)$$
with arbitrary but strictly positive $a(x)$ and $b(x)$ and non-negative $f(x)$? The solution is trivial for $c(x)=0$, however I seek solutions for cases of $c(x)=\text{const}$ and hopefully also for arbitrary $c(x)$.
Restricted form of solution might be helpful as well, i.e. solution under further constraints on $a(x)$, $b(x)$ or $c(x)$ or relations between them.
 A: There is in fact, under very general conditions, a closed integral form for solutions to
$a(x)f'(x) + b(x) f(x) = c(x), \; f(x_0) = f_0, \tag 1$
which is in fact very easy to derive, though it may not satisfy the desired condition
$f(x) \ge 0; \tag 2$
with
$a(x) > 0, \tag 3$
it is most convenient to divide through by $a(x)$, defining
$P(x) = \dfrac{b(x)}{a(x)}, \; Q(x) = \dfrac{c(x)}{a(x)}, \tag 4$
so that (1) becomes
$f'(x) + P(x)f(x) = Q(x); \tag 5$
then we may multiply this equation through by the factor
$\exp \left (\displaystyle \int_{x_0}^x P(s) \; ds \right ) \tag 6$
and obtain
$\exp \left (\displaystyle \int_{x_0}^x P(s) \; ds \right )f'(x) + P(x)\exp \left (\displaystyle \int_{x_0}^x P(s) \; ds \right )f(x) = \exp \left (\displaystyle \int_{x_0}^x P(s) \; ds \right )Q(x), \tag 7$
and observing that
$\left ( \exp \left (\displaystyle \int_{x_0}^x P(s) \; ds \right ) f(x) \right )'$
$= \exp \left (\displaystyle \int_{x_0}^x P(s) \; ds \right )f'(x) + P(x)\exp \left (\displaystyle \int_{x_0}^x P(s) \; ds \right )f(x), \tag 8$
we write (7) as
$\left ( \exp \left (\displaystyle \int_{x_0}^x P(s) \; ds \right ) f(x) \right )' = \exp \left (\displaystyle \int_{x_0}^x P(s) \; ds \right )Q(x), \tag 9$
which in fact may be directly integrated 'twixt $x_0$ and $x$:
$\exp \left (\displaystyle \int_{x_0}^x P(s) \; ds \right ) f(x) - f(x_0)$
$= \displaystyle \int_{x_0}^x \left ( \exp \left (\displaystyle \int_{x_0}^u P(s) \; ds \right ) f(u) \right )' \; du = \displaystyle \int_{x_0}^x \exp \left (\displaystyle \int_{x_0}^u P(s) \; ds \right )Q(u) \; du, \tag{10}$
and then re-written as
$\exp \left (\displaystyle \int_{x_0}^x P(s) \; ds \right ) f(x) = f_0 + \displaystyle \int_{x_0}^x \exp \left (\displaystyle \int_{x_0}^u P(s) \; ds \right )Q(u) \; du, \tag{11}$
or
$f(x) = \exp \left (-\displaystyle \int_{x_0}^x P(s) \; ds \right ) \left ( f_0 + \displaystyle \int_{x_0}^x \exp \left (\displaystyle \int_{x_0}^u P(s) \; ds \right )Q(u) \; du \right ), \tag{12}$
the requisite closed integral form for $f(x)$.
We now have a way of finding $f(x)$; but enforcing the requirement (2) is a different matter, and it's not at all clear it can be done; it appears to me that ensuring (2) binds will place further restricions on $P(x)$ and $Q(x)$, but what those may be I do not know off hand; it is, however, evident from (12) that (2) is equivalent to
$ f_0 + \displaystyle \int_{x_0}^x \exp \left (\displaystyle \int_{x_0}^u P(s) \; ds \right )Q(u) \; du \ge 0, \tag{13}$
since the exponential 
$\exp \left (-\displaystyle \int_{x_0}^x P(s) \; ds \right ) > 0, \tag{14}$
always.  It is clear, though, that if the integral occurring in (13) is bounded below, then (2) may be had by taking $f_0$ sufficiently large.
