Quadratic Equation Solver

Type a, b and c. With whole-number coefficients the roots come out exact, in surds where they are irrational, and every number is worked out underneath.

The quadratic formula x=−b±b2−4ac2ax=\frac{-b\pm\sqrt{b^{2}-4ac}}{2a}
Number of real roots b2−4ac>0: 2b2−4ac=0: 1b2−4ac<0: 0\begin{aligned}&b^{2}-4ac>0:\ 2\\&b^{2}-4ac=0:\ 1\\&b^{2}-4ac<0:\ 0\end{aligned}
Completed square ax2+bx+c=a(x+b2a)2+c−b24aax^{2}+bx+c=a\left(x+\frac{b}{2a}\right)^{2}+c-\frac{b^{2}}{4a}
Sum and product of the roots x1+x2=−ba,x1x2=cax_{1}+x_{2}=-\frac{b}{a},\qquad x_{1}x_{2}=\frac{c}{a}
Loading interactive simulation...

Lesson

The theory — Quadratic Equation Solver

A quadratic equation is ax² + bx + c = 0 with a ≠ 0. Its roots are the values of x that make it true; the real ones are where the parabola y = ax² + bx + c meets the x-axis.

Where the formula comes from

  1. Take a out of the x terms, so the bracket starts with a plain x².
    ax2+bx+c=a(x2+bax)+cax^{2}+bx+c=a\left(x^{2}+\frac{b}{a}x\right)+c
  2. Complete the square. Half the coefficient of x, squared, is added and taken away inside the bracket. What is left outside is the turning point's height.
    x2+bax=(x+b2a)2−b24a2ax2+bx+c=a(x+b2a)2−b2−4ac4a\begin{aligned}x^{2}+\frac{b}{a}x&=\left(x+\frac{b}{2a}\right)^{2}-\frac{b^{2}}{4a^{2}}\\ax^{2}+bx+c&=a\left(x+\frac{b}{2a}\right)^{2}-\frac{b^{2}-4ac}{4a}\end{aligned}
  3. Solve for x. Set it to zero, isolate the square and take both square roots. The result is the quadratic formula.
    (x+b2a)2=b2−4ac4a2⇒ x=−b±b2−4ac2a\begin{aligned}&\left(x+\frac{b}{2a}\right)^{2}=\frac{b^{2}-4ac}{4a^{2}}\\&\Rightarrow\ x=\frac{-b\pm\sqrt{b^{2}-4ac}}{2a}\end{aligned}
  4. Read the discriminant. A square is never negative, so the sign of b² − 4ac decides between two real roots, one repeated root, and a pair of complex roots.
    Δ>0: x1≠x2Δ=0: x=−b2aΔ<0: x=−b2a±−Δ2a i\begin{aligned}&\Delta>0:\ x_{1}\ne x_{2}\qquad\Delta=0:\ x=-\frac{b}{2a}\\&\Delta<0:\ x=-\frac{b}{2a}\pm\frac{\sqrt{-\Delta}}{2a}\,i\end{aligned}
  5. Leave surds exact. Take square factors out of √Δ and cancel what divides every term. Give decimals only when the question asks for them.
    x2+4x−7=0:x=−4±442=−4±2112=−2±11\begin{aligned}&x^{2}+4x-7=0:\\&x=\frac{-4\pm\sqrt{44}}{2}=\frac{-4\pm2\sqrt{11}}{2}=-2\pm\sqrt{11}\end{aligned}

When the famous formula quietly fails

The textbook formula can betray you on a computer. When b² is far larger than 4ac, the square root is nearly equal to |b|, so one of the two roots subtracts two almost-identical numbers — -b + √Δ when b is positive, and -b − √Δ when b is negative — wiping out most of the significant digits in an effect called catastrophic cancellation. Numerical libraries dodge this by computing one root first, then finding the other as c/(a·x₁). Centuries-old algebra and modern floating-point arithmetic quietly disagree.

