# Help with a first-order ordinary differential equation

I would need some help in solving the following differential equation: \begin{equation} u'(p) + \frac{r+ N \lambda p }{N\lambda p (1-p)} u(p) = \frac{r + N \lambda p}{N\lambda (1-p)} g. \end{equation}

I already know that the solution is of the form \begin{equation} gp + C(1-p)\left(\frac{1-p}{p}\right)^{r/\lambda N}, \end{equation} where $C$ is a constant.

Now this is a standard linear first-order differential equation. Letting $$f(p) = \frac{r+ N \lambda p }{N\lambda p (1-p)}, \ \ q(p) = \frac{r + N \lambda p}{N\lambda (1-p)} g, \ \ \mu(p) = e^{\int f(p) dp},$$ the solution should have the form \begin{equation} u(p) = \frac{C}{\mu(p)} + \frac{1}{\mu(p)} \int \mu(p) q(p) dp, \end{equation} where $C$ is a constant.

The calculation of $\mu(p)$ was not much of a problem. Indeed, we can rewrite $f(p)$ as $$f(p) = \frac{r}{N\lambda} \frac{1}{p} + \left(1+ \frac{r}{N\lambda}\right)\frac{1}{1-p}$$ Using $\int \frac{1}{p} dp = \ln(p)$ and $\int \frac{1}{1-p} dp = - \ln (1-p)$, I found that $$\mu(p) = p^{\frac{r}{N\lambda}}(1-p)^{-1-\frac{r}{N\lambda}}.$$ Where I have difficulties is calculating the term $\int \mu(p) q(p) dp$, where $$\mu(p) q(p) = \frac{rg}{N\lambda} p^{\frac{r}{N\lambda}} (1-p)^{-2-\frac{r}{N\lambda}} + p^{\frac{r}{N\lambda}+1} (1-p)^{-2-\frac{r}{N\lambda}}.$$

How do I integrate this last term? Or did I miss something obvious, because in the paper I'm looking at they don't provide any details about how they get to the solution of the differential equation.

Thanks in advance for the help.

Edit: small typo corrected in the last displayed equation.

Edit: there is a big typo in the differential equation: the rhs should have $r + N \lambda$ rather than $r + N\lambda p$ in the numerator. This probably makes it much simpler to solve. My bad.

• Is this Keller, Rady, and Cripps? Have you tried plugging the integral into Wolfram Alpha? – Theoretical Economist Aug 21 '18 at 2:34
• It is indeed Keller, Rady and Cripps. I hadn't tried plugging into Wolfram Alpha. I'm having a look at it now, it seems that integrating $x^a (1-x)^{-2-a}$ does not give something too bad, but integrating $x^{a+1} (1-x)^{-2-a}$ gives something quite horrible. I will play with it a little bit more. – LearnToSwim Aug 21 '18 at 2:37
• At this stage though if nothing really simple comes out I'm more inclined to simply check that their solution solves the differential equation, but it's not very satisfactory. – LearnToSwim Aug 21 '18 at 2:47
• If the region of integration was [0,1] then the result would involve Beta functions. Hope it helps. – Fede Poncio Aug 21 '18 at 7:07
• If I made no mistake in checking, the solution of $$\begin{equation} u'(p) + \frac{r+ N \lambda p }{N\lambda p (1-p)} u(p) = \frac{r + N \lambda p}{N\lambda (1-p)} g \end{equation}$$ cannot be on the form $$\begin{equation} gp + C(1-p)\left(\frac{1-p}{p}\right)^{r/\lambda N} . \end{equation}$$ Probably there is a typo somewhere. – JJacquelin Aug 21 '18 at 9:18

## 1 Answer

After the OP corrected the typo, the PDE becomes easy to solve.

$$u'(p) + \frac{r+ N \lambda p }{N\lambda p (1-p)} u(p) = \frac{r + N \lambda }{N\lambda (1-p)} g$$ $a=\frac{r}{N\lambda}$

$$u'(p) + \frac{a+ p }{ p (1-p)} u(p) = \frac{a + 1 }{ (1-p)} g$$

An obvious particular solution is $u=gp$. Thus, change of function : $u(p)=v(p)+gp$ $$v'+g + \frac{a+ p }{ p (1-p)} (v+gp) = \frac{a + 1 }{ (1-p)} g$$ After simplification : $$v'+\frac{a+ p }{ p (1-p)}v=0$$ Separable ODE easy to solve : $$v=C \frac{(1-p)^{1+a}}{p^a}$$ $$u=gp+C \frac{(1-p)^{1+a}}{p^a}$$

• Thanks a lot JJacquelin. Somehow your method using the particular solution $gp$ is simpler than what I was trying to do – LearnToSwim Aug 21 '18 at 23:23
• @LearnToSwim if you've found this answer helpful, you should consider accepting it. (Click the check to the left of the question, near the voting buttons.) – Theoretical Economist Aug 31 '18 at 3:11
• Thanks for letting me know @TheoreticalEconomist, didn't know about accepting an answer. – LearnToSwim Sep 2 '18 at 22:52
• @LearnToSwim No problem! Glad you got an answer — I remember being puzzled about this exact ODE a long time ago. I had forgotten how to solve it since then, so it’s good that there’s an answer accessible on the Internet somewhere. – Theoretical Economist Sep 2 '18 at 23:06