MathsAlgebra

Quadratic Equation
solver.

Type your numbers into the equation. You get exact roots, the graph and every step, as you type.

How it’s worked out

Every quadratic can be written as ax² + bx + c = 0. The roots are the values of x that make the left side equal zero. The quadratic formula gives both of them at once:

x\displaystyle x=−b±b2−4ac2a\displaystyle {}= \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
  • a is the number in front of x². It cannot be 0, or there is no x² term and the equation is a straight line.
  • b is the number in front of x. If there is no x term, b is 0.
  • c is the number standing on its own, after you move everything to one side.
  • ± means you work the formula twice: once adding the square root, once subtracting it. That gives the two roots.

The part under the square root is called the discriminant, written Δ (the Greek letter delta):

Δ\displaystyle \Delta=b2−4ac\displaystyle {}= b^2 - 4ac

Its sign tells you what kind of roots to expect before you finish. A positive Δ gives two different real roots. Zero gives one repeated root. A negative Δ gives two complex roots, because no real number squares to a negative.

EquationΔRoots
x2−5x+6=0x^2 - 5x + 6 = 01x=2,x=3x = 2,\quad x = 3
x2−4x+1=0x^2 - 4x + 1 = 012x=2±3x = 2 \pm \sqrt{3}
x2+4x+4=0x^2 + 4x + 4 = 00x=−2x = -2
x2+2x+5=0x^2 + 2x + 5 = 0−16x=−1±2ix = -1 \pm 2i

The turning point of the curve, the vertex, sits halfway between the roots. Its coordinates are:

h\displaystyle h=−b2a,\displaystyle {}= -\frac{b}{2a},k\displaystyle k=c−b24a\displaystyle {}= c - \frac{b^2}{4a}

For real roots, the tool uses a rearranged form of the formula. When b is large, subtracting two nearly equal numbers loses digits, so it first finds q=−12(b±Δ)q = -\tfrac{1}{2}\left(b \pm \sqrt{\Delta}\right), choosing the sign that matches b, and then takes the roots as q ÷ a and c ÷ q. This keeps the small root of x² + 100000000x + 1 = 0 correct to the last digit. The exact answer comes from completing the square with whole numbers, so surds such as √29 stay as surds instead of turning into long decimals.

Worked examples

Sizing a garden bed

Priya wants a rectangular bed that is 3 m longer than it is wide and covers 40 m². If the width is x, then x(x + 3) = 40. Move the 40 across to get x² + 3x − 40 = 0, so a = 1, b = 3 and c = −40.

The discriminant is 3² − 4(1)(−40) = 169, a perfect square, so the roots are whole numbers: x = −8 or x = 5. A width cannot be negative, so the bed is 5 m wide. Solving for the length L instead, L(L − 3) = 40 gives L² − 3L − 40 = 0 with the positive root L = 8, so the bed is 5 m by 8 m. The equation also factors as (x + 8)(x − 5) = 0.

Open this example in the tool

When does a thrown ball land?

Marco throws a ball upward at 20 m/s from a hand 1.5 m above the ground. Using g = 9.8 m/s², its height after t seconds is h = −4.9t² + 20t + 1.5. It lands when h = 0.

Here Δ = 429.4, so there are two real roots: t = −0.07 and t = 4.16. Only the positive one fits the story, so the ball lands after about 4.16 s. The vertex, t = 2.04 s and h = 21.91 m, is the top of the flight. The negative root is the time the ball would have left the ground if its path had started earlier at ground level.

Open this example in the tool

A homework answer with i in it

Sam's worksheet asks for the roots of 2x² + 2x + 5 = 0. The discriminant is 2² − 4(2)(5) = −36, which is negative, so the parabola never touches the x-axis and the roots are complex.

x\displaystyle x=−2±−364\displaystyle {}= \frac{-2 \pm \sqrt{-36}}{4}⇒x\displaystyle {}\Rightarrow\quad x=−1±3i2\displaystyle {}= \frac{-1 \pm 3i}{2}

As decimals that is x = −0.5 ± 1.5i. The two roots are a conjugate pair: they share the real part −0.5 and differ only in the sign of the i part. The real part is also the x-coordinate of the vertex.

Open this example in the tool

Reading your result

The roots are where the curve meets the x-axis. Two real roots mean two crossings. A repeated root means the curve only touches the axis at its vertex. Complex roots mean it never reaches the axis at all. These three cases follow the sign of the discriminant, as set out in Stewart's Precalculus, section 1.5.

The exact answer is what most answer keys print: whole numbers, stacked fractions such as 12\tfrac{1}{2}, surds such as 2 ± √3, or p ± qi. If any of a, b or c is a decimal, only decimals are shown. Switch to Decimal and pick 2, 4, 6 or 8 places when you need a number to plug in somewhere else.

The vertex is the lowest point when a is positive and the highest point when a is negative. In a word problem it is usually the maximum height, the largest area or the best price. The axis of symmetry is the vertical line through it.

The factored form appears only when both roots are rational. x² − 2 = 0 has roots ±√2, so it has no factors with whole numbers; you see the vertex form under the answer instead.

The check in the working puts each root back into ax² + bx + c. A result of 0 confirms the root. With decimal inputs you may see "0 (to rounding)", which means the leftover is far smaller than the numbers you typed.

Common mistakes

  • Squaring a negative b. With b = −3, b² is 9, not −9. Typing −3² into many handheld calculators gives −9 because the square is done before the minus. Put brackets round it: (−3)².
  • Forgetting the minus in −b. When b is negative, −b is positive. In x² − 3x − 10 = 0 the formula starts with +3, not −3.
  • Dividing only the square root by 2a. The whole top line, −b ± √Δ, is divided by 2a. Writing −b ± √Δ ÷ 2a changes the answer.
  • Not moving everything to one side first. For x² + 3x = 40, c is −40, not 0 and not 40. The formula only works on ax² + bx + c = 0.
  • Leaving out a missing term. x² − 9 = 0 has b = 0. Put 0 in the box rather than leaving it empty.
  • Rounding too early. Rounding Δ or √Δ before the last step can move the roots by more than you expect. Equations built from decimals such as 0.1 and 0.2 can also give a tiny nonzero Δ when the true value is 0, so two roots that agree to many places are probably one repeated root.
  • Keeping a root the story rules out. A negative time or a negative length is a real root of the equation but not an answer to the question.

Questions people ask

First move every term to one side so the other side is 0. Then a is the number in front of x², b is the number in front of x and c is the number on its own, each with its sign. In 3 − x² = 2x, rearranging gives −x² − 2x + 3 = 0, so a = −1, b = −2 and c = 3.

Sources

  • Stewart, Redlin and Watson. Precalculus: Mathematics for Calculus, 7th ed., sections 1.5 and 1.6
  • Higham, N. J. Accuracy and Stability of Numerical Algorithms, 2nd ed. (SIAM, 2002), section 1.8 on the quadratic formula
  • Press et al. Numerical Recipes, 3rd ed., section 5.6: Quadratic and cubic equations
  • OpenStax, College Algebra 2e, section 2.5: Quadratic Equations (2021)