Our math teacher told us that for rational functions (where the maximum power of x involved is 2) , we assume it equals to some variable $\lambda$ and create a quadratic in x. An example is $ y = \frac{x^2+2x+2}{x^2+x+1}$
So, $ \lambda = \frac{x^2+2x+2}{x^2+x+1}$
Rearranging we have $ x^2(1-\lambda) + x(2-\lambda) + (2-\lambda) =0$ And now apparently at the maximum and minimum values of $\lambda$ the discriminant of this quadratic equation is 0 which we use to find the range of this rational function. I do not understand why this is the case? Can we prove this?