Understanding the quadratic equation solver — concept and principle
A quadratic equation has the form ax² + bx + c = 0 with a ≠ 0. Its graph is a parabola, and its roots are the x-values where the parabola crosses or touches the x-axis. Quadratics appear in projectile motion, area and optimisation problems and break-even analysis. This solver gives both roots (real or complex), the discriminant, the vertex of the parabola and the type of roots.
How it is calculated
- Discriminant: D = b² − 4ac.
- Roots: x = (−b ± √D) ÷ (2a). If D < 0, the roots are complex: x = −b/(2a) ± (√(−D) ÷ 2|a|)·i.
- Vertex: (−b/(2a), c − b²/(4a)), the turning point of the parabola y = ax² + bx + c.
- Root type: D > 0 two real roots, D = 0 one repeated root, D < 0 two complex conjugate roots.
If you enter a = 0 the equation is linear, and the solver returns x = −c/b instead.
The principle
The formula comes from completing the square. Divide by a and rewrite: x² + (b/a)x = −c/a. Add (b/2a)² to both sides so the left side becomes a perfect square: (x + b/2a)² = (b² − 4ac)/(4a²). Taking the square root of both sides gives x + b/2a = ±√D/(2a), which is the quadratic formula. The discriminant is the quantity under the square root, so its sign decides whether real square roots exist.
Worked example
- Inputs: a = 1, b = −3, c = 2, so the equation is x² − 3x + 2 = 0.
- D = (−3)² − 4 × 1 × 2 = 9 − 8 = 1.
- √D = 1, so x = (3 ± 1) ÷ 2, giving 2 and 1.
- Vertex x = −(−3) ÷ 2 = 1.5; vertex y = 2 − 9 ÷ 4 = −0.25, so the vertex is (1.5, −0.25).
- D > 0, so there are two real roots. Check: (x − 1)(x − 2) = x² − 3x + 2.
How to read the result
The sum of the roots is −b/a and their product is c/a (Vieta's formulas): here 2 + 1 = 3 and 2 × 1 = 2. If a > 0 the parabola opens upward and the vertex is its minimum; if a < 0 it opens downward and the vertex is a maximum. A discriminant close to zero means the two roots are close together and are sensitive to small changes in the coefficients.
Common mistakes
- Dropping the sign of b: with b = −3, −b is +3.
- Forgetting to bring every term to one side before reading a, b and c.
- Dividing only √D by 2a instead of the whole numerator −b ± √D.
- Treating complex roots as "no solution"; they are valid roots, but the graph does not touch the x-axis.
Frequently asked questions
What if the discriminant is negative?
The equation has no real roots; the parabola stays entirely above or below the x-axis. The roots are complex conjugates p ± qi.
Can I factor instead of using the formula?
Yes, when the roots are rational. Look for two numbers whose product is ac and sum is b. The formula always works.
How do I find the axis of symmetry?
It is the vertical line x = −b/(2a), which passes through the vertex and lies halfway between the roots.
Sources: M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions, NBS Applied Mathematics Series 55, §3.8.1 · W. H. Press et al., Numerical Recipes, Cambridge University Press, §5.6 Quadratic and Cubic Equations