# How to solve this IVP?

A certain population grows according to the diﬀerential equation: $$\frac{\mathrm{d}P}{\mathrm{d}t} = \frac{P}{20}\left(1 − \frac{P}{4000}\right)$$ and the initial condition $P(0) = 1000$. What is the size of the population at time $t = 10$?

$$P(10)=\frac{4000}{(1 + 3e^{1/2})}$$

but I can't seem to get it. I have tried to bring all the right hand side terms to integrate with respect to $P$. But I end up getting stuck with this equation $$20\ln{(P)} + \frac{80000}{P} = 90 + 20\ln{(1000)}$$ and don't know how to isolate $P$...

Thanks so much! :)

• is it $\frac{P\left(1-\frac{P}{4000}\right)}{20}$ or $\frac{P}{20\left(1-\frac{P}{4000}\right)}$ ? – idm Aug 9 '14 at 19:20
• Nope the above question is correct – inggumnator Aug 9 '14 at 19:21
• In the logarithmic equation, you can't isolate $P$. – rae306 Aug 9 '14 at 19:26

I'm not entirely sure where your equation came from, but this solves the problem. $$\frac{\mathrm{d}P}{\mathrm{d}t}=\frac{P}{20}\left(\frac{4000-P}{4000}\right)=\frac{P(4000-P)}{80000}$$

Then we want to separate variables and get:

$$\frac{\mathrm{d}P}{P(4000-P)}=\frac{\mathrm{d}t}{80000}$$

Where you can employ the method of partial fractions and integrate. This yields

$$\frac{1}{4000}\int\left[\frac{1}{P}+\frac{1}{4000-P}\right]\;\mathrm{d}P=\frac{1}{80000}\int\mathrm{d}t$$ $$\ln{(P)}-\ln{(4000-P)}=\frac{t}{20}+c$$ where $c$ is the combined constant of integration from both sides. $$\ln{\left(\frac{P}{4000-P}\right)}=\frac{t}{20}+c$$ $$\frac{P}{4000-P}=e^{t/20+c}$$ $$\frac{P}{4000-P}=ke^{t/20}$$ where $k=e^c$ $$P=(4000-P)ke^{t/20}$$ $$P=4000ke^{t/20}-Pke^{t/20}$$ $$P(1+ke^{t/20})=4000ke^{t/20}$$ $$P(t)=\frac{4000ke^{t/20}}{1+ke^{t/20}}$$

Now we need to find $k$. When $t=0$ we have $$P(0)=\frac{4000k}{1+k}=1000$$ which has a solution of $k=1/3$

$$P(t)=\frac{\frac{4000}{3}e^{t/20}}{1+\frac{1}{3}e^{t/20}}$$

Divide by $\frac{1}{3}e^{t/20}$ on top and bottom.

$$P(t)=\frac{4000}{1+3e^{-t/20}}$$

Now just plug in $t=10$ and we get

$$P(10)=\frac{4000}{1+3e^{-1/2}}$$

This is off by a negative from the answer you provided, but extensive checking (plugging it back into the starting formula and verifying with WolframAlpha) confirms my answer. Could you share the steps you took to get to your logarithmic equation?

• Ah, thanks! I now understand how to get the solution. My mistake was that I didn't combine the two fractions on the right hand side in the original equation before integrating by P >< – inggumnator Aug 10 '14 at 5:24

The solution of your logistic differential equation, $$P'(t) = \alpha P(t) (1-\beta P(t)),$$ with $\alpha = 1/20$, $\beta = 1/4000$ is given by:

$$\color{blue}{P(t) = \frac{1}{\beta + k\, e^{-\alpha t}}} \tag{1},$$ with $k$ a constant of integration. Now set the initial condition to have:

$$P(0) = P_0 =1000 = \frac{1}{\beta + k} \Rightarrow k = \frac{1}{P_0}-\beta,$$ substituting back all this for $t=10$ you have:

$$P(t=10) = \frac{1}{1/4000 + (1/1000 - 1/4000) e^{-1/2}} = \frac{4000}{1 + 3e^{-1/2}},$$ as @BeaumontTaz has shown previously.

Note that I just want to highlight that this kind of equations finds applications in a range of fields, including artificial neural networks, biology, biomathematics, chemistry, demography, economics, geoscience, mathematical psychology, probability, sociology, political science, and statistics [Source].

Cheers!

Edit: I will add the derivation of the solution just for completeness.

Follow the steps I'm going to describe below:

\begin{align} \frac{dP/dt}{\alpha P ( 1- \beta P)} & = 1 \\ \frac{dP}{\alpha P(1-\beta P)} & = dt \\ \int^P_{P_0} \frac{dP}{\alpha P(1-\beta P)} & = \int^t_0 dt = t. \\ \end{align} Let's focus on the LHS integral:

\begin{align} \int^P_{P_0} \frac{dP}{P(1-\beta P)} & = \int^P_{P_0} \left( \frac{1}{P} + \frac{\beta}{1-\beta P}\right) \, dP\\ & = \left.[\log{|P|} - \log{|1-\beta P|}]\right|^P_{P_0} \\ & = \log{ \left|\frac{P (1-\beta P_0)}{P_0 (1-\beta P)} \right|}. \end{align} Therefore, we have:

$$\log{ \frac{P (1-\beta P_0)}{P_0 (1-\beta P)} } = \alpha t,$$ take exponentials on both side to have:

$$\frac{P (1-\beta P_0)}{P_0 (1-\beta P)} = e^{\alpha t} \Rightarrow \color{blue}{P(t) = \frac{P_0 e^{\alpha t}}{1- \beta P_0 + \beta P_0 e^{\alpha t}}} \tag{2},$$ which you can check matches the previous result after further simplification.

