# Differential equation with reciprocal and constant

I have the following differential equation with a reciprocal and a constant:

$$dx/dt =-\frac{a}{x}-b,$$

where $a$ is a positive constant and $b$ a nonnegative constant. I can solve this for $b=0$. Then (if this is allowed...) $$x dx = -adt.$$ Integrating both sides and summing up the constants of integration gives $$\frac{1}{2} x^2 = -at+C,$$ hence $$x = \sqrt{2(-at+C)}.$$ Perhaps this is a rather elementary question, but how can this be solved for $b>0$? Since $1/x$ is not a well-behaved function, does this differential equation have an analytical solution?

Just shift all of the R.H.S in the denominator and put the $dt$ in the R.H.S to get $$\frac{dx}{\frac{-a}{x}-b}=dt$$ $\implies$ $$\int \frac{-xdx}{a+bx}=\int dt$$ $\implies$ $$\int \frac{-bx-a+a}{a+bx}dx=bt+bC$$ $\implies$ $$-x+a\int \frac{dx}{a+bx}=bt+bC$$ Hence $$-x+\frac {a}{b}\log_e |a+bx|=bt+C'$$ is the required solution.

• And, once more, $x$ would be given in terms of Lambert function ! Cheers. – Claude Leibovici Feb 24 '16 at 11:13
• Thank you. I understand all your steps. Neat trick to multiply by $a$ and adding and subtracting $b$. Seems like this can only be solved numerically for $x$, but that should be easy with a computer. – Forzaa Feb 24 '16 at 11:17
• You can also use the W function as Claude pointed out – Nikunj Feb 24 '16 at 11:18
• I did a major edit, I had solved it wrongly, but now it's corrected (just so you know) – Nikunj Feb 24 '16 at 11:21
• @Nikunj Can you show how writing it in terms of lambert W would work? I'm stuck with this $a$ term before the logarithm. My function becomes something like $-(a+bx)^ae^{-(a+bx)} = Ce^{b^2t}$. This is only a Lambert W function if $a=1$. – Forzaa Feb 26 '16 at 12:39

\begin{align*} \int dt &= -\int \frac{dx}{\frac{a}{x}+b} \\ t &=\int \frac{x\, dx}{a+bx} \\ &=\int \left[ \frac{1}{b}-\frac{a}{b(a+bx)} \right] dx \\ &=\frac{x}{b}-\frac{a}{b^{2}} \ln |a+bx|+C \end{align*}

• @Nikunji, breakdown into partial fractions first. – Ng Chung Tak Feb 24 '16 at 11:23
• Your first approach was clearly wrong so that's why I asked, any way this one is correct! – Nikunj Feb 24 '16 at 11:30
• @Nikunji, made a lot of typos while editing – Ng Chung Tak Feb 24 '16 at 11:33