$$ 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
$$ 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
Well, you can use five rules:
So, using the quotient rule:
$$\text{y}'\left(x\right)=\frac{\left(x^2+2x+1\right)\cdot\frac{\text{d}}{\text{d}x}\left(x^2-3x+2\right)-\left(x^2-3x+2\right)\cdot\frac{\text{d}}{\text{d}x}\left(x^2+2x+1\right)}{\left(x^2+2x+1\right)^2}\tag3$$
Now, we can use the second rule to get:
So, we end up with:
$$\text{y}'\left(x\right)=\frac{5x-7}{\left(1+x\right)^3}=0\space\Longleftrightarrow\space x=\frac{7}{5}\tag6$$
Hint. Write it as:
$$ y = \frac{x^2+2x+1-5(x+1)+6}{(x+1)^2}=1 -\frac{5}{x+1}+\frac{6}{(x+1)^2}$$
The latter is a quadratic in $w=\frac{1}{x+1}\,$ with easy to determine extrema: $\;y=1-5w+6w^2\,$.
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}$$
The derivative is not correct, unfortunately.
Given that $x^2+2x+1 = (x+1)^2$, observe that if we let $g(x) = (x+1)^2$ and $f(x) = x^2-3x+2$ we have $$\begin{align}{dy\over dx} &= {g(x)f'(x) - f(x)g'(x) \over g^2(x)}\\ &= {(x+1)^2(2x-3) - (x^2-3x+2)2(x+1) \over (x+1)^4}\\ &= {(x+1)(2x-3)-2(x^2-3x+2) \over(x+1)^3}\\&= {2x^2-3x+2x-3 -2x^2+6x-4\over(x+1)^3}\\ &= {5x - 7\over(x+1)^3}. \end{align}$$
Now we set the numerator and the denominator equal to $0$ to find the points of the function where we have global maxima and global minima.
It is immediate to see that there is some mistake in the derivative. In the numerator we must have a term $2x^3$ by the product of the derivative of the numerator by the denominator and an opposite term $-2x^3$ from the product of the numerator by the derivative of the denominator. So we cannot have a third degree term.
$$y = \frac{x^2 - 3x + 2}{x^2 + 2x + 1} = 1 - \frac{5x-1}{(x+1)^2}$$ \begin{align*} \frac{dy}{dx} &= \frac{d}{dx} \left[ \frac{1-5x}{(x+1)^2} \right] \\ &= \frac{-5\cdot(x+1)^2-(1-5x)\cdot 2(x+1)}{(x+1)^4} \\ &= \frac{-5\cdot(x+1)-2(1-5x)}{(x+1)^3} \\ &= \frac{-5x-5-2+10x}{(x+1)^3} \\ &= \frac{5x-7}{(x+1)^3} \end{align*}
$$\frac{dy}{dx} = 0 \Longleftrightarrow x=\frac{7}{5} $$