# Differential equation - Same variable on both sides

I have the following differential equation:

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

I'm trying to solve for $$y$$, is this even possible?

I've tried doing the following:

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

$$\int (x-y) dx = \int dy$$

$$\frac{x^2}{2} -xy = y$$ (let $$C = 0$$)

Then I substitude $$x$$ for a value and solve for $$y$$.

I'm unsure whether this can be done or not since I'm treating $$y$$ as a constant when I'm integrating when in fact it isn't.

Any help is appreciated.

Note that unlike other functions you have possibly met where you can do partial differentiation, $$y=f(x)$$ is dependent on $$x$$ in this case.
Rearranging the equation, you get $$y'+y=x$$ so $$P=Q=1$$. Then $$I=\exp(\int P\,dx)$$ and use the integrating factor method to solve $$yQ=\int IQ\,dx$$.
No, you can not treat $$y$$ as a constant on the left side, as it is a function depending on $$x$$. You can rewrite the equation as $$y'(x)+y(x)=x,$$ which perhaps helps to associate the correct solution method.
Or set $$u=y-x$$, then $$u'=y'-1=x-y-1=-u-1$$, in the next iteration set $$u=y-x+1$$, then $$u'=y'-1=x-y-1=-u$$ and you should know how to solve $$u'=-u$$.