How to solve this differential equation?

How to solve the following equation?

$$\frac{\mathrm{d}\, f }{\mathrm{d}x} = f(x) \left(1-f(x)\right)$$

(I've studied differential equations as an undergraduate some years ago but right now I don't know where to start with this equation.)

EDIT 1: equation corrected.

Solution:

$$f(x) = \frac{1}{1 + e^{-x + C}}$$

• What is the RHS? A number? A primitive? – Did May 19 '14 at 17:17
• It's a Bernoulli equation. – Git Gud May 19 '14 at 17:29
• This has been asked many times before. Search this site for "logistic equation". (By the way, you can also try setting $y(x)=1/f(x)$.) – Hans Lundmark May 20 '14 at 6:30

Try separation of variables;

$$\int\frac{dy}{y(1-y)}dy = \int dx$$

$$ln(y) - ln(1-y) = x + const$$

$$y = \frac{e^x}{C+e^x}$$

• That, and $y=0$. – Did May 19 '14 at 20:04
• To do this right, one should be a bit more careful. What if $y<0$ or $y>1$? – Hans Lundmark May 20 '14 at 6:32
• Yes -- these are good points. This is an autonomous nonlinear ODE. The constant solution $y = 0$ is an unstable critical point. The asymptotic behavior depends on the initial condition, with solutions attracted to $y = 1$, if $y(0) > 0$, and blowing up if $y(0) < 0$. – RRL May 20 '14 at 13:45

It is a separable equation that one can write:

$$\frac{f'(x)}{f(x)(1-f(x))}=1\\ f'(x)\left(\frac{1}{f(x)}+\frac{1}{1-f(x)}\right)=1$$

The left hand side is a derivative w.r.t. $x$:

$$((\ln(f(x))-\ln(1-f(x)))'=1\\ \left(\ln\left(\frac{f(x)}{1-f(x)}\right)\right)'=1$$

Integrate both sides.