How to separate variables in DiffEq of $y'=x-y$ $$\frac{dy}{dx} = x-y$$
How do I separate so I can integrate both sides?
Thanks for getting me started.
I know the solution is $$ y = x-1+2e^{-x}$$

Hint
Your equation is $$y'(x)+y(x)=x.$$
Multiply both side by $e^x$ gives $$\big(y(x)e^x\big)'=xe^x.$$
I let you conclude.
