I was given the following question:
Find the values of $m$ for which the curve $y=|x^2-2x+m| + 2x + 1$ has $3$ extrema.
My teacher suggested that we should use the quadratic formula $(b^2-4ac)$ and check every case of it.
I am sure that there are three main cases of the inside of absolute value being $<0 ; =0 ; >0$.
The solution is $m<0$ but I do not know how to dig down into each case.




Note that your absolute value can be written as a piecewise function:
$$y = \begin{cases} x^2 - 2x + m + 2x + 1 = x^2 + m + 1 \\ -(x^2 - 2x + m) + 2x + 1 = 4x - x^2 -m + 1 \end{cases}$$
The domain of the piecewise function is determined by the value of $m$. I hope you understand why the piecewise function exists like such. If not, see the Absolute Value Function.
Consider, $x^2 - 2x + m > 0 \implies x^2 - 2x + m + 2x + 1 > 2x + 1, \forall x \in \mathbb{R} \iff m > 1$. Then, the absolute value would be redundant, and your function would be an ordinary +parabola; $x^2 + m + 1 \ge x^2 + 2$. Hence, there would not be $3$ extrema.
Therefore, our first condition for $3$ extrema must be that there are $2$ real solutions to the function, $-(x^2 - 2x + m) + 2x + 1$, since the $2$ of the extrema are these $2$ solutions.
Let these solutions be $x_1, x_2, x_1 \le x_2$.
$$x_1,x_2 = \dfrac{-b \pm \sqrt{b^2 - 4ac}}{2a} \\x_1 = \dfrac{-4 - \sqrt{4^2 - 4(-1)(1 - m)}}{2(-1)} = 2 - \sqrt{5 - m} \\x_2 = \dfrac{-4 + \sqrt{4^2 - 4(-1)(1 - m)}}{2(-1)} = 2 + \sqrt{5 - m}$$
We can then refine the domain to,
$$y = \begin{cases} x^2 - 2x + m + 2x + 1 = x^2 + m + 1 &x < x_1 \text{ or } x > x_2 \\ -(x^2 - 2x + m) + 2x + 1 = 4x - x^2 -m + 1 &x_1 < x < x_2 \end{cases}$$
The $3$rd extrema occurs when there exists a maxima between $x_1, x_2$. This is a maxima because the line $2x + 1$ is strictly increasing; $2x_1 + 1 < 2x_2 + 1 \text{ or } y(x_1) < y(x_2)$. Additionally, observe from above that $|x^2 - 2x + m| + 2x + 1 \ge 2x + 1$. The maxima can be calculated through the derivative:
$\big(-(x^2 - 2x + m) + 2x + 1\big)' = 0 \\4 - 2x = 0 \implies x = 2 \\\therefore 2x_2 + 1 = 2(2) + 1 = 5$
We must have $x_2 > 2, y(x_2) > 5$ (observing $2x + 1$ strictly increasing),
$$ \\\therefore 4x_2 + 1 - x_2^2 - m = 4(2) + 1 - 2^2 - m > 5 \\5 - m > 5 \\m < 0$$