# Help with a first-order ordinary differential equation

I would need some help in solving the following differential 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.$$

I already know that the solution is of the form $$gp + C(1-p)\left(\frac{1-p}{p}\right)^{r/\lambda N},$$ 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 $$u(p) = \frac{C}{\mu(p)} + \frac{1}{\mu(p)} \int \mu(p) q(p) dp,$$ 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 $$$$u'(p) + \frac{r+ N \lambda p }{N\lambda p (1-p)} u(p) = \frac{r + N \lambda p}{N\lambda (1-p)} g$$$$ cannot be on the form $$$$gp + C(1-p)\left(\frac{1-p}{p}\right)^{r/\lambda N} .$$$$ Probably there is a typo somewhere. – JJacquelin Aug 21 '18 at 9:18

$$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