# Solving a first order differential equation - possibly using integrating factor?

Question Find the general solution for $$xy' - y = -x .e^{\frac{y}{x}}$$

My attempt:

The only two methods I have learnt in regards to solving First order ODE's are using an integrating factor and separation of variables. I tried to go with the first method and got:

$$y' - \frac{1}{x}y= -e^\frac{y}{x}$$

But I cannot advance from here as there is a y term in the exponential.

• set $w=\frac{y}{x}$ and calculate $w'$ – polfosol Oct 3 '16 at 11:44
• $e^{-w}dw=-\frac{dx}{x}$ and so on – polfosol Oct 3 '16 at 11:48

Let $y(x)=xr(x)$ which gives $y'(x)=r(x)+xr'(x)$:

$$xy'(x)-y(x)=-xe^{\frac{y(x)}{x}}\Longleftrightarrow x\left(r(x)+xr'(x)\right)-xr(x)=-xe^{\frac{xr(x)}{x}}\Longleftrightarrow\frac{r'(x)}{e^{r(x)}}=-\frac{1}{x}$$

Now, integrate with respect to $x$:

$$\int\frac{r'(x)}{e^{r(x)}}\space\text{d}x=\int-\frac{1}{x}\space\text{d}x$$

And use:

1. Substitute $u=r(x)$ and $\text{d}u=r'(x)\space\text{d}x$: $$\int\frac{r'(x)}{e^{r(x)}}\space\text{d}x=\int\frac{1}{e^u}\space\text{d}u=\int e^{-u}\space\text{d}u=-\frac{1}{e^u}+\text{C}=\text{C}-\frac{1}{e^{r(x)}}$$
2. $$\int-\frac{1}{x}\space\text{d}x=-\int\frac{1}{x}\space\text{d}x=\text{C}-\ln\left|x\right|$$

So, we get (set $r(x)=\frac{y(x)}{x}$ back):

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