Math & Trig
Solve a quadratic equation (ax^2 + bx + c = 0) with LET and SQRT
Calculate the discriminant b^2 - 4ac, guard complex/linear cases cleanly, and compute both real roots (-b ± SQRT(d)) / (2a).
Test the discriminant d = b^2 - 4ac before calling SQRT
For ax^2 + bx + c = 0, the discriminant d = b^2 - 4ac governs the roots: d > 0 produces two distinct real roots, d = 0 produces one repeated root (-b / 2a), and d < 0 has no real roots (SQRT(d) would return #NUM!).
Binding d = B2^2 - 4*A2*C2 inside LET tests A2=0 (linear equation) and d<0 ("No real roots") cleanly before computing (-B2 + SQRT(d)) / (2*A2) and (-B2 - SQRT(d)) / (2*A2).
| a (A) | b (B) | c (C) | Discriminant d | Real Roots (x1, x2) |
|---|---|---|---|---|
| 2 | -10 | 12 | 100 - 96 = 4 | x1 = 3, x2 = 2 |
| 1 | -6 | 9 | 36 - 36 = 0 | x1 = 3, x2 = 3 |
| 1 | 2 | 5 | 4 - 20 = -16 | "No real roots" |
Quadratic root 1 (+SQRT) and root 2 (-SQRT) formulas
For 2x^2 - 10x + 12 = 0, d = 4 -> x1 = (10 + 2) / 4 = 3 and x2 = (10 - 2) / 4 = 2.
=LET(d, B2^2 - 4 * A2 * C2, IF(A2=0, "Not quadratic", IF(d<0, "No real roots", ROUND((-B2 + SQRT(d)) / (2 * A2), 4))))Second quadratic root (-SQRT)
Change + SQRT(d) to - SQRT(d) to compute the smaller root (when a > 0).
=LET(d, B2^2 - 4 * A2 * C2, IF(A2=0, "Not quadratic", IF(d<0, "No real roots", ROUND((-B2 - SQRT(d)) / (2 * A2), 4))))Inputs and interpretation
Use finite numeric coefficients. A zero leading coefficient is reported as Not quadratic, including degenerate cases; this formula does not solve the remaining linear equation. Near-zero discriminants and subtraction of nearly equal numbers can suffer floating-point error, especially with very large or small coefficients. The rounded demonstration is not a numerically stable general-purpose solver; retain full precision for downstream work.
Try the example
Use the original values or change them to test your understanding.