Your general idea looks good. But you have to be careful, sometimes algebraic manipulation can alter the domain, which you have to take into account. Consider: f(x) = \frac{x^2 -1}{x-1}.
Do you know any calculus? Since the function is continuous you can just find the critical points...