# solve differential equation [solved]

I want to solve the following first- order nonlinear ordinary differntial equation:

$$\frac{dx}{dt}=a-b x-cx(1-x)=cx^2-x(b+c)+a$$

where a,b and c are constants. I rewrote the equation:

$$\leftrightarrow 1=\frac{1}{cx^2-x(b+c)+a}\frac{dx}{dt}\\ \leftrightarrow \int 1dt=\int \frac{1}{cx^2-x(b+c)+a} dx\\ \leftrightarrow t+k= \int \frac{1}{cx^2-x(b+c)+a} dx\\ \leftrightarrow t+k= \int \frac{1}{c(x-\frac{b+c}{2c})^2+a-\frac{(b+c)^2}{4c}} dx$$

for some arbitrary number k. How do I solve the last integral? Wolfram-Alpha tells me that it is

$$\frac{2tan^{-1}(\frac{-c-b+2cx}{\sqrt{-c^2-b^2-2cb+4ca}})}{\sqrt{-c^2-b^2-2cb+4ca}}$$

But I don't know how to calculate that on my own.

• Looking good so far. I would complete the square in the denominator and use a trig substitution. – Adrian Keister Nov 28 '18 at 13:48
• What do you mean with completing the square? – Sunny Nov 28 '18 at 14:00
• I mean you have a quadratic in the denominator of your integral, $cx^2-x(b+c)+a,$ and I'm suggesting you complete the square on it. – Adrian Keister Nov 28 '18 at 14:02
• Indeed, remember that arctan comes from $\int\frac{1}{x^2+a^2}dx$, so try to complete the square in the denominator - a pack the linear term into the square. – orion Nov 28 '18 at 14:13
• I have edited my question and completed the square in the denominator. – Sunny Nov 28 '18 at 14:25

The main step is converting the fraction

$$\frac{1}{cx^2+x(b+c)+a}$$ into the form, expected from the integral tables:

$$\int\frac{1}{t^2+q^2}dt=\frac{1}{q}\arctan \frac{t}{q}$$

You take out the extra $$c$$, complete the square and change variables:

$$\frac{1}{c}\frac{1}{\color{red}{(x+\frac{b+c}{2c})}^2-(\frac{b+c}{2c})^2+\frac{a}{c}}$$

Now you have $$t=x+\frac{b+c}{2c}$$ and $$q^2=\frac{a}{c}+(\frac{b+c}{2c})^2$$.

The right side has two roots $$r_1, r_2$$. These roots are then also constant solutions of the ODE. With these solutions the expression $$u=\frac{x-r_1}{x-r_2}$$ has the derivative $$u'=-\frac{(r_2-r_1)}{(x-r_2)^2}\,x'=-c(r_2-r_1)u.$$ This ODE for $$u$$ can now be easily solved. After that, back-substitution gives $$x=\frac{r_2u-r_1}{u-1}$$

After completing the square the integral has the form:

$$\int \frac{1}{c(x-\frac{b+c}{2c})^2+a-\frac{(b+c)^2}{4c}} dx=\frac{1}{c}\int \frac{1}{(x-\frac{b+c}{2c})^2+\frac{a}{c}-\frac{(b+c)^2}{4}}$$

By defining $$y:=x-\frac{b+c}{2c}$$ and $$p^2:=\frac{a}{c}-\frac{(b+c)^2}{4}$$ we get:

$$\frac{1}{c}\int \frac{1}{(x-\frac{b+c}{2c})^2+\frac{a}{c}-\frac{(b+c)^2}{4}}=\frac{1}{c}\int\frac{1}{y^2+p^2}=\frac{1}{c}\frac{arctan(\frac{y}{p})}{p}+k_1=\frac{1}{c}\frac{arctan(\frac{x-\frac{b+c}{2c}}{\sqrt{\frac{a}{c}-\frac{(b+c)^2}{4}}})}{\sqrt{\frac{a}{c}-\frac{(b+c)^2}{4}}}+k_1$$

for some arbitrary number $$k_1$$.