y' + (1/x - 1)y = -2/x
subtract the second expression from both sides of the equation
y' = -(1/x - 1)y - 2/x
y' and dy/dx are synonymous
dy/dx = -(1/x - 1)y - 2/x
Integrate the first & second expression individually.
dy/dx = -(1/x - 1)y
dy/y = -(1/x - 1)dx
Integrate both sides
ln y = -ln x + x + c
since both sides are equal, use both sides of the equations as exponents with a base e
e^(ln y) = e^(-ln x + x + c)
y = (ce^x)/x
Second part:
dy/dx = -2/x
dy = (-2/x)dx
y = -2ln x + c
Complete equation
y = (c/x)e^x - 2ln x + Constant