QUADRATIC THEORY — READING ax² + bx + c BEFORE YOU SOLVE IT

The Discriminant: How Many Roots, and Which Way Up?

Two numbers settle the shape of the answer before you touch the quadratic formula. The discriminant Δ = b² − 4ac tells you how many real roots exist, and the sign of a tells you which way the parabola opens and whether its vertex is a lowest or a highest point.

Δ > 0 — two distinct real roots Δ = b2 − 4ac > 0
Δ = 0 — one repeated real root Δ = 0
Δ < 0 — two complex conjugate roots Δ < 0
a < 0 — the parabola opens downward a < 0

01

Δ > 0 — two distinct real roots

What you know: The discriminant b² − 4ac comes out positive. The parabola crosses the x-axis at two separate points.

Roots: Δ = b2 − 4ac > 0

Worked example: x² − 5x + 6 = 0 → Δ = 25 − 24 = 1 → x = 2 and x = 3

Open this case: two roots
Δ > 0 — two distinct real roots. Δ > 0: the curve cuts the axis twice, symmetrically about the vertex. The discriminant b² − 4ac comes out positive. The parabola crosses the x-axis at two separate points.
Δ > 0: the curve cuts the axis twice, symmetrically about the vertex.

02

Δ = 0 — one repeated real root

What you know: The discriminant is exactly zero. The parabola touches the x-axis at a single point instead of crossing it.

Roots: Δ = 0

Worked example: x² − 4x + 4 = 0 → Δ = 16 − 16 = 0 → x = 2, counted twice

Open this case: repeated root
Δ = 0 — one repeated real root. Δ = 0: the vertex sits exactly on the axis — a tangent, not a crossing. The discriminant is exactly zero. The parabola touches the x-axis at a single point instead of crossing it.
Δ = 0: the vertex sits exactly on the axis — a tangent, not a crossing.

03

Δ < 0 — two complex conjugate roots

What you know: The discriminant is negative. The parabola never reaches the x-axis, so there is no real solution.

Roots: Δ < 0

Worked example: x² + 2x + 5 = 0 → Δ = 4 − 20 = −16 → x = −1 ± 2i

Open this case: complex roots
Δ < 0 — two complex conjugate roots. Δ < 0: the whole curve stays on one side of the axis. The discriminant is negative. The parabola never reaches the x-axis, so there is no real solution.
Δ < 0: the whole curve stays on one side of the axis.

04

a < 0 — the parabola opens downward

What you know: The leading coefficient a is negative. This is independent of the discriminant: it flips the curve and turns the vertex into a maximum.

Roots: a < 0

Worked example: −x² + 4 = 0 → Δ = 0 + 16 = 16 > 0 → x = ±2, with a maximum at (0, 4)

Open this case: opens down
a < 0 — the parabola opens downward. a < 0: the arms point down and the vertex is the maximum. The leading coefficient a is negative. This is independent of the discriminant: it flips the curve and turns the vertex into a maximum.
a < 0: the arms point down and the vertex is the maximum.
References (1)

