I came across this first order differential equation $$ f'(x) = \left( \frac{1}{x} + \frac{g'(x)}{g(x)} \right) f(x) - c \frac{g'(x)}{g(x)} \textrm{,}$$ where $g(x)$ is this logistic type function $$ g(x) = \frac{h}{1+e^{-(x-a)}} + b $$ and $a$, $b$, $c$ and $h$ are constants.

1st try:

First I tried integrating both sides and got $$ f(x) = \int \frac{f(x)}{x} \mathrm{d}x + \left[ cx - f(x) \right] \ln g(x) + C $$ or $$ \int \frac{f(x)}{x} \mathrm{d}x = \left[ 1 + \ln g(x) \right] f(x) - c x \ln g(x) + C $$ and in both cases the leftover integral term seems to be quite problematic.

2nd try:

After that I remembered that I should probably be using the integrating factor method and looked up that the solution should be $$ f(x) = \frac{1}{\mu(x)} \left( \int \mu(x) \left( - c \frac{g'(x)}{g(x)}\right) \mathrm{d} x + C\right) $$ with $$ \mu(x) = \exp \left[ -\int \left( \frac{g'(x)}{g(x)} + \frac{1}{x} \right) \mathrm{d}x \right] = \frac{1}{x g(x)}$$ so finally $$ f(x) = x g(x) \left( \int \frac{1}{x g(x)} \left( - c \frac{g'(x)}{g(x)}\right) \mathrm{d} x + C \right) = - c x g(x) \left( \int \frac{g'(x)}{g^2(x)} \frac{\mathrm{d} x}{x} + C\right) \textrm{.}$$

The evaluation of the integral $$ \int \frac{g'(x)}{g^2(x)} \frac{\mathrm{d} x}{x} = \int \frac{\mathrm{d}}{\mathrm{d}x} \left( \frac{h}{1+e^{-(x-a)}} + b \right) \left( \frac{h}{1+e^{-(x-a)}} + b \right)^{-2} \frac{\mathrm{d} x}{x} $$ $$ = h \int \left( \frac{ e^{-(x-a)}}{(1+e^{-(x-a)})^2} \right) \left( \frac{h}{1+e^{-(x-a)}} + b \right)^{-2} \frac{\mathrm{d} x}{x} $$ seems quite though and I haven't made much progress.

Is there a way to evaluate this integral or is there possibly an easier way to solve the original differential equation?

EDIT: I just realized that $$ g'(x) = [g(x) - b] - [g(x) - b]^2 = g(x) - b - g^2(x) + 2g(x)b - b^2 $$ so that $$ \frac{g'(x)}{g^2(x)} = \frac{1 + 2b}{g(x)} - \frac{b + b^2}{g^2(x)} - 1 $$ and I would only need to know how to evaluate $$ \int \frac{1}{g(x)} \frac{\mathrm{d} x}{x} \quad \textrm{and} \quad \int \frac{1}{g^2(x)} \frac{\mathrm{d} x}{x} \textrm{.} $$ Could there be a closed form solution or maybe just a series representation or something?


Whenever I see $\displaystyle\frac{g'(x)}{g(x)}$, my immediate instinct is to write that as $[\ln g(x)]'$. Here it helps, as follows:

$f'(x) = [\,\displaystyle\frac{1}{x} + (\ln g)'\,]\,f(x) - c\,(\ln g)'$

$f' = \displaystyle\frac{f}{x} + (f-c)\,(\ln g)'$

Now define a new function $u(x) = f(x) - c$. Then,

$u' = \displaystyle\frac{u + c}{x} + (\ln g)'\,u$

$x\,u' = u + c + x\,(\ln g)'\,u = c + \underbrace{[1 + x\,(\ln g)']}_{a(x)}\,u$

$x\,u'(x) - a(x)\,u(x) = c$

The homogeneous equation is:

$\displaystyle\frac{u'(x)}{u(x)} = \displaystyle\frac{a(x)}{x}$


$[\,\ln u(x)\,]' = \displaystyle\frac{a(x)}{x} = \displaystyle\frac{1}{x} + [\,\ln g(x)\,]'$


$\ln u = \ln x + \ln g + \ln A$

($A$ is an integration constant)

$u(x) = A\,x\,g(x)$

I'll let you continue from here. You could use the method of variation of parameters to find a particular solution $u_{p}(x)$ of

$x\,u'(x) - a(x)\,u(x) = c$

then use $f(x) = A\,x\,g(x) + u_{p}(x) + c$ as your final general solution.

Edit: I decided to complete the solution so...

Method of variation of parameters. We have a general solution of the homogeneous equation, $u(x) = A\,x\,g(x)$. Now, try a particular solution of the form $u_p(x) = A(x)\,x\,g(x)$. Then,

$x\,u'(x) - a(x)\,u(x) = c$

gives us

$A'(x)\,x^2\,g(x) = c$


$A(x) = \displaystyle\int^x \frac{c\,dt}{t^2\,g(t)}$


$u_p(x) = A(x)\,x\,g(x) = c\,x\,g(x) \displaystyle\int^x \frac{dt}{t^2\,g(t)}$

and the final general solution is

$f(x) = A\,x\,g(x) + c\,x\,g(x) \displaystyle\int^x \frac{dt}{t^2\,g(t)} + c$

where $A$ is a constant.

| cite | improve this answer | |
  • $\begingroup$ Thanks for the answer, any ideas on the evaluation of $$ \int^x \frac{\mathrm{d} t}{t^2 g(t)} = \int^x \frac{1}{h/(1+\exp[-(t-a)]) + b} \frac{\mathrm{d} t}{t^2} \textrm{?} $$ $\endgroup$ – 655321 Apr 23 '15 at 22:35
  • 1
    $\begingroup$ Yes. The integral simplifies into the sum of two integrals of the form $\int^x dt\,\displaystyle\frac{t^{-2}\,(e^{t-a})^m}{B\,e^{t-a} + 1}$, one with $m=0$ and the other with $m=1$, where $B=1+h/b$. Then try to use integration by parts to solve the two integrals. $\endgroup$ – wltrup Apr 24 '15 at 4:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.