Quadratic Formula Solver Formula

Understand the math behind the quadratic formula solver. Each variable explained with a worked example.

Formulas Used

Discriminant

discriminant = pow(b, 2) - 4 * a * c

Root1

root1 = a != 0 ? (-b + sqrt(abs(pow(b, 2) - 4 * a * c))) / (2 * a) : 0

Root2

root2 = a != 0 ? (-b - sqrt(abs(pow(b, 2) - 4 * a * c))) / (2 * a) : 0

Vertex X

vertex_x = a != 0 ? -b / (2 * a) : 0

Vertex Y

vertex_y = a != 0 ? c - pow(b, 2) / (4 * a) : 0

Variables

VariableDescriptionDefault
aCoefficient a1
bCoefficient b-5
cCoefficient c6

How It Works

How to Solve a Quadratic Equation

Quadratic Formula

x = (-b ± sqrt(b² - 4ac)) / (2a)

For the equation ax² + bx + c = 0:

1. Calculate the discriminant: D = b² - 4ac 2. If D > 0: two distinct real roots 3. If D = 0: one repeated real root 4. If D < 0: no real roots (complex roots)

Vertex

The vertex of the parabola is at x = -b/(2a), y = c - b²/(4a).

Worked Example

Solve x² - 5x + 6 = 0.

a = 1b = -5c = 6
  1. 01D = (-5)² - 4(1)(6) = 25 - 24 = 1
  2. 02x₁ = (5 + √1) / 2 = 6/2 = 3
  3. 03x₂ = (5 - √1) / 2 = 4/2 = 2
  4. 04Roots are x = 3 and x = 2

Frequently Asked Questions

What is the quadratic formula?

x = (-b ± √(b² - 4ac)) / (2a). It gives the solutions to any quadratic equation ax² + bx + c = 0.

What does the discriminant tell you?

The discriminant (b² - 4ac) reveals the nature of the roots: positive means two real roots, zero means one repeated root, negative means complex roots.

What if a = 0?

If a = 0, the equation is linear (bx + c = 0), not quadratic. The solution is x = -c/b.

Learn More

Guide

How to Solve Quadratic Equations - Complete Guide

Learn how to solve quadratic equations using factoring, the quadratic formula, and completing the square. Step-by-step methods with worked examples.

Ready to run the numbers?

Open Quadratic Formula Solver