Problems solved in full

  1. Solving x² − 5x + 6 = 0 by completing the square 5 steps

    Solve x² − 5x + 6 = 0 by completing the square. Then answer something the quadratic formula will not tell you: the discriminant counts the roots, but what does its size measure?

    Open this problem in the tool

    1. Completing the square is not a trick for solving quadratics — it is the proof that the quadratic formula is true, run on one specific equation. Halve the coefficient of x, square it, add and subtract. The 6.25 that appears is the price of forcing the first two terms into a perfect square, and it has to be paid back in the same line.

      x2−5x+6=(x−52)2−254+6=(x−2.5)2−0.25x^2-5x+6=\left(x-\tfrac52\right)^{2}-\tfrac{25}{4}+6=(x-2.5)^2-0.25
    2. Vertex form puts the variable in exactly one place, so it can be undone directly: isolate the square, take both roots, add 2.5 back. No formula was needed and none was memorised.

      (x−2.5)2=0.25 ⟹ x−2.5=±0.5 ⟹ x=2  or  x=3(x-2.5)^2=0.25\ \Longrightarrow\ x-2.5=\pm0.5\ \Longrightarrow\ x=2\ \ \text{or}\ \ x=3
    3. Now the discriminant. Here Δ = 1, and it is positive, so there are two real roots. That is the part every textbook mentions.

      Δ=b2−4ac=25−24=1\Delta=b^2-4ac=25-24=1
    4. It appears twice more, and neither is usually said out loud. The gap between the roots is √Δ/|a|, because the ± in the formula contributes ±√Δ/2a to each one. And the vertex sits Δ/4a below the axis — the −0.25 on the panel above is not an independent result, it is the discriminant again, divided by four.

      x2−x1=Δ∣a∣=1,yV=−Δ4a=−0.25x_2-x_1=\frac{\sqrt{\Delta}}{|a|}=1,\qquad y_V=-\frac{\Delta}{4a}=-0.25
    5. Vieta's relations close the loop. Expand a(x − x₁)(x − x₂), match it term by term against ax² + bx + c, and the sum and product of the roots fall out without solving anything.

      x1+x2=−ba=5,x1x2=ca=6x_1+x_2=-\frac{b}{a}=5,\qquad x_1x_2=\frac{c}{a}=6

    Answer

    The roots are x = 2 and x = 3, and the tool prints the vertex at (2.5, −0.25) from the same completion. The payoff is that one number governs three separate facts. Δ = 1 makes the roots real, sets them exactly 1 apart, and drops the vertex exactly 0.25 below the axis. Raise c towards 6.25 and watch all three go together: the roots slide in, the gap closes as √Δ, and the parabola rises until it touches the axis at Δ = 0. They were never three coincidences — they are one quantity seen from three directions.

    x=2, 3Δ=1: separation Δ=1, depth Δ4a=0.25x=2,\ 3\qquad \Delta=1:\ \text{separation}\ \sqrt{\Delta}=1,\ \text{depth}\ \tfrac{\Delta}{4a}=0.25
  2. The formula, answer in surds 4 steps

    Solve 2x² − 3x − 4 = 0, giving the roots in exact form.

    Open this problem in the tool

    Show solution
    1. Read off a, b and c with their signs. Most lost marks in this question are lost here.

      a=2,b=−3,c=−4a=2,\quad b=-3,\quad c=-4
    2. The discriminant first. It is positive and not a square, so there are two real roots and both are irrational.

      b2−4ac=(−3)2−4(2)(−4)=9+32=41b^{2}-4ac=(-3)^{2}-4(2)(-4)=9+32=41
    3. Into the formula. 41 has no square factor, so √41 stays as it is.

      x=3±414x=\frac{3\pm\sqrt{41}}{4}
    4. Decimals only at the end, and only if the question wants them.

      41≈6.4031:x≈2.3508,x≈−0.8508\sqrt{41}\approx6.4031:\qquad x\approx2.3508,\quad x\approx-0.8508

    Answer

    x = (3 ± √41)/4, about 2.3508 and −0.8508.

    x=3±414x=\frac{3\pm\sqrt{41}}{4}
  3. Completing the square when a ≠ 1 4 steps

    Write 2x² − 8x + 5 in the form a(x + p)² + q, give the turning point of y = 2x² − 8x + 5, and solve 2x² − 8x + 5 = 0 exactly.

    Open this problem in the tool

    Show solution
    1. Take the 2 out of the x terms only. The 5 stays outside.

      2x2−8x+5=2(x2−4x)+52x^{2}-8x+5=2(x^{2}-4x)+5
    2. Half of −4 is −2. Square it, add and subtract inside the bracket, then multiply the 2 back through the −4.

      =2[(x−2)2−4]+5=2(x−2)2−3=2\left[(x-2)^{2}-4\right]+5=2(x-2)^{2}-3
    3. A square is never negative, so the smallest value is −3, reached when the bracket is 0.

      (x−2)2≥0 ⇒ 2(x−2)2−3≥−3,x=2(x-2)^{2}\ge0\ \Rightarrow\ 2(x-2)^{2}-3\ge-3,\quad x=2
    4. Setting the completed form to zero needs only one square root.

      2(x−2)2=3 ⇒ x−2=±32=±62⇒ x=4±62\begin{aligned}&2(x-2)^{2}=3\ \Rightarrow\ x-2=\pm\sqrt{\tfrac32}=\pm\frac{\sqrt6}{2}\\&\Rightarrow\ x=\frac{4\pm\sqrt6}{2}\end{aligned}

    Answer

    2(x − 2)² − 3; turning point (2, −3), a minimum; x = (4 ± √6)/2.

    2(x−2)2−3,(2, −3),x=4±622(x-2)^{2}-3,\quad(2,\,-3),\quad x=\frac{4\pm\sqrt6}{2}
  4. A parameter and equal roots 4 steps

    Find the values of k for which x² + kx + 9 = 0 has equal roots. For which k does it have two distinct real roots?

    Open this problem in the tool

    Show solution
    1. Equal roots means a zero discriminant. Write it with k in it.

      b2−4ac=k2−4(1)(9)=k2−36b^{2}-4ac=k^{2}-4(1)(9)=k^{2}-36
    2. Solve for k.

      k2−36=0 ⇒ k=±6k^{2}-36=0\ \Rightarrow\ k=\pm6
    3. Check one of them. With k = 6 the quadratic is a perfect square, and its only root is −3.

      k=6:x2+6x+9=(x+3)2=0 ⇒ x=−3k=6:\quad x^{2}+6x+9=(x+3)^{2}=0\ \Rightarrow\ x=-3
    4. Two distinct roots need a positive discriminant, which holds outside the two values just found.

      k2−36>0  ⟺  k<−6 ∨ k>6k^{2}-36>0\iff k<-6\ \lor\ k>6

    Answer

    k = 6 or k = −6 for equal roots; two distinct real roots when k < −6 or k > 6.

    k=±6;k<−6 ∨ k>6k=\pm6;\qquad k<-6\ \lor\ k>6
  5. No real roots 3 steps

    Show that x² + 2x + 5 = 0 has no real roots, and find its complex roots.

    Open this problem in the tool

    Show solution
    1. The discriminant is negative.

      b2−4ac=22−4(1)(5)=4−20=−16<0b^{2}-4ac=2^{2}-4(1)(5)=4-20=-16<0
    2. The completed square says the same thing in a way you can see: the left side is never smaller than 4, so it is never 0. The parabola stays above the axis.

      x2+2x+5=(x+1)2+4≥4>0x^{2}+2x+5=(x+1)^{2}+4\ge4>0
    3. The formula still works with √−16 = 4i, and the two roots come as a conjugate pair.

      x=−2±−162=−2±4i2=−1±2ix=\frac{-2\pm\sqrt{-16}}{2}=\frac{-2\pm4i}{2}=-1\pm2i

    Answer

    Δ = −16 < 0, so no real roots; the complex roots are x = −1 ± 2i.

    x=−1±2ix=-1\pm2i
  6. A quadratic in disguise 3 steps

    Solve x⁴ − 5x² + 4 = 0.

    Open this problem in the tool

    Show solution
    1. Only x² and x⁴ appear, and x⁴ is (x²)². Call x² by another name.

      u=x2:u2−5u+4=0u=x^{2}:\qquad u^{2}-5u+4=0
    2. Now it is an ordinary quadratic in u. The tool solves this one.

      (u−4)(u−1)=0 ⇒ u=4, u=1(u-4)(u-1)=0\ \Rightarrow\ u=4,\ u=1
    3. Go back to x. Each positive value of u gives two values of x.

      x2=4 ⇒ x=±2,x2=1 ⇒ x=±1x^{2}=4\ \Rightarrow\ x=\pm2,\qquad x^{2}=1\ \Rightarrow\ x=\pm1

    Answer

    x = −2, −1, 1 or 2.

    x=−2, −1, 1, 2x=-2,\ -1,\ 1,\ 2
  7. A quadratic from its roots 3 steps

    Find a quadratic equation with integer coefficients whose roots are 2 + √3 and 2 − √3.

    Open this problem in the tool

    Show solution
    1. Add the roots: the surds cancel.

      (2+3)+(2−3)=4(2+\sqrt3)+(2-\sqrt3)=4
    2. Multiply them: a difference of two squares, and the surd goes again.

      (2+3)(2−3)=4−3=1(2+\sqrt3)(2-\sqrt3)=4-3=1
    3. A quadratic with leading coefficient 1 is x² minus the sum times x plus the product.

      x2−(x1+x2)x+x1x2=x2−4x+1x^{2}-(x_{1}+x_{2})x+x_{1}x_{2}=x^{2}-4x+1

    Answer

    x² − 4x + 1 = 0.

    x2−4x+1=0x^{2}-4x+1=0
  8. A model, and a root to reject 4 steps

    A ball is thrown so that its height after t seconds is h = 1.5 + 14t − 4.9t² metres. When does it reach the ground, and how high does it go?

    Open this problem in the tool

    Show solution
    1. The ground is h = 0. Written in the usual order, a = −4.9, b = 14 and c = 1.5.

      −4.9t2+14t+1.5=0-4.9t^{2}+14t+1.5=0
    2. The discriminant.

      b2−4ac=142−4(−4.9)(1.5)=196+29.4=225.4b^{2}-4ac=14^{2}-4(-4.9)(1.5)=196+29.4=225.4
    3. The formula gives two roots. The negative one is a time before the throw, where the model says nothing, so it is rejected.

      t=−14±225.4−9.8⇒ t≈2.9605,  t≈−0.1034\begin{aligned}&t=\frac{-14\pm\sqrt{225.4}}{-9.8}\\&\Rightarrow\ t\approx2.9605,\ \ t\approx-0.1034\end{aligned}
    4. The top of the flight is the turning point, a maximum because a is negative.

      t=−b2a=149.8≈1.4286h=1.5−1424(−4.9)=11.5\begin{aligned}&t=-\frac{b}{2a}=\frac{14}{9.8}\approx1.4286\\&h=1.5-\frac{14^{2}}{4(-4.9)}=11.5\end{aligned}

    Answer

    It lands after about 2.96 s and rises to 11.5 m, at t ≈ 1.43 s.

    t≈2.96 s;hmax⁡=11.5 mt\approx2.96\ \mathrm{s};\qquad h_{\max}=11.5\ \mathrm{m}

Supplementary problems, answers only

  1. Solve x² + 4x − 7 = 0, giving your answers in surd form.

    Show answer

    x = −2 ± √11

    x=−2±11x=-2\pm\sqrt{11}
  2. Write x² − 6x + 11 in the form (x − p)² + q and state its minimum value.

    Show answer

    (x − 3)² + 2; minimum 2, at x = 3

    (x−3)2+2,min⁡=2(x-3)^{2}+2,\quad\min=2
  3. Find k if 2x² − 4x + k = 0 has equal roots.

    Show answer

    k = 2

    k=2k=2
  4. Find the values of k for which x² + 2kx + 9 = 0 has no real roots.

    Show answer

    −3 < k < 3

    −3<k<3-3<k<3
  5. Solve 3x² − 5x − 2 = 0.

    Show answer

    x = 2 or x = −1/3

    x=2,  x=−13x=2,\ \ x=-\tfrac13
  6. Solve x² + 6x + 13 = 0.

    Show answer

    x = −3 ± 2i

    x=−3±2ix=-3\pm2i
  7. Solve 4ˣ − 6 × 2ˣ + 8 = 0.

    Show answer

    x = 1 or x = 2

    x=1,  x=2x=1,\ \ x=2

Learning path

Beyond the quadratic