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+4x5=0x^2 + 4x - 5 = 0
  1. Discriminant
    b24ac=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)(x1)=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

2x24x3=02x^2 - 4x - 3 = 0
  1. Discriminant
    (4)24(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=2102x = \dfrac{2 + \sqrt{10}}{2} \ \text{or}\ x = \dfrac{2 - \sqrt{10}}{2}

Solve x^2 - 6x + 13 = 0

x26x+13=0x^2 - 6x + 13 = 0
  1. Discriminant
    3652=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=32ix = 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

x26x+2=0x^2 - 6x + 2 = 0
  1. Move the constant across
    x26x=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
    x26x+9=7x^2 - 6x + 9 = 7
  4. The left side is now a perfect square
    (x3)2=7(x - 3)^2 = 7
  5. Take the square root of both sides
    x3=±7x - 3 = \pm\sqrt{7}
  6. Solve
    x=3±7x = 3 \pm \sqrt{7}
Answer
x=3+7 or x=37x = 3 + \sqrt{7} \ \text{or}\ x = 3 - \sqrt{7}

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

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

What does the discriminant tell me?

b² − 4ac. Positive means two distinct real roots, zero means one repeated root, negative means two complex roots. A positive perfect square also means the quadratic factors over the integers.

When should I complete the square instead?

When the question asks for it, when you need the vertex or turning point, or when you are deriving the formula itself. It is the only method that hands you the vertex for free.

Can it give exact answers rather than decimals?

Yes, exact by default: surds stay as surds and fractions stay as fractions, with a decimal shown alongside when it helps.

Does it handle complex roots?

Yes. When the discriminant is negative it gives the conjugate pair in a + bi form, as in example three.