What two numbers multiply to give , and add up to give ?
Take a second. Actually try it... and work: , and .
If you got there, congratulations. You just solved a quadratic equation without ever writing "the quadratic formula."
Every quadratic equation asks one question: for what values of does hit zero? There are three classic ways to answer it, factoring, completing the square, and the quadratic formula. They're not competing algorithms. They're the same idea, viewed from three angles, and each one is fastest on a different kind of equation.
We'll build all three, one at a time. By the end, you'll know exactly which one to reach for.
Method 1: Factoring, or guessing the two numbers
Take .
Factoring asks: can we rewrite the left side as for some numbers and ?
If we can, we're basically done. A product is zero only when one of its factors is zero, so either or . That means or . Two guesses away from the full answer.
Multiply out and you get . Compare that to , and the pattern falls out: the roots add up to , and multiply to . For our equation, that's two numbers that add to and multiply to . That's and . So , and the roots are and .
Drag the two roots along the x-axis, the factored form and the trinomial it expands to update live.
Drag the two roots above and watch the trinomial rebuild itself. Factoring is just this process run backwards, given the trinomial, find the roots that would have produced it.
But here's the catch. Try . What two numbers multiply to and add to ? ...There aren't any nice ones. You could hunt through fractions and irrational combinations forever, but at that point you're not factoring anymore, you're guessing blindly. We need something that works even when the roots are ugly.
Method 2: Completing the square, or building a bigger square
Picture as the area of an actual square, with side length . Now we want to add more area. Split that into two thin rectangles, each wide by tall, and glue one onto the top of the square and one onto the right side.
That leaves a small gap in the corner, a square of side . Fill it in, and you've completed one big square of side .
Hit play and watch x² + bx get physically reshaped into a complete square, one tile at a time.
Hit play and watch the tiles rearrange themselves. That gap you filled has area , and that's the number we secretly added. So algebraically:
Now go back to . Half of is , and . Add to both sides:
No guessing required. Completing the square handles irrational roots just as easily as nice ones, because it never relies on spotting a pattern. It just builds the square, every time.
Method 3: The quadratic formula, or completing the square once and for all
Here's the interesting part: the quadratic formula isn't a new idea. It's Method 2, done symbolically, for any , , and , solved once so you never have to repeat the steps again.
Start from , divide through by , complete the square exactly like before, and solve for . What falls out is:
That is doing something worth noticing: it's the same "two intersection points" idea from completing the square, just written in one line. And the piece under the square root, , is called the discriminant, because it discriminates between three cases before you even finish solving:
- : two real roots
- : one repeated root (the parabola just touches zero)
- : no real roots (the parabola never crosses zero)
Slide c and watch the discriminant, b² − 4c, decide how many times the curve touches zero. Hover the curve to read any point.
Slide and watch the curve rise and fall. Right around , the two roots merge into one and then vanish entirely... the discriminant is telling you the answer before you finish the arithmetic.
Which method should you actually use?
Scrub through five equations and see which method wins, and how many algebra steps each one costs.
Integer roots (2 and 3) jump out immediately.
A few rules of thumb fall straight out of everything above. Try factoring first, but only when and you can spot the two numbers in a few seconds. If nothing jumps out within a few tries, stop guessing.
Reach for completing the square when is even, it stays clean, and it's the method that shows you why the roots are what they are, not just what they are.
Use the quadratic formula whenever the other two get messy: when , when the roots look irrational, or when you're not even sure real roots exist. It always works, because it's just completing the square with the guesswork already removed.
The short version
All three methods answer the exact same question: where does equal zero? Factoring reverses multiplication, and it's fastest when the roots are friendly integers. Completing the square physically builds a square around to isolate , and it works even on ugly, irrational roots. The quadratic formula is that same square, completed once, symbolically, for any , , and , so it never fails, especially when the other two get complicated.
Same destination, three different roads. Pick the one that matches the shape of the equation in front of you.
All visualizations are interactive React components running entirely in your browser, computing every root, every discriminant, and every completed square live from the numbers you choose. No libraries beyond React.