Quadratic Equation Solver
Solve ax²+bx+c=0 and find real or complex roots.
About the Quadratic Equation Solver
The quadratic equation solver finds the roots of any equation of the form ax² + bx + c = 0, where a, b, and c are real coefficients and a is not zero. Quadratic equations appear throughout physics, engineering, finance, and optimisation: projectile motion, break-even analysis, area calculations, and many other problems reduce to a quadratic at some point in their solution.
Every quadratic equation has exactly two roots in the complex plane, which may be real and distinct, real and equal (a repeated root), or a complex conjugate pair. The nature of the roots is determined entirely by the discriminant b² - 4ac: a positive discriminant gives two real roots, a zero discriminant gives one repeated real root, and a negative discriminant gives two complex roots. This solver detects all three cases and formats the output accordingly.
The tool uses the standard quadratic formula derived by completing the square. It runs entirely in your browser, handles negative and fractional coefficients, and presents the discriminant alongside the roots so you can see exactly why the result came out the way it did.
How It Works
The solver applies the quadratic formula, which gives the roots of ax² + bx + c = 0 directly:
x = (-b +/- sqrt(b^2 - 4ac)) / (2a)
The expression under the square root, b² - 4ac, is called the discriminant and is denoted by the Greek letter delta. Its sign determines the nature of the roots:
Discriminant > 0 : two real distinct roots
Discriminant = 0 : one real repeated root (the parabola touches the x-axis)
Discriminant < 0 : two complex conjugate roots
For a positive discriminant, both roots are computed by taking the plus and minus branches of the formula. For a zero discriminant, both branches give the same value, so the root is reported once. For a negative discriminant, the square root of a negative number is handled by factoring out the imaginary unit i, giving a complex conjugate pair x = (-b / 2a) +/- (sqrt(|discriminant|) / 2a) * i.
The formula is derived by completing the square on the general quadratic. Starting from ax² + bx + c = 0, divide by a, move c to the right, add (b/2a)² to both sides, factor the left as a perfect square, take the square root of both sides, and isolate x. The result is the quadratic formula shown above.
Worked Examples
Using the default values a = 1, b = -5, c = 6, the discriminant is (-5)² - 4*1*6 = 25 - 24 = 1, which is positive, so there are two real roots. Applying the formula: x = (5 +/- sqrt(1)) / 2, giving x1 = (5 + 1) / 2 = 3 and x2 = (5 - 1) / 2 = 2. Both roots are integers, which confirms that x² - 5x + 6 factors neatly as (x - 2)(x - 3).
For a repeated root, try a = 1, b = -4, c = 4. The discriminant is 16 - 16 = 0, so the parabola touches the x-axis at exactly one point: x = 4 / 2 = 2. This corresponds to the perfect square (x - 2)² = 0.
For complex roots, try a = 1, b = 2, c = 5. The discriminant is 4 - 20 = -16, which is negative. The real part is -b / 2a = -1, and the imaginary part is sqrt(16) / 2 = 2. The roots are x = -1 +/- 2i, a complex conjugate pair. The parabola does not cross the x-axis, which is consistent with a quadratic that is always positive.
When to Use This Tool
The quadratic solver is useful whenever a problem reduces to a second-degree polynomial:
- Computing the trajectory of a projectile under uniform gravity.
- Finding the break-even point in a quadratic cost or revenue model.
- Determining the dimensions of a rectangle with a given area and perimeter relationship.
- Optimising a quadratic objective function in business or engineering.
- Solving kinematics problems in introductory physics courses.
- Factoring quadratics by first finding their roots.
- Verifying hand calculations in algebra homework.
Limitations & Disclaimer
This solver handles only quadratic equations with real coefficients. It does not solve cubic, quartic, or higher-degree polynomials, nor does it perform symbolic factoring or display the factored form of the polynomial. Roots are displayed numerically to six decimal places and may be subject to floating-point rounding for extreme coefficient values. For symbolic algebra, use a dedicated computer algebra system. See our disclaimer for full details.
Frequently Asked Questions
What is the discriminant and why does it matter?
The discriminant is the value b squared minus 4ac, the expression under the square root in the quadratic formula. Its sign tells you the nature of the roots without solving the equation: positive means two real roots, zero means one repeated root, and negative means two complex roots.
What are complex roots?
When the discriminant is negative, the square root of a negative number is not a real number. The solver factors out the imaginary unit i, defined as the square root of -1, and reports the roots as a complex conjugate pair. Complex roots always come in conjugate pairs when the coefficients are real.
Why can coefficient a not be zero?
If a is zero, the equation becomes bx + c = 0, which is linear rather than quadratic. Linear equations have a single root x = -c / b. The solver rejects a = 0 with an error rather than dividing by zero and producing a misleading result.
How is the quadratic formula derived?
By completing the square. Starting from ax squared plus bx plus c equals zero, divide by a, isolate the constant, add (b divided by 2a) squared to both sides to create a perfect square on the left, take the square root of both sides, and solve for x. The result is the standard quadratic formula.
Does the solver handle fractional or decimal coefficients?
Yes. Any real numbers are accepted for a, b, and c. The step attribute on the input fields is set to 0.1 to allow decimal entry, and the formula works identically for integer or fractional inputs.
Can the roots be irrational?
Yes. Whenever the discriminant is positive but not a perfect square, the roots involve a surd and cannot be expressed as terminating or repeating decimals. The solver displays them to six decimal places, which is enough for most practical purposes.
Last updated: July 21, 2026 · Author: HT99 Tools Editorial Team · Reviewed by: HT99 Tools Editorial Team