Algebra
How To Solve A Quadratic Equation
Every quadratic equation has a closed-form solution. The discriminant tells you what kind of answer to expect before you compute anything, which is the part people skip.
Quick Answer
x = (-b +/- sqrt(b^2 - 4ac)) / (2a)
- a
- Coefficient of x^2 — must not be zero
- b
- Coefficient of x
- c
- Constant term
- D = b^2 - 4ac
- Discriminant — decides how many real roots exist
Compute the discriminant b^2 - 4ac first. For x^2 - 5x + 6 = 0 it is 25 - 24 = 1, and because it is positive there are two real roots: x = (5 + 1)/2 = 3 and x = (5 - 1)/2 = 2. A discriminant of exactly zero means one repeated root, and a negative one means no real roots at all — the parabola never touches the axis, and going further requires complex numbers.
What Is How To Solve A Quadratic Equation?
A quadratic equation is one that can be written as ax^2 + bx + c = 0 with a not equal to zero. That last condition is not a technicality: if a were zero the squared term would vanish and the equation would be linear, with one root instead of two and none of the machinery below applying. Checking it takes a second and prevents nonsense downstream.
The discriminant D = b^2 - 4ac deserves its reputation as the most informative quantity in the problem. Its sign tells you how many real solutions exist before any square root is taken: positive means two distinct real roots, zero means exactly one repeated root where the parabola just touches the axis, and negative means no real roots because the curve sits entirely above or below it. Its magnitude also predicts how far apart the roots lie.
Square roots explain why the two roots come in a pair. The term sqrt(D) is added to -b in one case and subtracted in the other, so the two answers sit symmetrically on either side of -b / (2a). That midpoint is the x-coordinate of the vertex, which means the vertex always lies exactly halfway between the roots whenever they exist — a fact worth using as a check on any answer you compute.
There is also a structure worth memorising because it catches sign errors immediately. With D = 1 the roots come out as 3 and 2, their sum is 5 which equals -b/a, and their product is 6 which equals c/a. Those two identities hold for every quadratic, so recomputing them from your answers is a fast check that costs nothing and detects most slips in transcription.
Factoring is quicker when it works. Rewriting x^2 - 5x + 6 as (x - 2)(x - 3) makes the roots obvious, and it is the right first attempt for textbook problems with small integer coefficients. But factoring only helps when roots happen to be convenient rationals; the quadratic formula always works, including for irrational answers like the roots of x^2 - 2 = 0. Completing the square is the third route, and it is the one that derives the formula rather than merely using it.
A negative discriminant is not a failure. It means the parabola does not cross the horizontal axis in the real plane, which is often the physically meaningful answer: a projectile launched too low to reach the ceiling, a revenue curve that never breaks even. Insisting on a numeric root in that situation produces complex numbers that may be correct algebraically and meaningless contextually.
Real-world quadratics almost always carry units, and units are what let you reject impossible answers. Solving -4.9t^2 + 20t + 2 = 0 for a thrown object gives t = 4.1793 seconds and t = -0.0977 seconds. Both satisfy the equation exactly; only one describes a time after launch. Discarding the negative root is not a mathematical judgement but a modelling one, and it should be stated rather than silently applied.
Precision deserves a word because it is easy to lose. Taking the difference of two nearly equal numbers inside the discriminant can cancel significant digits — computing b^2 - 4ac when b^2 barely exceeds 4ac loses accuracy fast. Rewriting one root using the relationship product = c/a avoids that cancellation and is the standard remedy in numerical work, even though it is invisible in textbook arithmetic.
Finally, remember what the solutions represent. Geometrically they are the axis intercepts of a parabola. Algebraically they are the values making the expression zero. In a model they are thresholds — break-even prices, arrival times, break points where a quantity changes sign. Keeping that reading in view is what makes the numbers useful after you have computed them.
Formula
x = (-b +/- sqrt(b^2 - 4ac)) / (2a)
Derived by completing the square. The plus gives one root, the minus the other; their midpoint is always the vertex.
| Symbol | Meaning | Unit | Notes |
|---|---|---|---|
| a | Leading coefficient | — | If zero, the equation is linear and this formula does not apply. |
| b | Linear coefficient | — | Sign matters absolutely — write b exactly as it appears in standard form. |
| c | Constant term | — | Everything must be moved to one side and collected before identifying a, b and c. |
D = b^2 - 4ac
Positive for two real roots, zero for one repeated root, negative for none. Compute it before anything else.
| Symbol | Meaning | Unit | Notes |
|---|---|---|---|
| D | Discriminant | squared units of b | Its square root is the distance from the vertex to each root, scaled by a. |
Sum of roots = -b/a, product = c/a
A two-line verification that catches most transcription errors without redoing the main calculation.
| Symbol | Meaning | Unit | Notes |
|---|---|---|---|
| x1 + x2 | Sum of the two roots | — | Should equal -b/a exactly, apart from rounding. |
| x1 x x2 | Product of the two roots | — | Should equal c/a exactly, apart from rounding. |
How To Calculate How To Solve A Quadratic Equation
- 1
Put the equation in standard form
Move every term to one side so the other is zero, then collect like powers. Coefficients identified from an uncollected expression are wrong far more often than the arithmetic that follows.
- 2
Identify a, b and c with their signs
For x^2 - 5x + 6 = 0 those are 1, -5 and 6. Writing b as 5 instead of -5 flips every answer, and nothing later reveals it.
- 3
Compute the discriminant first
D = (-5)^2 - 4 x 1 x 6 = 25 - 24 = 1. Squaring a negative b always gives a positive contribution, which is a common source of sign surprise.
- 4
Take the square root and apply both signs
sqrt(1) = 1, so the roots are (5 + 1)/2 = 3 and (5 - 1)/2 = 2. Note that -b is +5 here, not -5.
- 5
Verify with Vieta and with substitution
The roots sum to 5 and multiply to 6, matching -b/a and c/a. Substituting x = 3 gives 9 - 15 + 6 = 0, confirming the answer directly.
Examples
Example 1: x^2 - 5x + 6 = 0 — two clean roots
- a
- 1
- b
- -5
- c
- 6
| Step | Calculation | Result |
|---|---|---|
| Discriminant | (-5)^2 - 4 x 1 x 6 | 1 |
| Root using the plus branch | (5 + 1) / 2 | 3 |
| Root using the minus branch | (5 - 1) / 2 | 2 |
| Vieta check — sum and product | 3 + 2 and 3 x 2 | 5 and 6 |
Result: Roots 3 and 2, summing to 5 and multiplying to 6 — both matching -b/a and c/a as they must.
Example 2: x^2 - 6x + 9 = 0 — one repeated root
- a
- 1
- b
- -6
- c
- 9
| Step | Calculation | Result |
|---|---|---|
| Discriminant | (-6)^2 - 4 x 1 x 9 | 0 |
| Root, with both branches collapsing | (6 + 0) / 2 and (6 - 0) / 2 | 3 |
| Factored form | (x - 3)(x - 3) | 3 twice |
Result: One repeated root at 3 — the parabola touches the axis without crossing, which is exactly what a zero discriminant predicts.
Example 3: x^2 + 2x + 5 = 0 — no real roots
- a
- 1
- b
- 2
- c
- 5
| Step | Calculation | Result |
|---|---|---|
| Discriminant | 2^2 - 4 x 1 x 5 | -16 |
| What that rules out | sqrt(-16) | no real number squares to -16 |
| Lowest point of the curve | 5 - 2^2 / 4 | 4 |
Result: No real roots, and the reason is visible in the vertex: the curve bottoms out at y = 4, so it never reaches the axis.
Calculator
Root using + sqrt(D)
3
- Root using - sqrt(D)
- 2
- Discriminant (b² - 4ac)
- 1
- Vertex — x coordinate
- 2.5
- Vertex — y coordinate
- -0.25
Values update as you type. This calculator covers the single scenario its formula assumes — see Common Mistakes for what it leaves out.
Prefer a full-width tool? Open the How To Solve A Quadratic Equation calculator page.
Common Mistakes
Dropping the sign of b
For x^2 - 5x + 6 = 0 the coefficient b is -5, not 5. Getting this wrong changes both roots, and every later step remains internally consistent, so nothing flags it.
Identifying coefficients before collecting terms
Reading a, b and c off an expression that still has terms on both sides guarantees wrong numbers. Move everything to one side first.
Squaring a negative b incorrectly
b^2 is always non-negative. Entering -5^2 into a calculator as -(5^2) gives -25 rather than 25, silently flipping the discriminant's sign.
Forgetting that a zero leading coefficient changes the problem
If a is zero the equation is linear and has a single root -c/b. Dividing by 2a in that case divides by zero.
Accepting both roots regardless of context
Quadratic models frequently produce one physically impossible answer, typically a negative time or length. Check both against the situation rather than reporting both blindly.
FAQ
What does the discriminant actually tell me?
How many real roots exist. Above zero there are two, exactly zero gives one repeated root, and below zero gives none. Computing it first tells you what kind of answer to expect.
Is factoring ever preferable to the formula?
Yes, when roots are small rationals it is faster and shows structure clearly. The advantage disappears for irrational answers, where the formula is the practical option.
Why do I get one negative root in physics problems?
The equation is symmetric in time and does not know the motion started at zero. The negative solution satisfies the algebra but describes before the launch, so it is discarded on modelling grounds.
Can the leading coefficient be negative?
Yes. A negative a simply flips the parabola to open downward. The formula works unchanged, though the labels larger and smaller root swap meaning.
How do I check my answer quickly?
Confirm the roots sum to -b/a and multiply to c/a, then substitute one root back into the original equation. Both checks take seconds and together catch nearly every error.
References
- [1]Khan Academy, The quadratic formula — https://www.khanacademy.org/math/algebra/x2f8bb11595b61c86:quadratic-formula
- [2]Wolfram MathWorld, Quadratic equation and discriminant — https://mathworld.wolfram.com/QuadraticEquation.html
- [3]MacTutor History of Mathematics Archive, University of St Andrews, Quadratic, cubic and quartic equations — https://mathshistory.st-andrews.ac.uk/HistTopics/Quadratic_etc_equations/