<s>[INST] Find Minima and Maxima of $ y = \frac{x^2-3x+2}{x^2+2x+1}$ $$ y = \frac{x^2-3x+2}{x^2+2x+1}$$
I guess I made some mistakes cause after taking the first derivative and simlifying I have
$$y = \frac{2x^3-4x^2+5}{(x+1)^2}$$
but then numerator has complex roots. which should not be, IMO
 [/INST] Let's derive 
$$y'={(2x-3)(x^2+2x+1)-(2x+2)(x^2-3x+2)\over (x^2+2x+1)^2}={5x^2-2x-7\over (x+1)^4}={5x-7\over (x+1)^3}$$
</s>