Math FoundationsEquationsQuadratic Equations

Quadratic formula

A clear derivation of the quadratic formula with a detailed explanation of every step. Learn what the discriminant is, where it comes from, and how it tells you how many roots a quadratic equation has.
Key elements:
Connections:
The quadratic formula is derived by completing the square, so you really need to know how that works!
Statistics:
Term2
Statement1
Important2
Problem14
Every time you solve a quadratic equation, doing a little puzzle with completing the square gets annoying. It would be nice to have one universal algorithm that works for literally any quadratic equation. Like: just plug numbers into a formula and get the answer.
Turns out, that formula exists! Deriving it is not that hard, although for many students the process (and understanding it) is a real struggle. You just complete the square not in one specific equation with concrete numbers, but in a quadratic equation in the general form, with letters as coefficients!
But let's start from a distance so you see how and why formulas like this get derived in the first place.

“General root formulas”

What does a “general formula for the roots” even mean, and how do you derive one? Let's look at a simple example of a general equation (meaning it has letters instead of specific numbers):
2x+A=02x + A = 0
We need to solve it, but A can be any number! What do we do? We just treat A like a number and do the usual operations. Here, by the same action rule, we subtract A from both sides to get rid of it on the left and obtain a general solution formula:
2x+AA=0A2x=A2x + \cancel{A} - \cancel{\brand{A}} = 0 - \brand{A} \\ 2x = -A
Now, by the same action rule, we divide both sides by 2 so that x is left alone on the left:
2x2=A2x=A2\frac{\cancel{2}x}{\cancel{\brand{2}}} = \frac{-A}{\brand{2}} \\ \boxed{x = -\frac{A}{2}}
We got a general root formula for every equation of the form 2x + A = 0! No matter what number hides behind A, we can plug it in and instantly get the solution.
A=32x+3=0x=32A = 3 \\ 2x + 3 = 0 \\ x = \boxed{-\frac{3}{2}}
A=02x+0=0x=02=0 A = 0 \\ 2x + 0 = 0 \\ x = -\frac{0}{2} = \boxed{0}
A=82x8=0x=82=4 A = -8 \\ 2x - 8 = 0 \\ x = -\frac{-8}{2} = \boxed{4}

General root formulas

General formulas for solutions (roots) let you basically not solve the equation step by step. You just substitute the coefficients and get the roots directly! This is especially useful for harder equations like quadratics, where the usual method takes a whole chain of steps.
The general formula for linear equations was derived the same way. Here are a few more examples with different numbers of coefficients:

Examples: deriving general formulas

👀
Example
Derive a general solution formula for the equation.
Tx=8\frac{T}{x} = 8
Find the solutions for T = 1, 8, 3.
Now that you get the main idea (and the usefulness) of such “general” formulas, let's derive a general formula for the roots of any quadratic equation — one that does not depend on specific coefficient values.

Completing the square

It all starts by writing the quadratic equation in the general (standard) form:
Ax2+Bx+C=0,A0Ax^2 + Bx + C = 0, \quad A \neq 0
Completing the square with the coefficient A still in front is impossible! We don't know whether A is positive or negative (what if it's –10?), so taking a square root is not an option. So let's get rid of it: by the same action rule, divide both sides by A. We're allowed to do that because by definition A0A \neq 0 — otherwise it wouldn't be a quadratic equation.
Ax2+Bx+CA=0AAx2A+BAx+CA=0x2+BAx+CA=0\frac{Ax^2 + Bx + C}{A} = \frac{0}{A} \\ \frac{\cancel{A}x^2}{\cancel{A}} + \frac{B}{A}x + \frac{C}{A} = 0 \\ x^2 + \frac{B}{A}x + \frac{C}{A} = 0
By the same action rule, subtract the “constant term” (the one without x) from both sides. It's just ballast — it will only get in the way when we try to complete the square on the left:
x2+BAx+CACA=0CAx2+BAx=CAx^2 + \frac{B}{A}x + \cancel{\frac{C}{A}} - \cancel{\brand{\frac{C}{A}}} = 0 - \brand{\frac{C}{A}} \\ x^2 + \frac{B}{A}x = -\frac{C}{A}
On the left we now have two terms with a + sign. That means we can pack it into a square of a sum using a2+2ab+b2=(a+b)2a^2 + 2ab + b^2 = (a + b)^2. But we're missing some pieces! There is no 2 in the middle term, and there is no third term playing the role of b2b^2. So we'll add what we need and immediately compensate for it, to keep the equality true. Let's start by adding and compensating the 2:
x2+2xBA12=CAx2+2xB2A=CAx^2 + \yellow{2} \cdot x \frac{B}{A} \cdot \yellow{\frac{1}{2}} = -\frac{C}{A} \\ x^2 + 2 \cdot x \cdot \frac{B}{2A} = -\frac{C}{A}
The fraction B2A\frac{B}{2A} naturally becomes b, because a is already played by x. To complete the square, we only need to add and compensate b2b^2:
x2+2xB2A+(B2A)2a2+2ab+b2=(a+b)2(B2A)2=CA(x+B2A)2(B2A)2=CA\underbrace{x^2 + 2 \cdot x \cdot \frac{B}{2A} + \yellow{\left( \frac{B}{2A} \right)^2}}_{\small a^2 + 2ab + b^2 = (a+b)^2} - \yellow{\left( \frac{B}{2A} \right)^2} = -\frac{C}{A} \\ \left( x + \frac{B}{2A} \right)^2 - \left( \frac{B}{2A} \right)^2 = -\frac{C}{A}
Keep the perfect square on the left and move the extra “tail” to the right:
(x+B2A)2(B2A)2+(B2A)2=CA+(B2A)2(x+B2A)2=CA+(B2A)2(x+B2A)2=B24AC4A2\left( x + \frac{B}{2A} \right)^2 - \cancel{\left( \frac{B}{2A} \right)^2} + \cancel{\brand{\left( \frac{B}{2A} \right)^2}} = -\frac{C}{A} + \brand{\left( \frac{B}{2A} \right)^2} \\ \left( x + \frac{B}{2A} \right)^2 = -\frac{C}{A} + \left( \frac{B}{2A} \right)^2 \\ \left( x + \frac{B}{2A} \right)^2 = \frac{B^2 - 4AC}{4A^2}
We successfully completed the square in a quadratic equation in general form! The hardest part is behind us.

