# How to solve $\frac{\mathrm dy}{\mathrm dx}=\frac{x+y}{x}$

I am looking for a help with the below equation

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

I don't get the suggested answer $$y = x\ln(x) + c x$$

My attempt $$\mathrm dx(1+\frac{y}{x})=\mathrm dy$$ $$c+x+y\ln(x)=y$$ $$y=\frac{c+x}{1-\ln x}$$

• Hint: Integrating Factor
– Moo
Jul 17, 2016 at 3:44
• The mistake in your derivation: Note that $y = y(x)$ is a function of $x$ so you cannot just integrate $dx\left(1+\frac{y}{x}\right)$ by holding $y$ constant (as you have done). Jul 17, 2016 at 3:58

The problem with your approach is that:

$$\int \left(1 + \frac{y}{x}\right) dx \neq C + x + y \ln x$$

Note that $y$ is a function of $x$, so you cannot treat it as a constant when you integrate.

One appropriate way to do this problem using an integrating factor:

Doing some algebra:

$$y'(x) - y(x)/x = 1$$

Let $\mu(x) = \exp(\int -\frac1x dx) = 1/x$. Multiplying both sides by $\mu$:

$$y'(x)/x - y(x)/x^2 = 1/x$$

Note that $-1/x^2$ is the derivative of $1/x$:

$$\frac{dy}{dx} \frac{1}{x} + \frac{d}{dx} \left( \frac{1}{x} \right) y(x) = \frac{1}{x}$$

Using the product rule:

$$\frac{d}{dx} (y/x) = \frac{1}{x}$$

You can finish the rest yourself.

We have:

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

Suppose $y=xv(x)$ with $v(x):\mathbb{R}\rightarrow\mathbb{R}$

Then $$\frac{dy}{dx}=v+x\frac{dv}{dx}=1+v$$

Now notice we have:

$$x\frac{dv}{dx}=1$$ which is separable.

$$v(x)=\ln(x)+C,$$ where $C\in \mathbb{R}$

Thus $$y=x\ln(x)+Cx$$

Hint: $$\frac{dy}{dx}=\frac{x+y}{x}\implies xdy=(x+y)dx\implies xdy-ydx=xdx\implies\frac{xdy-ydx}{x^2}=\frac{dx}{x}$$

With $\mu(x)=e^{\int\frac{M_y-N_x}{N}dx}$, where $M=x$ and $N=-x-y$ then $\mu(x)=\frac{1}{x^2}$, Now we have: $\frac{1}{x^2}(xdy+(-x-ydx))=\frac{1}{x^2}*0\Rightarrow \frac{1}{x}dy+(-\frac{1}{x}-\frac{y}{x^2})dx=0$, we take $f_y=\frac{1}{x}\Rightarrow f=\frac{y}{x}+h(x)$, after $f_x=-\frac{y}{x^2}+h'(x)=-\frac{1}{x}-\frac{y}{x^2}\Rightarrow h'(x)=-\frac{1}{x}$ then $h(x)=-\ln x$. The solution is $\frac{y}{x}-\ln x=c$ where $c$ is constant

Just another way to do it.

Considering $$\frac{dy}{dx}=\frac{x+y}{x}$$ define $y=z-x$ which leads to $$\frac{dz}{dx}-1=\frac{z}{x}$$ that is to say $$\frac{dz}{dx}-\frac{z}{x}=1$$ Solving the homogeneous equation leads to $z=C x$. Now, using the method of variation of parameters, this leads to $$C+x C'-C=1$$ that is to say $xC'=1$ then $C=\log(x)+K$ then $z=x(\log(x)+K)$ and finally $y=x(\log(x)+K)-x=x \log(x)+(K-1)x=x \log(x)+ Lx$.

## Hint

$$xy'=x+y$$ $$xy'-y=x$$ This is Euler-Cauchy Equation,see