# Solving a non-ODE $\dot{p} = ap\begin{pmatrix}1-\frac{p}{M}\end{pmatrix}$ & plotting solutions

There are several parts to this question. They are all in grey, so please bear with me.

I am required to show that the class $\large{p = \frac{M}{1+C_2e^{-at}}}$ is a solution to the Differential Equation $$\dot{p} = ap\begin{pmatrix}1-\frac{p}{M}\end{pmatrix} \,\,,M>0$$.

What I did was to convert this to a linear ODE with the substitution $g = \frac 1p$ and also yielding $\dot{g} = -\frac {\dot{p}} {p^2}$ and solving,

\begin{align*} \dot{p} &= ap\begin{pmatrix}1-\frac{p}{M}\end{pmatrix} \\\frac{\dot{p}}{p^2} &= \frac a p-\frac a M \\-\dot{g} &= ag - \frac a M\tag{apply subst.} \\\dot{g} + ag &= \frac a M \end{align*}

Is this a valid substitution that can be applied to a non-linear DE?

Now this is an ODE, apply the integrating factor $e^{at}$ and solving,

\begin{align*} \\\dot{g} (e^{at}) + g(ae^{at}) &= \frac a M e^{at} \\ge^{at} &= \frac{e^{at}}{M} + C_2 \\\frac 1 p &= \frac{1}{M} + C_2e^{-at} \\p &= \frac{M}{1 + C_2e^{-at}} \end{align*}

Is it okay to make the $M$ to be part of the $C_2$ since $C_2$ is an arbitrary constant anyways?

Assume the working thus far is okay. I have to substitue $p_0 = (0)$ and solve for $C_2$ to show the solution can be in the form $\large{p = \frac{M}{1+\frac{M-p_0}{p_0}e^{-at}}}$ so I solved for $C_2$ by:

\begin{align*} p_0 &= p(0) \\&= \frac{M}{1+C_2} \\C_2 &= \frac M {p_0} -1 \\&= \frac{M-p_0}{p_0} \end{align*}

and with substitution,

\begin{align*} \\p &= \frac{M}{1 + C_2e^{-at}} \\&= \frac{M}{1+\frac{M-p_0}{p_0}e^{-at}} \end{align*}

Again, is it a valid subsitution?

Finally, I am asked to plot the function $p$ for the cases

• $p_0 > M$
• $p_0 = M$
• $0<p_0<M$

How should I go about doing so?

• I am thinking the first one exponentially tends to 0
• The second one is just a horizontal line $p = K$
• The third one starts from a very small value and tends to $K$
-

I think your substitution is correct. For the graph, are you plotting $p$ against $t$, and is $M$ a constant here?
If it is a graph of $p$ against $t$, then yes, if $p_{0}=M$, then $p=M$, $\forall t\geq0$.
For $p_{0}>M$, let $p_{0}=M-k$, for some $k>0$. We have $$p=\frac{M}{1+\left(\frac{M-p_{0}}{p_{0}}\right)e^{-at}},\tag1$$ then substitute $p_{0}=M+k$ into equation (1). We then have $$p=M-\frac{Mk}{p_{0}e^{at}-k}.$$ Hence the curve starts at $p_{0}$ (when $t=0$), decreases and approaches $p=M$ at $t \rightarrow \infty$.
For $0<p_{0}<M$, let let $p_{0}=M-l$, for some $l>0$. We then substitute this into equation (1), so $$p=M+\frac{Ml}{p_{0}e^{at}+l}.$$ Hence the curve starts at $p_{0}$ (when $t=0$), increases and approaches $p=M$ at $t \rightarrow \infty$.