I'm struggling to derive the quadratic equation using the principal root $(\sqrt{x^2} = |x|).$
Taking $ax^2 + bx + c = 0$ and solving for $x$, I got $$\left(x+\frac{b}{2a}\right)^2 = \frac{b^2-4ac}{4a^2}.$$
Taking the principal root both sides gave me $$\left|x+\frac{b}{2a}\right| = \frac{\sqrt{b^2-4ac}}{\sqrt{4a^2}}\\x+\frac{b}{2a} = \frac{±\sqrt{b^2-4ac}}{2|a|}.$$
And there's where I struggle. While for $a \geq 0, |a|=a,$ and it goes just well.
But that's not true if $a<0$, I can´t get it right with $a<0.$
Edit : Changed a typing error into the expression of the discriminant
When $a<0,\;|a|=-a\;$ (for example, $|-7|=-(-7)$).
In this case, equation $(1)$ becomes \begin{align}x+\frac{b}{2a} &= \frac{±\sqrt{b^2-4ac}}{-2a}\\x&=\frac{b\pm\sqrt{b^2-4ac}}{-2a}\\&=\frac{-b\mp\sqrt{b^2-4ac}}{2a}\\&=\frac{-b\pm\sqrt{b^2-4ac}}{2a},\end{align} as required.