• Hmm I see so there is actually a formula for the solution to this type of equations. Never knew that. Thanks! :) – inggumnator Aug 10 '14 at 5:27
• Hi @inggumnator! Of course there is a formula for this kind of equations (because they are well known) but you may not write it down as it came out of the blue. I just posted it because I derived it and the other user had done the same previously. Cheers! – Dmoreno Aug 10 '14 at 8:49
• Ah I see! Just want to check though, what does P0 actually mean in the definite integral? How do you obtain P0? Also, in (2), how do you get from the equation on the left to that on the right? I thought isolating P(t) would result in P0(1-BP)/(1-BP0) - B stands for beta. – inggumnator Aug 11 '14 at 3:31
• Hi there again @inggumnator. 1) $P_0$ stands for the value of $P$ at $t = 0$, i.e., $P(t=0) = 1000$. When you integrate an ODE of the form $F(y(t))dy = G(t)dt$ you can usually write $\int^{y(t)}_{y(t_0)} F \, dy = \int^t_{t_0} G \, dt$ so you don't have to deal explicitly with the initial condition. 2) Solving for $P$ in eq. (2) comes from multiplying both sides by $(1-\beta P)$ and isolating $P$. (3) You can learn how to use MathJax here: meta.math.stackexchange.com/questions/5020/…, so you can make your future quests./ans more readable! Cheers! – Dmoreno Aug 11 '14 at 8:59

We have that $\frac{dP}{dt}=\frac{P(4000-P)}{80,000}$, so substituting $z=\frac{1}{P}=P^{-1}$ gives $\frac{dz}{dt}=-P^{-2}\frac{dP}{dt}$.

Then multiplying by $-P^{-2}$ gives $-P^{-2}\frac{dP}{dt}=\frac{-P^{-1}(4000-P)}{80,000}$ or $\frac{dz}{dt}=\frac{1}{80,000}-\frac{1}{20}z$.

Then $\frac{dz}{dt}+\frac{1}{20}z=\frac{1}{80,000}$, so multiplying both sides by $e^{\frac{1}{20}t}$ yields

$\displaystyle e^{\frac{1}{20}t}\left(\frac{dz}{dt}+\frac{1}{20}z\right)=\frac{1}{80,000}e^{\frac{1}{20}t}$ and therefore $\displaystyle\left(e^{\frac{1}{20}t}z\right)^{\prime}=\frac{1}{80,000}e^{\frac{1}{20}t}.$

Integrating gives $\displaystyle e^{\frac{1}{20}t}z=\frac{1}{4000}e^{\frac{1}{20}t}+C$,

so $\displaystyle z=\frac{1}{4000}+Ce^{-\frac{1}{20}t}=\frac{1+De^{-\frac{1}{20}t}}{4000}$ (where $D=4000C$).

Taking reciprocals gives $\displaystyle P=\frac{4000}{1+De^{-\frac{1}{20}t}},\;\;$ and $P(0)=1000\implies \frac{4000}{1+D}=1000\implies D=3$.

Therefore $\displaystyle P(10)=\frac{4000}{1+3e^{-\frac{1}{2}}}.$

$\textbf{Given}$

$\dfrac{dP}{dt} = \dfrac{P}{20}\left(1-\dfrac{P}{4000}\right)$, $P(0) = 1000$.

$\textbf{Find}$

$P(10)$

$\textbf{Analysis}$

$\dfrac{dP}{dt} = \dfrac{P}{20}\left(1-\dfrac{P}{4000}\right)$.

First divide out $P\left(1-\dfrac{P}{4000}\right)$ from the RHS and multiply $dt$ over from the LHS: $$\dfrac{dP}{P(1-P/4000)} = \dfrac{dt}{20}. \hspace{3in} (1)$$ Next use partial fraction decomposition on the LHS: \begin{align*} \dfrac{dP}{P(1-P/4000)} & = \dfrac{A\ dP}{P} + \dfrac{B\ dP}{(1-P/4000)} \\ & \Rightarrow 1 = A\left(1-\dfrac{P}{4000}\right) + BP\\ & \Rightarrow \left\{\begin{array}{lr} A = 1\\ B = 1/4000 \end{array}\right. \end{align*} The solutions for $A,B$ comes from equating coefficients. Hence, we may rewrite equation (1) as $$\dfrac{dP}{P} + \dfrac{dP}{4000-P} = \dfrac{dt}{20}.$$ Integrate both sides $$\int \left(\dfrac{1}{P} + \dfrac{1}{4000-P}\right)dP = \dfrac{1}{20}\int dt,$$ $$\ln\left(\dfrac{P}{4000-P}\right) = \dfrac{t}{20} + C.$$ Exponentiate both sides $$\dfrac{P}{4000-P} = Ke^{t/20} \hspace{1cm} \Rightarrow \hspace{1cm} P = (4000-P)Ke^{t/20}$$ so that $$P = 4000\dfrac{Ke^{t/20}}{1 + Ke^{t/20}}.$$ Now, the initial condition is $P(0) = 1000$, thus $$P(0) \equiv 1000 = 4000\dfrac{K}{1 + K} \hspace{1cm} \Rightarrow \hspace{1in} K=\dfrac{1}{3}.$$ So $P(t)$ is given explicitly by $$P(t) = \dfrac{4000}{1+3e^{t/20}},$$ and $P(10) = \dfrac{4000}{1+3e^{-1/2}}$.