# solve the differential equation $\dot{x} + a\cdot x - b\cdot \sqrt{x} = 0$

## Problem

I want to know how to solve the differential equation $$\dot{x} + a\cdot x - b\cdot \sqrt{x} = 0$$ for $$a>0$$ and both situations: for $$b > 0$$ and $$b < 0$$.

## My work

One can separate the variables to obtain: $$\frac{dx}{b\cdot \sqrt{x} - a\cdot x} = dt$$ but I do not know how to proceed ... https://www.wolframalpha.com/input/?i=solve+x%27(t)%2Bax(t)-bsqrt(x(t))+%3D+0 it seems to have an explicit solution ...

## Context

This problem occurs in the following context: $$\ddot{X} + a \cdot \dot{X} = f(X)$$ then multiplying both sides with $$2\dot{X}^T$$ one obtains: $$(\dot{X}^T\dot{X})' + 2a\cdot \dot{X}^T\dot{X} = 2\dot{X}^T f(X)$$ Let $$v= \dot{X}^T \dot{X}$$ and the above differential equation arises ...

• It seems that this is a Bernoulli equation ... – C Marius May 14 at 19:02

The next step is to integrate,

$$t+c=\int\frac{dx}{b\sqrt x-ax}=\int\frac{d\sqrt x^2}{b\sqrt x-a\sqrt x^2}=\int\frac{2\,d\sqrt x}{b-a\sqrt x}=-\frac2a\log\left(\frac ba-\sqrt x\right).$$

From this you can draw $$x$$,

$$x=\left(\frac ba-e^{-a(t+c)/2}\right)^2.$$

• ...along with the trivial solution $x = 0$ (which was lost when OP divided by something with $\sqrt{x}$ as a factor). – John Hughes May 14 at 19:57

Some caution has to be taken here because of the presence of the $$\sqrt{}$$ function--we need to keep track of signs carefully. We know that $$x(t) \ge 0$$ everywhere, so there is a function $$u$$ such that $$u \ge 0$$ and $$x = u^2$$. Additionally, we can scale $$u$$ and $$t$$ to eliminate the constants. The proper choice for this is $$x(t) = (b/a)^2 u(a t/2)^2$$, giving $$u\, [u'+u - \mathrm{sgn}(b)] = 0$$ which has two solutions: $$u(s)= 0$$ and $$u(s) = \mathrm{sgn}(b)+Ce^{-s}$$. For this second solution, $$x(t) = (b/a)^2 [\mathrm{sgn}(b)+Ce^{-s}]^2$$. Factoring $$|b|/a$$ into the brackets gives $$x(t) = \left(\frac{b}{a} + Ce^{-at/2}\right)^2 \;\;\;\;\mathrm{or}\;\;\; x(t) = 0$$ Except, there's one little problem here. We required $$u\ge 0$$, but that term in parentheses, which has the same sign as $$u$$, could be negative. The key is to note that for both solutions, when $$x(t) = 0$$, $$x'(t)$$ is also $$0$$. This allows them to be spliced together at that point and still be continuously differentiable. Thus, the general solution is $$x(t) = \left[\max \left(\frac{b}{a} + Ce^{-at/2},0\right)\right]^2$$ for an arbitrary real constant $$C$$.

One way of working this out is to make the substitution $$y = \sqrt{x}$$. Then, $$\frac{dx}{b\sqrt{x}-ax} \rightarrow \frac{2ydy}{by-ay^2} = \frac{2ydy}{y(b-ay)}.$$ You can treat the integral in $$y$$ with partial fractions.

• Much faster to simplify $\dfrac2{b-ay}dy$ ! – Yves Daoust May 14 at 19:20