The discriminant

Take a close look at what we have now:
(x+B2A)2=B24AC4A2\left( x + \frac{B}{2A} \right)^2 = \frac{B^2 - 4AC}{4A^2}
The whole left side is a square, so it is 100% non-negative. If the left side is non-negative, then the right side must also be non-negative. Otherwise there are no solutions at all, because you would get a fake equality like “non-negative = negative”.
(x+B2A)20=(B24AC4A2)0\underbrace{\left( x + \frac{B}{2A} \right)^2}_{\small \green{\geq 0}} = \underbrace{\left(\frac{B^2 - 4AC}{4A^2}\right)}_{\small \green{\geq 0}}
On the right, the denominator is 4 times a square, so the whole denominator is also 100% positive (it can't be zero, because you can't divide by zero). So the only thing that decides the sign of the right-hand side — and therefore whether solutions exist — is the numerator B24ACB^2 - 4AC.
(x+B2A)20=B24ACWhich sign?4A2>0\underbrace{\green{\left( x + \frac{B}{2A} \right)^2}}_{\small \geq 0} = \frac{\overbrace{\red{B^2 - 4AC}}^{\small \text{Which sign?}}}{\underbrace{\green{4A^2}}_{\small > 0}} \\
This numerator plays a decisive role in solving a quadratic equation. That's why it's called the discriminant — a number that “distinguishes” the cases. In cases of discrimination based on certain traits (such as skin color or language), people's rights are violated. Similarly, the discriminant, depending on its sign, determines whether a quadratic equation will have roots or not.

Discriminant

The number D, computed from the coefficients of a quadratic equation in the general form Ax2+Bx+C=0Ax^2 + Bx + C = 0 by the formula:
D=B24ACD = B^2 - 4AC
From the discriminant you can tell in advance (without fully solving the equation) whether it has roots. If the discriminant is negative D < 0, then the equation has no roots.
The discriminant is used directly in the quadratic formula.

The roots of a quadratic equation

Let's continue deriving the general formula for the roots of a quadratic equation. Assume the discriminant D is non-negative (zero or positive), because otherwise there are definitely no roots. Replace the numerator in our equation with the accepted discriminant notation:
(x+B2A)2=D4A2\left( x + \frac{B}{2A} \right)^2 = \frac{D}{4A^2}
Since we know for sure that both sides are non-negative, we can take the square root of both sides. In other words, if “something” squared on the left equals the fraction on the right, then the original expression equals the square root of the right-hand side (with a plus or minus sign):
x+B2A=±D4A2x+B2A=±D2Ax + \frac{B}{2A} = \pm \sqrt{\frac{D}{4A^2}} \\ x + \frac{B}{2A} = \pm \frac{\sqrt{D}}{2A}
We're almost there. We just need to get rid of the fraction next to x:
x=B2A±D2Ax = -\frac{B}{2A} \pm \frac{\sqrt{D}}{2A}
Put the right-hand side over a common denominator:
x=B±D2A\boxed{x = \frac{-B \pm \sqrt{D}}{2A}}
Yes! Time to pop the champagne. We derived the general formula for the roots of any quadratic equation. Just substitute real numbers for the coefficients and you immediately get the roots. Notice that if the discriminant is zero, there is only one root, because it “kills” the ± part of the formula:
x=B±02A=B2Ax = \frac{-B \pm \sqrt{0}}{2A} = \boxed{\frac{-B}{2A}}

