<s>[INST] How to derive this factorization $ax^2 + bx + c = a(x − x_1)(x − x_2) $? I faced this factorization formula $$ax^2 + bx + c = a(x − x_1)(x − x_2)$$ where $x_1$ is the first solution and $x_2$ is the second one. But I don't understand how the formula gets derived... Could anybody explain it to me? Thanks!
I know I can solve a quadratic equation and substitute the solutions into this formula $a(x − x_1)(x − x_2)$, but I want to understand how it works.
 [/INST] You can also complete the square. Assuming $a \neq 0$ (necessary to be a quadratic):
\begin{align*}
ax^2 + bx + c &= a\left(x^2 + \frac{b}{a}x + \frac{c}{a}\right) \\
&= a\left(x^2 + \frac{b}{a}x + \frac{b^2}{4a^2} + \frac{c}{a} - \frac{b^2}{4a^2}\right) \\
&= a\left(\left(x + \frac{b}{2a}\right)^2 - \frac{b^2 - 4ac}{4a^2}\right).
\end{align*}
Then, using a difference of two squares factorisation,
$$ax^2 + bx + c = a\left(x + \frac{b}{2a} + \frac{\sqrt{b^2 - 4ac}}{2a}\right)\left(x + \frac{b}{2a} - \frac{\sqrt{b^2 - 4ac}}{2a}\right),$$
as requested.
</s>