# First-order ODE

$$\frac{d x }{dt } = \frac{c}{x} - x + h(t)$$

where $$c \geq 0$$ is a constant; the initial condition is given at time $$t=0$$ (say $$x = x_0$$ at $$t=0$$); and $$h(t)$$ is a function defined for all $$t\geq 0$$.

For $$c=0$$ the solution is

$$x = x_0e^{-t} + \int_0^t e^{-(t-\tau)} h(\tau) d \tau$$

For $$h=0$$ the solution is

$$x = \sqrt{c + (x_0^2 - c) e^{-2 t} }$$

What would the solution be for both $$c$$ and $$h$$ are different from zero?

• Your solution for $c=0$ is incorrect. It should be $$x = x_0e^{-t} + e^{-t}\int_0^t e^{\tau}h(\tau)d\tau$$ – Dylan Mar 4 at 3:45
• Sure, thank you for editing it. – Jennifer Mar 4 at 6:11
• Do you mean a solution in the closed form? For $c=1$ and $h(t)=t$ Mathematica gives nothing, and for $c=1$ and $h(t)=e^t$ it gives $-e^{-t} \left(W\left(-e^{-c_1-\frac{e^{2 t}}{2}-1}\right)+1\right)$, where $W$ is the Lambert $W$ function. – user539887 Mar 4 at 8:51

Hint:

$$\dfrac{dx}{dt}=\dfrac{c}{x}-x+h(t)$$

$$x\dfrac{dx}{dt}=-x^2+h(t)x+c$$

This belongs to an Abel equation of the second kind.

Let $$x=e^{-t}u$$ ,

Then $$\dfrac{dx}{dt}=e^{-t}\dfrac{du}{dt}-e^{-t}u$$

$$\therefore e^{-t}u\left(e^{-t}\dfrac{du}{dt}-e^{-t}u\right)=-e^{-2t}u^2+h(t)e^{-t}u+c$$

$$e^{-2t}u\dfrac{du}{dt}-e^{-2t}u^2=-e^{-2t}u^2+h(t)e^{-t}u+c$$

$$e^{-2t}u\dfrac{du}{dt}=h(t)e^{-t}u+c$$

$$u\dfrac{du}{dt}=h(t)e^tu+ce^{2t}$$

Ｓuppose $$x_0>0$$．Note that $$x'=\frac{c}{x}-x$$ has the GS $$x(t)=\sqrt{c+(C-c)e^{-2t}}$$ Let $$x(t)=\sqrt{c+(u(t)-c)e^{-2t}}$$ be the solution of $$\frac{d x }{dt } = \frac{c}{x} - x + h(t).$$ Then $$u(t)$$ satisfies $$e^{-t}u'(t)=2h(t)\sqrt{c+(u(t)-c)e^{-2t}}$$ which can't be solved explicitly.

• Sorry, it must be wrong. If I put $c=0$ into your formula I don't get the right result, which I wrote in my question. – Jennifer Mar 4 at 2:37
• @Jennifer, sorry, I made a mistake before. – xpaul Mar 4 at 16:22
• What is the relevance of your answer? You have applied the variation-of-constants method completely beyond its scope, and obtained an equation that cannot be solved explicitly. – user539887 Mar 4 at 20:21
• @user539887, I just wanted to say this equation is unsolvable. – xpaul Mar 4 at 20:27
• I do not think that you have shown that the equation is not solvable: you wrote only that if one substitutes a function of $t$ for the constant $C$ then one obtains an equation which cannot be solved explicitly. But why? Perhaps by some other substitution one could obtain more (indeed, this is not so, but it follows from the theory of Abel's equations of second kind, as in Abel differential equation). – user539887 Mar 4 at 21:07