All topics
Foundational

Algebra · the equation that bends

Quadratic Formula Calculator

Type in the three numbers of a quadratic and the calculator below returns both roots, the discriminant and the turning point, and draws the curve they belong to. One formula, written down a thousand years ago, solves every equation of this shape.

Click to begin

Explained like you're twelve. Explained like you've just finished school. Explained like you're at university.

By . Last updated .

Algebra · Brahmagupta, 628

Three numbers in, two answers out, and a curve that explains why.

Quadratic formula calculator

For \(ax^2 + bx + c = 0\) with \(a \neq 0\), the roots are \(x = \dfrac{-b \pm \sqrt{b^2 - 4ac}}{2a}\). The part under the square root, \(b^2 - 4ac\), is the discriminant, and it decides how many real answers there are.

Root x₁
Root x₂
Discriminant
Vertex

The roots are where the curve crosses the horizontal axis, so the discriminant is really a question about geometry: a positive value means the parabola cuts the axis twice, zero means it just touches, and a negative value means it misses entirely and the two answers are complex.

What is a quadratic equation?

A quadratic is any sum where the biggest power of the unknown is a square. Something like \(x^2 - 3x + 2 = 0\). You are looking for the number, or numbers, you could put in place of \(x\) to make the whole thing come out at zero.

Guessing works occasionally. For that example, 1 and 2 both do the job. But guessing falls apart the moment the numbers stop being tidy, and there is no need for it, because somebody worked out a recipe that always tells you the answer.

The recipe takes the three numbers in front of the equation, the one on the square, the one on the plain \(x\), and the lonely one at the end. Those are called a, b and c. Feed them into the formula and out come the answers. That is exactly what the calculator above is doing.

There is also a picture behind all this. If you plot a quadratic you get a smooth U-shaped curve called a parabola, the same shape a ball makes when you throw it. The answers you are hunting for are the spots where that U crosses the line at zero. Sometimes it crosses twice, sometimes it just kisses the line once, and sometimes it floats clear and never touches, which is why some quadratics have no ordinary answer at all.

How do you use the quadratic formula?

Write the equation in the standard form \(ax^2 + bx + c = 0\), where \(a\), \(b\) and \(c\) are constants and \(a \neq 0\). The solutions come from the quadratic formula

\[ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}. \]

The \(\pm\) is doing the work of two calculations at once: add the square root for one root, subtract it for the other. Everything interesting sits inside the root, in the quantity \(\Delta = b^2 - 4ac\), the discriminant. If \(\Delta > 0\) there are two distinct real roots. If \(\Delta = 0\) the two roots collide into one repeated root at \(x = -b/2a\). If \(\Delta < 0\) the square root is of a negative number, so the roots are a complex conjugate pair and the parabola never meets the axis.

The formula is not magic, it is completing the square done once in general. Divide through by \(a\), move the constant across, add \((b/2a)^2\) to both sides so the left becomes a perfect square, then take the root. The turning point falls out of the same rearrangement: the vertex sits at \(x = -b/2a\), midway between the roots, and its height is \(c - b^2/4a\).

In practice you meet this most often as a physics question in disguise. The height of a thrown object is quadratic in time, so asking when it lands means solving \(-\tfrac12 g t^2 + v_0 t + h = 0\), which is why one of the presets above looks like a ball in flight. Two roots come back, one negative, and you keep the positive one because time before the throw is not part of the problem.

The discriminant and the geometry of the roots

Where the formula comes from

Completing the square is the whole derivation. From \(ax^2+bx+c=0\), factor out \(a\) and rewrite as \(a\big[(x + \tfrac{b}{2a})^2 - \tfrac{b^2-4ac}{4a^2}\big] = 0\), which exposes both the vertex and the discriminant in one line. Historically the pieces arrived separately: Babylonian scribes solved specific quadratics geometrically by around 1800 BCE, Brahmagupta gave an explicit general rule in 628 CE that admitted negative quantities, and al-Khwārizmī classified the cases around 820 because negative coefficients were not yet accepted as legitimate. The single symbolic formula we now write is a much later convenience, resting on Viète's use of letters for coefficients and on Descartes' notation.

The discriminant and the shape of the root set

\(\Delta = b^2 - 4ac\) is the simplest case of a general object. For any polynomial the discriminant vanishes exactly when it has a repeated root, and its sign encodes how the real roots are arranged. For the quadratic that gives the three familiar regimes, and it also explains a fact that is easy to miss: the roots are symmetric about \(x = -b/2a\) whatever \(\Delta\) does, because \(\pm\sqrt{\Delta}/2a\) is a displacement either side of that midpoint. When \(\Delta < 0\) the displacement simply becomes imaginary, and the pair sits vertically in the complex plane instead of horizontally on the real line.

Vieta, and reading roots without solving

Expanding \(a(x-x_1)(x-x_2)\) and matching coefficients gives Vieta's relations, \(x_1 + x_2 = -b/a\) and \(x_1 x_2 = c/a\). They let you check an answer instantly and they generalise: for a polynomial of any degree, the elementary symmetric functions of the roots are the coefficients up to sign. That observation is the seed of Galois theory, which eventually explains why a formula like this one exists for degrees 2, 3 and 4 but cannot exist in radicals for degree 5 and above.

Numerical care

The textbook formula is unstable when \(b^2 \gg 4ac\). The root computed as \((-b + \sqrt{\Delta})/2a\) then subtracts two nearly equal numbers, and catastrophic cancellation eats most of the significant digits. The standard fix is to compute \(q = -\tfrac12\big(b + \operatorname{sgn}(b)\sqrt{\Delta}\big)\), which always adds quantities of the same sign, then take \(x_1 = q/a\) and \(x_2 = c/q\) using Vieta's product relation for the second root. Serious numerical libraries all do this, and it is a good illustration that an exact formula and a reliable algorithm are not the same thing.

Related: The Pythagorean Theorem · Projectile Motion · or go back to all topics.

Sources