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}$$
 A: Let $y=x+z$. The equation becomes
$$z'+1=-z,$$
which is separable.

$$\frac{z'}{z+1}=-1,\\\log(z+1)=C-x,\\z=Ce^{-x}-1,\\\color{green}{y=Ce^{-x}+x-1}.$$

A: 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.
A: You can't separate. If you want to make it separable you can notice the equation is homogeneous and use the substitution $vx=Y$.
Otherwise, if you know how to solve linear differential equations, turn this into $y'+y=x$. The integrating factor is just $e^x$. So we have $\frac{d}{dx}(e^x y) = xe^x$.
Integrate with respect to $x$ and you get $(x-1)e^x + C = ye^x \Rightarrow  y=x-1+Ce^{-x}$
A: $$\frac{dy}{dx}+y=x \implies e^{-x}\frac{d}{dx} y e^x=x \implies  \int d (e^{x}y)= \int  xe^{x} dx$$ $$ \implies y e^{x} =- e^x+xe^x + C \implies y=(x-1)+Ce^{-x}.$$
A: $$\frac{dy}{dx}+y = x$$
Solve the homogeneous equation
$$y'+y=0 \implies (\ln y)'=-1 \implies y=c_1e^{-x}$$
For the particular solution try
$$y_p=Ax+B$$
You forgot to write the initial condition. That's why you don't have a constant $c_1$ in the solution you provided.
A: this is LDE
let me explain how to solve this
first of all you have to compare the given DE with LDE
$ {dy} / {dx} + P(x) y = Q(x) $
solving process
INTEGRAL FACTOR (I.F)= $e^{∫ P(x)dx} $
the solution is
$ y I.F = ∫{Q(x)} I.F dx +c $
now we have from given
DE
${dy}/{dx} +y=x $
$P(x) = 1 , Q(x) = x$
I.F = $ e^{∫{1} dx} = e^{x} $
the general solution is
$ y  e^{x} = ∫ { x e^{x}} dx +c $
$y e^{x} = e^{x} [ x -1] + c $
$ y = x-1+ce^{-x} $
A: Hint:
differentiate the equation to get
$$y''=1-y'$$
$$\frac{y''}{y'-1}=-1$$
