Skip to content
ihateDesmos

Quadratic equation solver

Type a quadratic equation and get its solutions with the working: factoring when the roots are rational, otherwise the quadratic formula with the discriminant and exact square roots. Negative discriminants give the complex pair.

Solve
Result
x=1−212
x=1+212
Steps
  1. Quadratic formula with a = 1, b = −2, c = −1: x = (−b ± √(b² − 4ac)) / (2a)
  2. Discriminant: b² − 4ac = 8
  3. √8 = 2√2, so x = 1 ± √2
Graph both sides, to see the solutions as crossings

How to use it

  1. 1
    Type the equation in any form: x^2 - 2x - 1 = 0, 2x^2 = 3x + 5, x(x - 4) = 12.
  2. 2
    Press Solve. The calculator rearranges it to ax² + bx + c = 0, then factors or uses the formula.
  3. 3
    Graph it to see the parabola: the solutions are the x-intercepts, and the vertex sits halfway between them.

The quadratic formula

Every equation ax² + bx + c = 0 with a ≠ 0 has solutions

x = (-b ± sqrt(b^2 - 4a c)) / (2a)

For x² − 2x − 1 = 0, a = 1, b = −2 and c = −1, so b² − 4ac = 4 + 4 = 8 and x = (2 ± √8)/2. Since √8 = 2√2, that simplifies to x = 1 ± √2, or about 2.414 and −0.414.

What the discriminant tells you

The expression under the square root, D = b² − 4ac, decides what kind of solutions there are before you work them out:

DiscriminantSolutionsGraph
D > 0, a perfect squareTwo rational solutions; it factorsCrosses the x-axis twice
D > 0, not a perfect squareTwo irrational solutionsCrosses the x-axis twice
D = 0One repeated solutionTouches the x-axis at the vertex
D < 0No real solutions; two complex onesNever meets the x-axis

Factoring first, when it works

When the discriminant is a perfect square, factoring is quicker and less error-prone than the formula. x² − 5x + 6 = 0 has D = 25 − 24 = 1, a perfect square, and factors as (x − 2)(x − 3) = 0. By the zero product property, one of the factors must be zero, so x = 2 or x = 3. The factoring calculator shows the methods in detail.

Completing the square

The quadratic formula comes from completing the square, which is also how you find the vertex. For x² − 2x − 1 = 0, add and subtract the square of half the x-coefficient: (x − 1)² − 1 − 1 = 0, so (x − 1)² = 2 and x − 1 = ±√2. The same steps on ax² + bx + c = 0 produce the formula. The vertex form guide shows how this reveals the vertex of the parabola: here it is (1, −2).

See vertex form for the graph side of the story.

Examples to try

−224−2240
Two irrational roots
y = x^2 - 2x - 1
x = 1 ± √2: the parabola crosses the axis at about −0.414 and 2.414.
Open this example
24240
One repeated root
y = x^2 - 4x + 4
D = 0: the vertex (2, 0) sits on the axis.
Open this example
−222460
No real roots
y = x^2 + x + 2
D = −7: the parabola never reaches the axis. The solutions are −1/2 ± (√7/2)i.
Open this example

Frequently asked questions

How do I solve a quadratic equation?
Rearrange it to ax² + bx + c = 0. If the discriminant b² − 4ac is a perfect square, factor it; otherwise use the quadratic formula x = (−b ± √(b² − 4ac)) / (2a).
What is the discriminant?
b² − 4ac, the part of the quadratic formula under the square root. Positive means two real solutions, zero means one repeated solution, negative means two complex solutions.
Does it give exact answers?
Yes. Rational solutions are shown as fractions, and irrational ones in simplest square-root form, like 1 ± √2, along with decimals.
Can it solve quadratics with complex roots?
Yes. When the discriminant is negative it shows the complex pair, in the form p ± qi.
What if my equation isn’t in standard form?
Type it as it is, for example 2x² = 3x + 5 or x(x − 4) = 12. The calculator moves everything to one side first.

Related tools and guides

See the parabola

Graph any quadratic and its roots, vertex and y-intercept are marked automatically.

Open the calculator