How do I solve the differential equation: $\frac{dy}{dx} = \frac{x+y}{x-y}$? [closed]

$$\frac{dy}{dx} = \frac{x+y}{x-y}$$

Well, we have that:

$$\text{y}'\left(x\right)=\frac{x+\text{y}\left(x\right)}{x-\text{y}\left(x\right)}\tag1$$

Let $x\cdot\text{r}\left(x\right)=\text{y}\left(x\right)$:

$$x\cdot\text{r}'\left(x\right)+\text{r}\left(x\right)=\frac{x+x\cdot\text{r}\left(x\right)}{x-x\cdot\text{r}\left(x\right)}\space\Longleftrightarrow\space\int-\frac{\text{r}'\left(x\right)\cdot\left(\text{r}\left(x\right)-1\right)}{1+\text{r}\left(x\right)^2}\space\text{d}x=\int\frac{1}{x}\space\text{d}x\tag2$$

Now, use:

• For the LHS, substitute $\text{u}=\text{r}\left(x\right)$: $$\int-\frac{\text{r}'\left(x\right)\cdot\left(\text{r}\left(x\right)-1\right)}{1+\text{r}\left(x\right)^2}\space\text{d}x=\int\frac{1-\text{u}}{1+\text{u}^2}\space\text{d}\text{u}=\arctan\left(\text{u}\right)-\frac{\ln\left|1+\text{u}^2\right|}{2}+\text{C}_1\tag3$$
• For the RHS: $$\int\frac{1}{x}\space\text{d}x=\ln\left|x\right|+\text{C}_2\tag4$$

So, we get:

$$\arctan\left(\text{r}\left(x\right)\right)-\frac{\ln\left|1+\text{r}\left(x\right)^2\right|}{2}=\ln\left|x\right|+\text{C}\tag5$$

Now, set $x\cdot\text{r}\left(x\right)=\text{y}\left(x\right)$ back:

$$\arctan\left(\frac{\text{y}\left(x\right)}{x}\right)-\frac{\ln\left|1+\left(\frac{\text{y}\left(x\right)}{x}\right)^2\right|}{2}=\ln\left|x\right|+\text{C}\tag6$$

Simplify a bit:

$$2\arctan\left(\frac{\text{y}\left(x\right)}{x}\right)=\ln\left(x^2+\text{y}\left(x\right)^2\right)+\text{C}\tag7$$

• Your answer made me notice that I had initially left out a factor of $u$, +1 Commented Mar 12, 2017 at 15:29
• @mrnovice I was commenting on your answer about that and I saw your edit so I stopped typing, good job +1!! Commented Mar 12, 2017 at 15:31
• @Dr.MV Thank you very much! Commented Mar 12, 2017 at 17:59

This is a dimensionally homogenous ODE.

Let $u = \frac{y}{x}$

Then we have $\frac{du}{dx} = \frac{x\frac{dy}{dx} - y}{x^{2}}$

So $\frac{du}{dx} = \frac{\frac{dy}{dx} - u}{x}$

$\frac{dy}{dx} = x\frac{du}{dx} + u$

Substituting this in:

$x\frac{du}{dx} + u = \frac{x + ux}{x-ux}$

$x\frac{du}{dx} + u = \frac{1+u}{1-u}$

$x\frac{du}{dx} = \frac{1+u - u + u^{2}}{1-u}$

$x\frac{du}{dx} = \frac{u^{2} + 1}{1-u}$

$\int \frac{1-u}{u^{2}+1}du = \int \frac{1}{x} dx$

Can you solve from here?