Quadratic Formula Calculator
x = (-b +/- sqrt(b^2 - 4ac)) / 2a gives both roots of a quadratic equation. It shows the discriminant, both roots including complex ones, the vertex, the sum and product of the roots and the factored form, and it switches to a linear solve when a is zero.
Enter a, b and c for ax^2 + bx + c = 0. Negative numbers and decimals are fine, and a = 0 is handled as a straight line.
| Equation | |
| Discriminant | |
| Kind of roots | |
| First root | |
| Second root | |
| Vertex | |
| Axis of symmetry | |
| Sum of roots | |
| Product of roots | |
| Factored form | |
| Check |
All calculations run in your browser, and nothing you type is uploaded or stored.
Enter a, b and c to get both roots, the discriminant, the vertex and the factored form, with the steps shown and a check that puts a root back in.
Key takeaways
- For 2x^2 - 4x - 6 = 0 the discriminant is 64 and the roots are 3 and -1
- A negative discriminant means no real roots: x^2 + 2x + 5 = 0 gives -1 + 2i and -1 - 2i
- The vertex is at x = -b / 2a, which is 1 for this equation, with height -8
- The roots always sum to -b / a and multiply to c / a, so 3 + (-1) = 2 and 3 x (-1) = -3
- A projectile launched at 40 ft/s from 3 ft lands after 2.57 seconds, and the negative root is discarded
On this page
What the quadratic formula solves
A quadratic equation is any equation that can be rearranged into the form ax^2 + bx + c = 0, with a not equal to zero. The x^2 term is what separates it from a straight line. The letters a, b and c are coefficients: fixed numbers that belong to one particular equation, not variables you are solving for.
The formula gives the roots, meaning the values of x that make the left side equal zero: x = (-b +/- sqrt(b^2 - 4ac)) / 2a. The plus or minus sign is the whole point. It produces two answers from one expression, because a parabola can cross the x axis in two places.
The piece under the square root, b^2 - 4ac, is called the discriminant. Work it out first and you know what kind of answer to expect before doing any more arithmetic.
| Part | Name | What it controls |
|---|---|---|
| a | Leading coefficient | How wide the parabola opens and which way. Zero means the equation is not quadratic at all. |
| b | Linear coefficient | Shifts the vertex left or right. The axis of symmetry is x = -b / 2a. |
| c | Constant term | Where the curve crosses the y axis, since y = c when x = 0. |
| b^2 - 4ac | Discriminant | Positive: two real roots. Zero: one repeated root. Negative: two complex roots. |
Enter the three numbers above and the calculator returns the discriminant, both roots, the vertex, the sum and product of the roots, and the factored form. The check line puts a root back into the original expression, which catches sign errors faster than rereading your work.
Worked example: 2x^2 - 4x - 6 = 0
Here a = 2, b = -4 and c = -6. The discriminant comes first: b^2 - 4ac = (-4)^2 - 4 x 2 x (-6) = 16 + 48 = 64. The negative c matters twice, because subtracting the product of two negatives adds 48 instead of taking it away.
| Step | Work | Result |
|---|---|---|
| 1. Read the coefficients | a = 2, b = -4, c = -6 | all three nonzero |
| 2. Discriminant | b^2 - 4ac = 16 + 48 | 64 |
| 3. Square root | sqrt(64) | 8 |
| 4. Denominator | 2a = 2 x 2 | 4 |
| 5. Plus branch | (4 + 8) / 4 | 3 |
| 6. Minus branch | (4 - 8) / 4 | -1 |
Two cheap checks confirm the pair. The sum of the roots should equal -b / a = 4 / 2 = 2, and 3 + (-1) = 2. The product should equal c / a = -6 / 2 = -3, and 3 x (-1) = -3. If either one is off, a sign went missing along the way.
The vertex sits at x = -b / 2a = 1, halfway between the roots. Its height is 2 x 1^2 - 4 x 1 - 6 = -8, which is the lowest point on the curve. Expand 2(x - 1)^2 - 8 and you get 2x^2 - 4x + 2 - 8, the original expression, so the factored form 2(x - 3)(x + 1) is the same equation written a third way.
A projectile: when does the ball land
In feet and seconds, the height of a thrown object is h = -16t^2 + v0 t + h0. The 16 is half of the 32 ft/s^2 pull of gravity, and that factor of one half is exactly why the formula has a square in it.
Take a ball released 3 ft above the ground at 40 ft/s. Its height is h = -16t^2 + 40t + 3, and landing means h = 0. Multiply by -1 to make the leading term positive: 16t^2 - 40t - 3 = 0.
The discriminant is (-40)^2 - 4 x 16 x (-3) = 1600 + 192 = 1792, and sqrt(1792) is about 42.332. The roots are t = (40 + 42.332) / 32 = 2.573 seconds and t = (40 - 42.332) / 32 = -0.073 seconds.
The negative root is not a mistake. It is the moment on the same arc when the ball would have been at ground level before the throw started. Throwing it out is a decision about the physical situation, not about the algebra, and it is worth saying so out loud when you show your work.
The top of the flight comes at t = 40 / 32 = 1.25 seconds, where the height is -16 x 1.25^2 + 40 x 1.25 + 3 = -25 + 50 + 3 = 28 ft. In metric units the same model reads -4.9t^2 + v0 t + h0, and feeding 16 into a metric problem is one of the most common homework errors there is.
The discriminant tells you what to expect
One line of arithmetic sorts every quadratic into three groups. That is worth doing before you reach for a calculator, because it tells you whether a decimal answer even exists.
| Equation | a, b, c | Discriminant | Roots |
|---|---|---|---|
| x^2 - 5x + 6 = 0 | 1, -5, 6 | 25 - 24 = 1 | x = 3 and x = 2 |
| 2x^2 + 3x - 2 = 0 | 2, 3, -2 | 9 + 16 = 25 | x = 0.5 and x = -2 |
| x^2 + 4x + 4 = 0 | 1, 4, 4 | 16 - 16 = 0 | x = -2, counted twice |
| x^2 + 2x + 5 = 0 | 1, 2, 5 | 4 - 20 = -16 | x = -1 + 2i and x = -1 - 2i |
| x^2 - 2x - 8 = 0 | 1, -2, -8 | 4 + 32 = 36 | x = 4 and x = -2 |
In the negative case the square root turns imaginary: sqrt(-16) = 4i, so x = (-2 +/- 4i) / 2 = -1 +/- 2i. The graph of that equation never reaches the x axis. Its lowest point is (-1, 4), four units above zero, which is the visual version of the same fact.
When the discriminant is a perfect square, the roots come out as whole numbers or simple fractions, which is why textbook problems tend to have those values. A number like 1792 has no clean square root, so the answers are decimals that never terminate. The calculator shows six decimal places and the check line confirms the substitution still lands on zero.
Vertex, axis of symmetry and the factored form
The same parabola can be written three ways, and each one shows a different feature at a glance.
| Form | For this equation | What it reveals |
|---|---|---|
| Standard | 2x^2 - 4x - 6 | y-intercept at -6, direction of opening from the sign of a |
| Vertex | 2(x - 1)^2 - 8 | lowest point at (1, -8) |
| Factored | 2(x - 3)(x + 1) | roots at 3 and -1 |
The vertex coordinates come straight from the coefficients: h = -b / 2a and k = c - b^2 / (4a). For this equation h = 4 / 4 = 1 and k = -6 - 16 / 8 = -8, which matches the graph.
The axis of symmetry is the vertical line x = h. Every point on the parabola has a mirror twin on the other side of that line, so the two roots always sit the same distance from it. Here the roots 3 and -1 are two units either side of x = 1.
Multiplying the factored form back out is the check that the three forms agree: 2(x - 3)(x + 1) = 2(x^2 - 2x - 3) = 2x^2 - 4x - 6. If the middle term does not come back, one of the factors has the wrong sign.
One caveat about the vertex form: it is exact only when the coefficients are exact. With roots like 2.572876 the factored form carries a rounding error, which is why the calculator labels it as an approximation rather than pretending the decimals are clean.
Vieta's rules: a thirty second check
For any quadratic with roots r1 and r2, the sum of the roots is -b / a and the product is c / a. Both follow from expanding a(x - r1)(x - r2) and comparing coefficients, and both are faster than redoing the formula.
Example: x^2 + 5x - 84 = 0 has roots 7 and -12. The sum is -5, and -b / a = -5. The product is -84, and c / a = -84. Two lines, both consistent, and no square root needed.
The product rule also finishes a problem when you already know one root. If 7 solves x^2 + 5x - 84 = 0, the other root must satisfy 7 x r2 = -84, so r2 = -12. That trick is useful on tests with multiple choice answers and in code that checks a solver against known inputs.
Vieta's rules do not replace the formula, because they do not tell you the roots in the first place. They are a verification step, and a good one: a sign error in b or c almost always breaks one of the two sums.
Word problems that turn into quadratics
Most real uses of the formula arrive as a sentence, not as an equation. Two patterns cover a large share of them.
A rectangle with a fixed area. A garden is 5 ft longer than it is wide and covers 84 sq ft. Write the width as x, the length as x + 5, and the area as x(x + 5) = 84. Expanding gives x^2 + 5x - 84 = 0. The discriminant is 25 + 336 = 361, sqrt(361) = 19, and x = (-5 + 19) / 2 = 7. The garden is 7 ft by 12 ft, which multiplies to 84. The other root, -12, is a length that cannot exist, so it is dropped.
Profit that peaks and falls. A small seller models monthly profit as P = -0.5x^2 + 40x - 600, where x is the number of units sold. Break-even means P = 0, so 0.5x^2 - 40x + 600 = 0, and the discriminant is 1600 - 1200 = 400. The roots are (40 + 20) / 1 = 60 and (40 - 20) / 1 = 20, so the seller loses money below 20 units and above 60. The best month is at x = 40, where profit is -0.5 x 1600 + 1600 - 600 = 200 dollars.
| Situation | Equation | Roots | Answer you keep |
|---|---|---|---|
| Garden, 5 ft longer than wide, 84 sq ft | x^2 + 5x - 84 = 0 | 7 and -12 | 7 ft by 12 ft |
| Break-even on a price curve | 0.5x^2 - 40x + 600 = 0 | 20 and 60 | 20 to 60 units |
| Ball thrown at 40 ft/s from 3 ft | 16t^2 - 40t - 3 = 0 | 2.573 and -0.073 | about 2.57 seconds |
The pattern is always the same: build the equation, put everything on one side, then read the discriminant. What changes is which root makes sense in the world, and that judgment never comes from the formula.
Mistakes that change the answer
Almost every wrong answer from this formula traces back to one of six slips.
| Mistake | What happens | Fix |
|---|---|---|
| Using a = 0 | The denominator 2a becomes zero and the formula breaks | Solve bx + c = 0 instead; it is a straight line |
| Dropping the sign of b | -b turns into b, and both roots move | Write -b with brackets before substituting |
| Dividing by a instead of 2a | Answers come out exactly twice too large | The denominator is always 2a |
| Rounding the square root early | sqrt(1792) as 42.3 shifts the time to 2.572 instead of 2.573 | Keep four or more digits until the last step |
| Reporting one root when the discriminant is zero | A repeated root is still a double root | Say x = 3 twice, or note the multiplicity |
| Mixing feet and meters | 16 belongs to feet, 4.9 belongs to meters | Pick one unit system before writing the equation |
A seventh issue is not arithmetic at all: keeping a root that the situation forbids. A negative width, a negative time before the throw, a negative number of units. The algebra hands you two answers and the context decides which one is real, so state the reason when you discard one.
For the underlying rules, the OpenStax chapter on quadratic equations walks through the same steps with exercises, and MathWorld's entry on the quadratic equation covers the derivation and the complex case. Both use the same convention this page does: the standard form ax^2 + bx + c = 0 with a not equal to zero.
Frequently asked questions
What is the quadratic formula?
x = (-b +/- sqrt(b^2 - 4ac)) / 2a. It solves any equation in the form ax^2 + bx + c = 0 where a is not zero, and the plus or minus gives both roots.
What are the roots of 2x^2 - 4x - 6 = 0?
x = 3 and x = -1. The discriminant is 16 + 48 = 64, sqrt(64) = 8, and (4 +/- 8) / 4 gives 3 and -1.
What does a negative discriminant mean?
There are no real roots. For x^2 + 2x + 5 = 0 the discriminant is -16, and the roots are -1 + 2i and -1 - 2i.
What if a is zero?
Then the equation is not quadratic. bx + c = 0 has the single solution x = -c / b, and the calculator switches to that case automatically.
How do I find the vertex from the standard form?
h = -b / 2a and k = c - b^2 / (4a). For 2x^2 - 4x - 6 the vertex is (1, -8).
Why is the denominator 2a?
It comes from completing the square on ax^2 + bx + c. Dividing by 2a is what isolates x after the square root is taken, so using a alone doubles every answer.
What is the discriminant used for?
It sorts the answer before you compute it: 64 means two real roots, 0 means one repeated root, and -16 means a complex pair.
How long is a ball in the air if thrown at 40 ft/s from 3 ft?
About 2.57 seconds. Solving 16t^2 - 40t - 3 = 0 gives t = 2.573 and t = -0.073, and the negative root is discarded.
Can the formula give a fraction instead of a decimal?
Yes, and the fraction is exact. For 2x^2 + 3x - 2 = 0 the roots are 1/2 and -2, which the calculator shows as 0.5 and -2.
What is the sum and product of the roots?
The sum is -b / a and the product is c / a. For x^2 + 5x - 84 = 0 the roots 7 and -12 sum to -5 and multiply to -84.
Does a repeated root count as two answers?
It is one value with multiplicity two. x^2 - 6x + 9 = 0 has the single root 3, and the factored form is (x - 3)^2.
Can I use the formula for an equation with fractions?
Yes. Clear the fractions first or enter the decimal values; either way the discriminant and both roots come out the same.
Why does the calculator show a factored form with decimals?
When the roots are not whole numbers the factors carry rounded values. The check line substitutes the rounded root back in and reports how close to zero it lands.
Spotted a wrong number or a broken result?
More Math tools
Fee schedules, rates and rules change without notice. Always confirm important figures with the official source before you rely on them.