Solve the differential equation $\frac{dy}{dx} = \frac{2x-y+2}{2x-y+3}$

Solve the differential equation $$\frac{dy}{dx} = \frac{2x-y+2}{2x-y+3}$$

Approaches I have tried:

• Using an integrating factor to make it an exact equation. I couldn't find a suitable integrating factor though.
• Shift: put $x = X+a$, $y = Y+b$ and rearrange. This wasn't helpful either as I couldn't get it in a form that I could solve.
• Substitution: put $v = 2x-y$. Then $\frac{dv}{dv} = 2 - \frac{dy}{dx}$. After rearranging and solving using separation of variables, I got $v - ln(v+4) = x + c$, where $c$ is a constant. I didn't know how to find $y(x)$ from here.
• Your last approach is about as good as it gets. Are you familiar with the Lambert $W$ function? – Amzoti Nov 7 '14 at 5:08
• I haven't seen that before. Thanks! – user190570 Nov 7 '14 at 5:10
• Unless you have been specifically required to do so, there is no need to find an explicit formula for $y$ in terms of $x$. Your last formula gives the implicit solution $2x-y-\ln(2x-y+4)=x+c$. – David Nov 7 '14 at 5:11
• $$y = 2x - z\ \Longrightarrow\ 2 - z'={z + 2 \over z + 3}$$ – Felix Marin Nov 7 '14 at 5:47

Hint:

$\dfrac{dy}{dx} = \dfrac{2x-y+2}{2x-y+3}=1-\dfrac{1}{2x-y+3}$

$2x-y+3=z \implies 2-\dfrac{dy}{dx}=\dfrac{dz}{dx} \implies 2-\dfrac{dz}{dx}=\dfrac{dy}{dx}$

$\therefore 2-\dfrac{dz}{dx} = 1-\dfrac{1}{z} \implies \dfrac{dz}{dx}=1+\dfrac{1}{z}$

I should mention that you can also solve an equation of the form,

$$\dfrac{dy}{dx}=F\left(\dfrac{a_1x+b_1y+c_1}{a_2x+b_2y+c_2}\right)$$

For this let $a_1x+b_1y+c_1=U$ and $a_2x+b_2y+c_2=V$

$a_2x+b_2y+c_2=V \implies a_2+b_2\dfrac{dy}{dx}=\dfrac{dV}{dx} > \implies \dfrac{dy}{dx}= > \dfrac{1}{b_2}\left(\dfrac{dV}{dx}-a_2\right)$

Similarly, $\dfrac{dy}{dx}= > \dfrac{1}{b_1}\left(\dfrac{dU}{dx}-a_1\right)$

$\therefore > \dfrac{dy}{dx}=F\left(\dfrac{a_1x+b_1y+c_1}{a_2x+b_2y+c_2}\right)\\ > \implies \dfrac{dU}{dx}=a_1+b_1F\left(\dfrac{U}{V}\right)\\ > \implies\left(\dfrac{dU}{dV}\right)\left(\dfrac{dV}{dx}\right)=a_1+b_1F\left(\dfrac{U}{V}\right)\\ > \implies\dfrac{dU}{dV}=\left(\dfrac{a_1+b_1F\left(\dfrac{U}{V}\right)}{a_2+b_2F\left(\dfrac{U}{V}\right)}\right)$

Which can be simplified further by the substitution $U=VT$.

How to find the integrating factor, shown in full details : $$(2x-y+2)dx-(2x-y+3)dy=0$$ Let $F(x,y)$ be the integrating factor, so that we obtain the exact differential of a function $dU(x,y)=\frac{\partial U}{\partial x}dx+\frac{\partial U}{\partial y}dy$ $$\big((2x-y+2)F(x,y)\big)dx+\big(-(2x-y+3)F(x,y)\big)dy=0$$ $$\frac{\partial U}{\partial x}=(2x-y+2)F(x,y)$$ $$\frac{\partial U}{\partial y}=-(2x-y+3)F(x,y)$$ $$\frac{\partial^2 U}{\partial x \partial y}=\frac{\partial^2 U}{\partial y \partial x}= \frac{\partial (2x-y+2)F}{\partial y}=\frac{\partial (-2x+y-3)F}{\partial x}$$ $$-F+(2x-y+2)\frac{\partial F}{\partial y}=-2F+(-2x+y-3)\frac{\partial F}{\partial x}$$ Only one solution of this PDE is sufficient for our purpose. So, we search a solution on the form $F(x,y)=g(x)h(y)$ $$(2x-y+2)g h'=-g h+(-2x+y-3)g'h$$ $$(2x-y+2)\frac{h'}{h}=-1+(-2x+y-3)\frac{g'}{g}$$ Separating the terms functions of $x$ from those function of $y$ leads to an obvious result : $$\frac{h'}{h}=-\frac{g'}{g}=1$$ Hense $h=e^y$ and $g=e^{-x}$ , then $F=gh=e^{y-x}$

An integrating factor is $e^{y-x}$ $$dU=(2x-y+2)e^{y-x}dx-(2x-y+3)e^{y-x}dy=0$$ The integration leads to : $$(2x-y+4)e^{y-x}+C=0$$ This implicite equation is the solution of the ODE. We can express $y(x)$ thanks to a special function : $$(y-2x-4)e^{(y-2x-4)}=C e^{-x-4}=c e^{-x}$$ $$(y-2x-4)=W\big(c e^{-x} \big)$$ $W(X)$ is the Lambert W function, where $X=c e^{-x}$ $$y=2x+4+W\big(c e^{-x} \big)$$