SolveMathAI

Quadratic equation solver

Roots, the discriminant, and the method that fits the equation in front of you.

Enter to solve · Shift+Enter for a new line

  • Free
  • No account
  • Every step shown
  • Arithmetic to calculus

Every quadratic can be solved by formula, but the formula is not always the fastest route. Check the discriminant first: it tells you how many real roots exist before you do any work, and whether the equation will factor neatly.

Which method, and when

Put the equation in the form ax² + bx + c = 0 first. Everything below assumes that shape.

  1. Read the discriminant

    b² − 4ac decides everything. Positive gives two real roots, zero gives one repeated root, negative gives a complex conjugate pair. A perfect square means it factors over the integers.

  2. Try factoring when the discriminant is a perfect square

    Two numbers that multiply to a·c and add to b. This is the fastest route when it works.

  3. Otherwise use the quadratic formula

    x = (−b ± √(b² − 4ac)) / 2a. It always works. Simplify the surd rather than reaching for a decimal.

  4. Complete the square when the question asks, or when you need the vertex

    Halve the coefficient of x, square it, add and subtract it. This gives the turning point as a side effect.

  5. State both roots, and check

    A quadratic has two roots unless the discriminant is zero. Their sum should be −b/a and their product c/a, which is a two-second check.

Worked examples

Each one is solved the way the solver solves it: the rule first, then the line.

Solve x^2 + 4x - 5 = 0

x2+4x−5=0x^2 + 4x - 5 = 0
  1. Discriminant
    b2−4ac=16+20=36=62  ⇒  it factorsb^2 - 4ac = 16 + 20 = 36 = 6^2 \;\Rightarrow\; \text{it factors}
  2. Two numbers: multiply to −5, add to 4
    5×(−1)=−5,5+(−1)=45 \times (-1) = -5, \qquad 5 + (-1) = 4
  3. Factor
    (x+5)(x−1)=0(x + 5)(x - 1) = 0
  4. Zero product rule
    x=−5orx=1x = -5 \quad \text{or} \quad x = 1
  5. Check the sum and product
    −5+1=−4=−ba  ✓−5×1=−5=ca  ✓-5 + 1 = -4 = -\tfrac{b}{a} \;\checkmark \qquad -5 \times 1 = -5 = \tfrac{c}{a} \;\checkmark
Answer
x=−5 or x=1x = -5 \ \text{or}\ x = 1

Solve 2x^2 - 4x - 3 = 0

2x2−4x−3=02x^2 - 4x - 3 = 0
  1. Discriminant
    (−4)2−4(2)(−3)=16+24=40(-4)^2 - 4(2)(-3) = 16 + 24 = 40
  2. Not a perfect square, so use the formula
    x=4±404x = \frac{4 \pm \sqrt{40}}{4}
  3. Simplify the surd
    40=210\sqrt{40} = 2\sqrt{10}
  4. Cancel the common factor
    x=4±2104=2±102x = \frac{4 \pm 2\sqrt{10}}{4} = \frac{2 \pm \sqrt{10}}{2}
Answer
x=2+102 or x=2−102x = \dfrac{2 + \sqrt{10}}{2} \ \text{or}\ x = \dfrac{2 - \sqrt{10}}{2}

Solve x^2 - 6x + 13 = 0

x2−6x+13=0x^2 - 6x + 13 = 0
  1. Discriminant
    36−52=−16<0  ⇒  no real roots36 - 52 = -16 < 0 \;\Rightarrow\; \text{no real roots}
  2. Apply the formula anyway
    x=6±−162x = \frac{6 \pm \sqrt{-16}}{2}
  3. Write the square root of a negative
    −16=4i\sqrt{-16} = 4i
  4. Simplify
    x=6±4i2=3±2ix = \frac{6 \pm 4i}{2} = 3 \pm 2i
Answer
x=3+2i or x=3−2ix = 3 + 2i \ \text{or}\ x = 3 - 2i

A negative discriminant means the parabola never crosses the x-axis. The roots are a complex conjugate pair.

Solve x^2 - 6x + 2 = 0 by completing the square

x2−6x+2=0x^2 - 6x + 2 = 0
  1. Move the constant across
    x2−6x=−2x^2 - 6x = -2
  2. Half the x coefficient, then square it
    (−62)2=9\left(\tfrac{-6}{2}\right)^2 = 9
  3. Add it to both sides
    x2−6x+9=7x^2 - 6x + 9 = 7
  4. The left side is now a perfect square
    (x−3)2=7(x - 3)^2 = 7
  5. Take the square root of both sides
    x−3=±7x - 3 = \pm\sqrt{7}
  6. Solve
    x=3±7x = 3 \pm \sqrt{7}
Answer
x=3+7 or x=3−7x = 3 + \sqrt{7} \ \text{or}\ x = 3 - \sqrt{7}

The completed form (x − 3)² − 7 also gives the vertex directly: (3, −7).

Solved problems

Asked here and worked through in full. Open one for every step.

  1. Solve x^2 + 4x - 5 = 0
    Answer x=−5,1x = -5, 1
  2. Solve: x^2 - 5x + 6 = 0
    Answer x=2,x=3x = 2, x = 3

Where marks get lost

Forgetting the ±

Taking a square root gives two values. Dropping the minus branch loses half the answer.

Using the formula before rearranging

a, b and c only mean anything once the equation equals zero. x² + 4x = 5 has c = −5, not 5.

Cancelling wrongly in the formula

In (4 ± 2√10)/4 you may only cancel a factor shared by every term. Cancelling the 4 with the 4 alone is wrong.

Questions

How do I complete the square?

Halve the coefficient of x, square it, and add and subtract it. For x² + 6x + 5, half of 6 is 3 and 3² = 9, giving (x + 3)² − 9 + 5 = (x + 3)² − 4. Then take the square root of both sides.

What is the quadratic formula?

x = (−b ± √(b² − 4ac)) / 2a, for any equation written as ax² + bx + c = 0. It always works, including when the equation does not factor.

How do I solve a quadratic equation?

Try factoring first, since it is fastest when it works. If it does not factor cleanly, use the quadratic formula. Completing the square is the method to use when you also need the vertex.

How do I find the vertex of a parabola?

The vertex sits at x = −b / 2a; put that x back into the equation for the y value. For y = x² − 4x + 1 the vertex is at x = 2, y = −3. Completing the square gives the same point directly.

What is the discriminant?

The b² − 4ac inside the square root. Positive means two real solutions, zero means one repeated solution, and negative means two complex ones. It tells you what to expect before you solve.

Why do I get two answers?

A parabola can cross the horizontal axis twice, so a quadratic normally has two solutions. Both are correct unless the problem itself rules one out, as a length or a time often does.

What if the answer is not a whole number?

That is normal. The solver gives the exact form first, with the radical or fraction intact, then a decimal to three or four significant figures underneath.

Can it solve equations with complex roots?

Yes. When the discriminant is negative it reports the pair of complex solutions rather than saying there is no answer.