The quadratic formula

For any quadratic equation in the general form:
Ax2+Bx+C=0,A0Ax^2 + Bx + C = 0, \quad A \neq 0
You can compute a special number, the discriminant D, by the formula:
D=B24ACD = B^2 - 4AC
The discriminant tells you how many roots the quadratic equation has:
  • D < 0 — the quadratic equation has no roots
  • D = 0 — the quadratic equation has one root
  • D > 0 — the quadratic equation has two distinct roots
  • The roots of the quadratic equation are found by the formula:
    x=B±D2A\boxed{x = \frac{-B \pm \sqrt{D}}{2A}}
    Make sure you understand every step of the derivation. Repeat the steps on your own. Deriving the quadratic formula is a rare case in basic math where you need both algebraic transformations and careful reasoning about what you got. Great brain workout.
    Quadratic equations show up everywhere in both basic and higher math. So once you're sure you understand every step, you should memorize the discriminant and the quadratic formula. At least so you don't have to spend a whole page re-deriving them every single time 😂
    But that's all minor stuff. Now we have a universal algorithm for solving absolutely any quadratic equation. No more guessing, no more picking terms, no more inventing steps. Just plug numbers into the formulas and get the answer. Let's try it:

    Examples: solving quadratic equations

    👀
    Example
    Solve the quadratic equation using the quadratic formula.
    x22x8=0x^2 - 2x - 8 = 0

    Higher powers

    We derived a general formula for quadratic roots. What if we aim higher? There are cubic equations, where x is already to the third power. Can we study them in a similar way and learn how to solve them? Sure. A cubic equation can be written in the general form:
    Ax3+Bx2+Cx+D=0,A0Ax^3 + Bx^2 + Cx + D = 0, \quad A \neq 0
    Such equations can have up to three different roots. If you work really hard with formulas and transformations, you can even derive a general root formula for cubic equations, known as “Cardano's formula” (Gerolamo Cardano). Although the method was actually invented by the mathematician Niccolo Tartaglia, who shared it with Cardano under an oath of secrecy. Cardano broke the oath, published the formula under his own name, and a loud scandal followed. Either way, you will probably never want to compute with it by hand:
    x=Q2+(Q2)2+(P3)33+Q2(Q2)2+(P3)33B3Ax = \sqrt[3]{-\frac{Q}{2} + \sqrt{\left(\frac{Q}{2}\right)^2 + \left(\frac{P}{3}\right)^3}} + \sqrt[3]{-\frac{Q}{2} - \sqrt{\left(\frac{Q}{2}\right)^2 + \left(\frac{P}{3}\right)^3}} - \frac{B}{3A}
    Fourth-degree equations can also be solved in general form. You have to follow a specific algorithm with the trendy name “Ferrari's method” (Lodovico Ferrari), who was, by the way, a student of Cardano. It's even less pleasant than Cardano's formula.

    Biquadratic equations

    Let's look at a special type of “higher-degree” equation that you can solve without horrible scary formulas. They reduce to quadratics in a very straightforward way. This is not the only type like that, but it's one of the simplest and most common.

    Biquadratic equation

    A special type of fourth-degree equation that can be written in the general form:
    Ax4+Bx2+C=0,A0Ax^4 + Bx^2 + C = 0, \quad A \neq 0
    Examples:
    x4+16x2+55=0x^4 + 16x^2 + 55 = 0
    12y23y4=1 \frac{1}{2}y^2 - \sqrt{3}y^4 = 1
    5=z(z323z) 5 = z(z^3 - 2\sqrt{3}z)
    Such equations can have up to four roots, and they are very easy to solve by reducing them to a quadratic via the substitution t=x2t = x^2:
    At2+Bt+C=0At^2 + Bt + C = 0
    It's called biquadratic because “bi” means “two”. Like bisexual people who are attracted to two sexes: men and women. A biquadratic equation is basically quadratic twice. A quadratic has x2x^2 and x1x^1. In a biquadratic, the exponents get doubled and become x4x^4 and x2x^2. Let's solve a few.

    Examples: solving biquadratic equations

    😀
    Elementary
    Solve the biquadratic equation:
    2x43x2+1=02x^4 - 3x^2 + 1 = 0

    To infinity and beyond?

    Since things are going so well, can we find general root formulas for equations of any degree? Surprisingly, no! Fourth-degree equations are the absolute maximum for which universal methods exist.

    No general formulas above degree 4

    The Abel-Ruffini theorem proves that for equations of degree 5 and higher there is no general root formula. No more universal “Cardano formulas” or “Ferrari methods”. Of course the roots still exist — you can approximate them using numerical methods — but a general “substitute — get the answer” formula does not exist.
    Quadratic formula