The quadratic formula $x = \frac{-b \pm \sqrt{b^2 -4ac}}{2a}$ is a thing of beauty, but how is it derived? Well, it requires quite a few steps and some understanding of a squared
binomial which I hope I can explain. The first thing to note is the expansion of a squared binomial using alpha and beta as our terms: $$(\alpha + \beta)^2 = (\alpha +\beta)(\alpha +\beta) = \alpha ^2 +2\alpha \beta + \beta ^2 $$
Next, let's look at a
quadratic equation:
$$ax^2 + bx + c = 0$$
How do we solve for $x$ from that? We can't use our basic algebra toolkit of using arithmetical operations alone. We have to think a bit more outside the box...
Start by subtracting $c$ from both sides and factoring out an $a$ from the left side:
$$a(x^2+ \frac{b}{a}x) = -c$$
Dividing both sides by $a$:
$$x^2 + \frac{b}{a}x = \frac{-c}{a}$$
Now this is where the box starts to look a bit fuzzy (as dirty minds chuckle). Fortunately we remembered that we can do something called
completing the square. To do this we must think about how we can take what we've worked out so far and get it into the expanded version of the squared binomial form that I introduced earlier. So let's make an initial substitution:
$$\alpha^2 = x^2 \Longrightarrow \alpha = x $$
The next substitution we'll make needs a bit of prep work. Let's focus on the left side of the equation and multiply our $\frac{b}{a}x$ term by $\frac{2}{2}$ and see what we get:
$$\alpha^2 + \frac{2}{2} \cdot \frac{b}{a} \alpha \Longrightarrow \alpha^2 + 2 \left(\frac{b}{2a}\alpha \right) \Longrightarrow \alpha^2 + 2 \alpha \left(\frac{b}{2a}\right) $$
Wait a minute! This $2 \alpha \left(\frac{b}{2a}\right)$ term looks awfully similar to that aforementioned 2nd term of the expanded squared binomial, $2\alpha \beta$. In fact, our next substitution can define the value of $\beta$:
$\beta = \frac{b}{2a}$ so that must mean that $\beta^2 = \left(\frac{b}{2a}\right)^2 = \frac{b^2}{4a^2}$
Now we can add $\beta^2$ to both sides of our equation and complete the square:
$$\alpha^2 + 2\alpha \beta + \beta^2 = \frac{-c}{a}+\beta^2$$
We can "unexpand" the left side now to get:
$$(\alpha + \beta)^2 =\frac{-c}{a}+\beta^2$$
Taking the square root of both sides, being careful to note that there is a negative result and a positive one (hence the $\pm$):
$$\alpha + \beta = \pm \sqrt{\frac{-c}{a}+\beta^2}$$
This might be looking a bit confusing now so let's substitute back in our original terms now that we should have a clear idea of what we did with completing the square:
$$x+\frac{b}{2a} = \pm \sqrt{\frac{-c}{a}+ \frac{b^2}{4a^2}} \Longrightarrow x = -\frac{b}{2a} \pm \sqrt{\frac{-c}{a}+ \frac{b^2}{4a^2}}$$
Well that kind of looks like the quadratic formula but not quite...
Let's try simplifying that radical and see where that gets us. Creating a common denominator by multiplying $\frac{-c}{a}$ by $\frac{4a}{4a}$ and rearranging terms:
$$x = -\frac{b}{2a} \pm \sqrt{ \frac{4a}{4a} \cdot \frac{-c}{a}+ \frac{b^2}{4a^2}} \Longrightarrow x = -\frac{b}{2a} \pm \sqrt{ \frac{b^2}{4a^2} - \frac{4ac}{4a^2} }$$
$$x = -\frac{b}{2a} \pm \sqrt{\frac{b^2-4ac}{4a^2}}$$
The next few steps may be popping out at you. Take the $\frac{1}{4a^2}$ out of the radical and we have a common denominator which yields:
$$x = -\frac{b}{2a} \pm \frac{\sqrt{b^2-4ac}}{2a} \Longrightarrow$$
$$x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}$$
We did it! We have derived the quadratic formula $x = \frac{-b \pm \sqrt{b^2 -4ac}}{2a}$ from our quadratic equation $ax^2 + bx + c = 0$
And now it might be obvious why the quadratic formula only works when $a \ne 0$ since $\frac{something}{0}$
is undefined. Well that was fun practice for my $\LaTeX$ coding skills, thanks for following!