I attempted to solve the following first-order linear ODE: $$ \frac{dn}{dt} = rn(t)+m $$

This is what I managed to come up with: \begin{align} \int \frac{1}{rn(t)+m}dn & = \int 1dt \\ \frac{\ln(rn(t)+m)}{r} & = t+C \\ rn(t)+m & = e^{r(t+C)}\\ rn(t)+m & = e^{rt}e^{rC} \end{align}

$$ rn(0)+m = e^{rC} $$

\begin{align} rn(t)+m & = e^{rt}(rn(0)+m) \\ n(t) & = \frac{e^{rt}rn(0)+e^{rt}m-m}{r} \\ n(t) & = \frac{e^{rt}rn(0)+(e^{rt}-1)m}{r} \\ n(t) & = e^{rt}n(0)-\frac{m}{r}(1-e^{rt}) \end{align}

This solution should be correct based on the book where I got the ODE from. (Otto, S.P.; Day, T., 2007. A Biologist's Guide to Mathematical Modeling in Ecology and Evolution. Princeton University Press. (p. 200.: Recipe 6.3)) My purpose was to work the solution out by a separation of variables by myself.
But when I give $\frac{dn}{dt}=rn(t)+m$ to WolframAlpha, its solution is the following: $$ n(t) = c_1e^{rt}-\frac{m}{r} $$

Where does this come from? And how do these two solutions correspond/relate to each other? I've tried but could not work it out.


1 Answer 1


They are the same, we will find $c_{1}.$

Let $t=0$ in the WolframAlpha solution, then $$n(0)=c_{1}-\frac{m}{r}$$

$$c_{1}=n(0)+\frac{m}{r}$$ and thus we have $$n(t)=c_{1}e^{rt}-\frac{m}{r}$$ $$=e^{rt}(n(0)+\frac{m}{r})-\frac{m}{r}$$ $$=e^{rt}n(0)-\frac{m}{r}(1-e^{rt}).$$

You showed that $rn(t)+m=e^{rt}e^{rC}$ or $n(t)=\frac{e^{rC}}{r}e^{rt}-\frac{m}{r}.$ Then since $\frac{e^{rC}}{r}$ is just another constant, we can let $\frac{e^{rC}}{r}=c_{1}$ to obtain the WolframAlpha solution $n(t)=c_{1}e^{rt}-\frac{m}{r}.$ The constant is fixed by the boundary condition at $t=0$.


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.