# System of ordinary differential equations

I am trying to solve the system of differential equations dx/dt = (y-x)/(x+y), dy/dt = -y/(x+y), where x and y are functions of t, and x(0)=0, y(0)=c (positive constant). I would like to find x and y explicitly in terms of t.

This problem is related to my previous question "Probability problem with solution involving e."

Any help would be appreciated. Thanks.

Continuing Michael's answer: Solve $dy/dx = y/(x-y), y(0)=c$ to get (in terms of the Lambert W function) $y(x) = \operatorname{e} ^{W(-x/c) + \mathrm{log} (c)}$. Substitute this into the original equations to get a single equation: $$\frac{d x (t)}{d t} = \frac{\operatorname{e} ^{\Bigl(W \Bigl(-\frac{x (t)}{c}\Bigr) + \operatorname{log} (c)\Bigr)} - x (t)}{\operatorname{e} ^{\Bigl(W \Bigl(-\frac{x (t)}{c}\Bigr) + \operatorname{ln} (c)\Bigr)} + x (t)}$$ $x(0)=0$. Maple finds two solutions for this

The one that seems to work for real $c > 0$ is: $$x(t) = -\left(W_{-1} \left(\frac{-(-t + 2 c) \operatorname{e} ^{-2}}{c}\right) + 2\right) \operatorname{e} ^{\Biggl(tW_{-1} \Biggl(\frac{-(-t + 2 c) \operatorname{e} ^{-2}}{c}\Biggr) + 2\Biggr)} c$$

• The $t$ in the exponent is likely a typo. – Emil Jeřábek Jun 13 '11 at 18:23
• Yes, LambertW from Maple shortened to W for this, but the t was missed. – Gerald Edgar Jun 14 '11 at 12:20

I think it might be easier the other way round: solve $dx(y)/dy=x(y)/y-1$, $x(c)=0$ to get $x(y)=(\log c-\log y)y$. Then we are left with $$\frac{dy(t)}{dt}=-\frac1{\log c+1-\log y(t)}=\frac1{\log(y(t)/ec)}.$$ This is solved by $y(t)=\frac{t+d}{W((t+d)/ce^2)}$. Plugging in $y(0)=c$ gives $d=-2c$ for the lower branch of $W$, hence, barring mistakes, \begin{align} y(t)&=\frac{t-2c}{W_{-1}\left(\frac{t-2c}{ce^2}\right)},\\\\\\\\ x(t)&=2(c-y(t))-t, \end{align} for $-c(e-2)< t< 2c$. Note that $\lim_{t\to2c-}(x(t),y(t))=(0,0)$ and $\lim_{t\to(2-e)c+}(x(t),y(t))=(-ce,ce)$.

• From this we get $$\operatorname{e} ^{\Biggl(W_{-1} \Biggl(\frac{-(-t + 2 c) \operatorname{e} ^{-2}}{c}\Biggr) + 2\Biggr)} c$$ which seems to agree with my solution below $t=1$. Maybe we have different branches above $t=1$ or something. – Gerald Edgar Jun 13 '11 at 15:09
• Actually the place where the two solutions differ is where $x$ switches from increasing to decreasing. My version of $y(t)$ has a corner there, yours doesn't. So perhaps I should switch to a different branch of $W$ there. – Gerald Edgar Jun 13 '11 at 15:17

$$dx/dy=x/y-1.$$ From this, you find $$\frac{d}{dy}(\frac{x}{y})=-\frac{1}{y}.$$

• I understand what you did. I wonder if there is a way to solve for x and y explicity in terms of t. – Martin Erickson Jun 13 '11 at 13:35