Answer
$y = x-1+C~e^{-x}$
Work Step by Step
A first-order linear differential equation is one that can be put into the form:
$\frac{dy}{dx} + P(x)~y = Q(x)$
We can consider the given equation:
$y' = x-y$
$y' +y = x$
Let $P(x) = 1$
Let $Q(x) = x$
We can find the integrating factor:
$I(x) = e^{\int 1 ~dx} = e^x$
We can multiply by the integrating factor:
$e^x~y'+e^x~y = xe^x$
$\frac{d}{dx}(e^x~y) = xe^x$
We can integrate both sides of the equation:
$e^x~y = \int xe^x~dx$
$e^x~y = xe^x-\int 1 \cdot e^x~dx$
$e^x~y = xe^x- e^x+C$
$y = x-1+C~e^{-x}$