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

Ready to run the numbers?

Open Quadratic Formula Solver