Solve $x\frac{dy}{dx}=x-y$ using the integrating factor method and by using the substitution $y=vx$

I have been asked to show that the solutions to this equation are identical regardless of the method used. I did both methods and I think I may have got it right but I am not sure. Please check:

Using the integrating factor method I found that the factor was $x$. Therefore $\frac{d}{dx}(xy)=x$ so the result was $y=\frac12 x+\frac cx$

Using the substitution $y=vx$ enabled me to get the separable equation: $x\frac{dy}{dv}+2v=1$ I then solved to give: $\frac1{\sqrt{1-2v}}=Ax$ where $A=e^c$. Rearranging to try and get the form of the answer that I got using the other method gave me: $y=\frac12x-\frac{1}{2A^2x}$. It looks similar to my last answer and would be the same if it is permissible to simply say that $c=-\frac{1}{2A^2}$. Is this allowed or have I done something wrong?

• they are equivalent. – abel Mar 19 '15 at 0:23
• So I have done it right? – RobChem Mar 19 '15 at 0:23
• Yes it is allowed. – science Mar 19 '15 at 0:24
• yes. you did it right. – abel Mar 19 '15 at 0:24

i don't know if you care for another way to do this. that is a third way. but here it is. we write the differential equation as $$\frac{dy}{dx} = \frac{x-y}x$$ split this into equations $$\frac{dy}{dt} = x - y, \, \frac{dt}{dx} = \frac 1 x$$ we solve the second one and get $$x = Ce^t, \frac{dy}{dx} + y=Ce^t$$ the solution for $y$ is $$y = Be^{-t} + \frac C 2 e^t$$ now we get rid $t$ by subbing $\frac x C$ for $e^t$ and arrive at the same solution you got $$y = \frac{BC} x + \frac 1 2 x$$
$$xy'+y=x \implies (xy)'=x.$$