Determine f(x), given that:
f'(x) = 2 - f(x)/x
This is so close to being a separable equation, just remove that constant of 2 on the right side.
But I did notice that both differentiation and division by x both reduce a linear term to a constant term. That motivates a substitution of f(x)=g(x)+x.
Then the given equation becomes g'(x)+1 = 2-(g(x)+x)/x
Which reduces to g'(x) = -g(x)/x.
Expressed in differential form dg/dx = -g/x
Separate into dg/g = -dx/x
Integrate each side ln(g) = ln(-x)+c
Exponentiate each side and simplify into g(x) = -k/x.
Then f(x) = x-k/x is the solution.
Verify the solution:
f'(x) = 1+k/x^2 and 2-f(x)/x = 2-(1-k/x)/x = 1+k/x^2.