Quadratic Formula Calculator
Type any quadratic equation, or enter a, b and c, and this quadratic formula calculator with steps gives the exact roots, the decimal roots, the discriminant, a graph and a checked answer.
⚡ 0. Quick Answer
A quadratic formula calculator solves ax² + bx + c = 0 by putting a, b and c into one formula.
Example: for 3x² − 5x − 2 = 0, a = 3, b = −5 and c = −2. The discriminant is 25 + 24 = 49, so x = (5 ± 7) ÷ 6. The roots are x = 2 and x = −13.
Rule of thumb: look at D = b² − 4ac first. If D is positive there are 2 real roots, if D = 0 there is 1 repeated root, and if D is negative there are no real roots, only 2 complex ones.
Key Takeaways
- The quadratic formula calculator works for every quadratic equation, including ones that cannot be factored.
- Rearrange to ax² + bx + c = 0 first, so the right side is 0.
- The discriminant D = b² − 4ac tells you how many real roots to expect before you finish.
- Divide the whole numerator by 2a, not only the −b part.
- Check every answer: the roots must add to −b ÷ a and multiply to c ÷ a.
📚 1. What Is a Quadratic Formula Calculator?
A quadratic formula calculator is a tool that finds the roots of a quadratic equation. A quadratic equation is any equation that can be written as ax² + bx + c = 0, where a is not 0. The roots (also called solutions or zeros) are the values of x that make the equation true.
The quadratic formula is x = (−b ± √(b² − 4ac)) ÷ 2a. You read off three numbers, a, b and c, and the formula returns the roots. It never fails, which is why it is the method most students trust in an exam.
A worked one-liner: in 3x² − 5x − 2 = 0 we have a = 3, b = −5, c = −2. Then b² − 4ac = 25 + 24 = 49, √49 = 7, and x = (5 ± 7) ÷ 6. So x = 2 or x = −1/3.
What this calculator reports:
- Exact roots, as whole numbers, fractions, simplified square roots or complex numbers a ± bi.
- Decimal roots to 2, 4, 6 or 10 places.
- The discriminant and the nature of the roots.
- Every step, generated by the same code that computes the answer.
- A check: each root is substituted back into the equation.
- The graph facts: vertex, axis of symmetry, y-intercept, factored form and vertex form.
Who uses it: students in Algebra 1, Algebra 2, GCSE, IGCSE, CBSE Class 10, SAT and ACT courses; teachers building answer keys; and engineers, physicists and programmers who need a quick exact root for a projectile, an area or a break-even problem.
Formula, factoring or completing the square? All three solve the same equation. They differ in when they are fastest.
| Method | How it works | Best when | Weak point |
|---|---|---|---|
| Quadratic formula | Put a, b, c into one formula | Always. Needed when D is not a perfect square | More arithmetic, sign slips with −b |
| Factoring | Write as (px + q)(rx + s) = 0 | D is a perfect square and the numbers are small | Fails when the roots are irrational or complex |
| Completing the square | Rewrite as (x + p)² = q | You also need the vertex, or a = 1 and b is even | Fractions appear quickly |
| Graphing | Read where the curve meets the x axis | You want a picture or an estimate | Gives decimals only, never exact surds |
The formula itself comes from completing the square on ax² + bx + c = 0 once, with letters. Methods for solving quadratics go back to Babylonian tablets and to al-Khwarizmi's algebra in the 9th century (Gandz, 1937; Katz, 2007).
🧮 2. Enter Your Problem
Type it the way you would write it: 3x^2 - 5x - 2 = 0, x^2 = 5x - 6, or 3(x+1)^2 = 12. Spaces are optional, 2x means 2 × x, and you do not have to rearrange it first. Any single letter works as the variable.
This is the abc form: ax² + bx + c = 0. Fractions such as 3/4 and decimals such as 0.75 both work. Decimals are turned into exact fractions before solving. Type 0 for a missing term.
Enter three points on a parabola. The calculator finds y = ax² + bx + c through them, then solves ax² + bx + c = 0.
Teachers use this to build an answer key. Paste or upload up to 500 problems, press Solve, then Download Doc for every answer with its working.
Nothing is calculated until you press Solve. Sample 1 is loaded so you can see the format.
📊 3. Results and Step-by-Step Solution
🧠 4. Understanding Your Answer, In Detail
4.1 What the answer means
___ Solve a problem above to fill this in with your own numbers.
A root is a number you can put in place of x so that the left side of the equation becomes exactly 0. A quadratic has at most two of them. If you draw y = ax² + bx + c, the real roots are the x values where the curve touches or crosses the horizontal axis.
4.2 What the discriminant tells you
___ Solve a problem above.
The discriminant is D = b² − 4ac, the part of the quadratic formula under the square root. Its sign decides the type of answer, so work it out first.
| Discriminant | Roots | Graph | Can you factor it? |
|---|---|---|---|
| D > 0 and a perfect square | 2 real, rational | Crosses the axis twice | Yes, with whole numbers or fractions |
| D > 0, not a perfect square | 2 real, irrational (surds) | Crosses the axis twice | No, use the formula |
| D = 0 | 1 repeated real root | Touches the axis at the vertex | Yes, it is a perfect square |
| D negative | 2 complex conjugates, no real roots | Never meets the axis | Not over the real numbers |
4.3 Exact answer or decimal answer
___ Solve a problem above.
An exact answer such as (3 + √13) ÷ 4 is the true root. A decimal such as 1.6514 is a rounded copy of it. Use the exact form in algebra, proofs and "leave your answer in surd form" questions. Use the decimal form for lengths, times, money and anything you will measure or plot.
4.4 What the graph shows
___ Solve a problem above.
The vertex is at x = −b ÷ 2a, the first half of the quadratic formula. The second half, √D ÷ 2a, is how far each root sits to the left and right of that line. That is why the two roots are always mirror images about the axis of symmetry.
4.5 How the answer changes when c changes
___ Solve a problem above.
Changing c slides the whole parabola up or down without changing its shape. Slide an upward parabola high enough and it lifts off the axis: the two roots move together, meet, and then stop being real.
4.6 How to check the answer yourself
There are two quick checks. First, substitute each root back into the original equation and confirm you get 0. Second, use the sum and product rules: the roots must add to −b ÷ a and multiply to c ÷ a. For 3x² − 5x − 2 = 0 the roots 2 and −1/3 add to 5/3 and multiply to −2/3, which matches −(−5) ÷ 3 and −2 ÷ 3.
4.7 Special cases
- a = 0: the equation is linear, not quadratic. The formula would divide by 0. Solve bx + c = 0 instead.
- b = 0: ax² + c = 0 gives x = ±√(−c ÷ a). The roots are equal and opposite.
- c = 0: one root is always 0. Factor out x: x(ax + b) = 0. Never divide both sides by x, or you lose that root.
- Very large or very small coefficients: on a computer the plain formula can lose digits when b² is much bigger than 4ac. This calculator uses exact integer arithmetic, so it does not have that problem (Goldberg, 1991; Forsythe, 1970).
4.8 Where this leads next
The same discriminant idea returns in conic sections, in the roots of cubic equations, and in physics whenever a quantity depends on time squared. If you are comfortable reading D, you can tell how many times a ball reaches a given height or whether a line meets a circle before you calculate anything.
✍ 5. How to Write the Answer
▶ Solve a problem above and all five cards fill in with your own answer.
Conventions for this style
- Write the formula once in letters before you substitute. Many mark schemes give a mark for it.
- Show the discriminant on its own line.
- Leave surds exact unless told to round.
Conventions for this style
- Use "or" between the roots, not "and". x cannot be both at once.
- Set notation {r₁, r₂} is also accepted.
- For a repeated root, write the value once and say "repeated".
Conventions for this style
- One line per problem keeps a key easy to scan.
- Including D lets you award a method mark even when the final answer is wrong.
Conventions for this style
- State the method and give decimals to a sensible number of places, usually 2 to 4.
- In a physics problem, reject any root that has no physical meaning, such as a negative time, and say why.
Conventions for this style
- Uses ^ for powers and sqrt() for square roots, so it pastes cleanly anywhere.
- +/- stands for the plus or minus sign.
∑ 6. Formulas Used
🔀 7. Quadratic Formula Flowchart, Step by Step
This flowchart shows how the quadratic formula is applied step by step, from the raw equation to checked roots. Every box carries the worked number for 3x² − 5x − 2 = 0, the same example used in the Excel, R, Python and by-hand sections.
Check any box yourself: the Excel sheet in Section 9, the R script in Section 10 and the Python script in Section 11 all return x = 2 and x = −0.3333. Section 14 does the same problem by hand and on a Casio or TI calculator.
📝 8. How to Use This Calculator
- Choose how to enter the problem. Pick a tab: Type the Equation, Enter a, b, c, From 3 Points, or Batch (CSV).
- Type your quadratic equation. Write it as you would on paper, for example 3x^2 - 5x - 2 = 0. You do not need to rearrange it first.
- Or load a sample problem. Open the Sample problem list and choose one of the ten named examples to see the format.
- Set the decimal places. Choose 2, 4, 6 or 10 decimal places for the rounded roots.
- Choose the answer form and number system. Keep Exact and decimal for surds and fractions, and switch to Real numbers only if your course does not use complex numbers.
- Press Solve. Nothing is calculated until you press Solve or press Enter in an input box.
- Read the answer box. The exact roots come first, the decimals under them, with a badge for the type of roots and a Verified badge.
- Follow the step-by-step solution. Each step shows one move: standard form, the discriminant, the quadratic formula, the two roots and the check.
- Study the table and the four charts. See the vertex, axis of symmetry, factored form and vertex form, and look at the graph with the roots marked.
- Download or copy the working. Use Download Doc for a text file with every step, Download PDF to print, or the Copy buttons in Section 5.
📈 9. How to Do the Quadratic Formula in Excel
Excel has no single quadratic function, but the formula fits in two short cells. Put a, b and c in one row, work out the discriminant, then write one formula for each root. The steps below use the same example as the rest of the page, 3x² − 5x − 2 = 0. They work the same way in Google Sheets.
=(-B2+SQRT(B2^2-4*A2*C2))/(2*A2) for the first root and change the first + to − for the second.9.1 The functions you need
| You want | Excel formula | Note |
|---|---|---|
| Discriminant | =B2^2-4*A2*C2 | Keep it in its own cell so you can see its sign |
| Root with + | =(-B2+SQRT(D2))/(2*A2) | Brackets around 2*A2 are essential |
| Root with − | =(-B2-SQRT(D2))/(2*A2) | Same formula, one sign changed |
| Vertex x | =-B2/(2*A2) | Also the axis of symmetry |
| Vertex y | =C2-B2^2/(4*A2) | Minimum or maximum value |
| Complex roots | =IMDIV(IMSUM(-B2,IMSQRT(D2)),2*A2) | Works when D is negative |
| No-error version | =IFERROR((-B2+SQRT(D2))/(2*A2),"no real root") | Replaces #NUM! with a message |
| Exact fraction display | Format Cells, Fraction, Up to two digits | Shows −0.3333 as −1/3 |
9.2 Step by step
1 Type a, b and c in one row
Put the labels a, b, c in A1:C1 and the numbers 3, −5 and −2 in A2:C2. Type each number with its own sign.
The coefficients of 3x² − 5x − 2 = 0 are in A2:C2: 3, −5, −2.
2 Work out the discriminant in D2
Click D2 and type the discriminant formula. Excel squares B2 first, so the sign of b is handled correctly here.
=B2^2-4*A2*C2
D2 shows 49. It is positive, so there are two real roots.
3 Write the first root in E2
Use the + sign. The brackets around the top line and around 2*A2 are what students most often leave out.
=(-B2+SQRT(D2))/(2*A2)
E2 returns 2, the first root.
4 Write the second root in F2
Copy the formula and change the + before SQRT to a minus sign.
=(-B2-SQRT(D2))/(2*A2)
F2 returns −0.3333, which is −1/3. Format the cell as a fraction to see it exactly.
5 Check both roots
In G2 and H2 substitute each root back into the equation. Both cells must show 0, or a tiny number such as −2.2E-16 that comes from rounding inside Excel. Format the cells to 4 decimal places and both read 0.0000.
=$A2*E2^2+$B2*E2+$C2
G2 and H2 both show 0.0000, so x = 2 and x = −1/3 are verified.
9.3 The awkward cases
- Negative discriminant.
SQRTof a negative number returns#NUM!. Use=IMDIV(IMSUM(-B2,IMSQRT(D2)),2*A2), which returns text such as −1+2i. For the second root useIMSUBin place ofIMSUM. - a = 0. The formula divides by 2*A2 and returns
#DIV/0!. That is correct: the equation is linear. - Huge b compared with a and c. Excel keeps about 15 significant digits. For x² − 1000000x + 1 = 0 the small root comes out as 1.00000761E-06 where the true value is 1.000000000001E-06, so the sixth digit is already wrong. Use the stable form: put
=-(B2+SIGN(B2)*SQRT(D2))/2in a helper cell q, then the roots are q/A2 and C2/q. - Many equations. Put one equation per row and fill the formulas down. That is a ready-made answer key.
- Goal Seek. Data, What-If Analysis, Goal Seek can also find a root, but it returns only the one nearest your starting guess, and only as a decimal.
9.4 Why Excel might disagree with R or Python
| Situation | What happens | Fix |
|---|---|---|
You type =-B2^2 or =-5^2 | Excel gives +25, because it applies the minus before the power. R, Python and paper algebra give −25 | Write =-(5^2) when you want −25. For b² with a negative b, =B2^2 is already right |
| A root shows 2 but the check cell shows 4.4E-16 | Floating-point storage, not a wrong answer | Treat anything below 1E-9 as 0, or wrap the check in ROUND(..., 10) |
| Rounding 2.5 or 0.125 | ROUND in Excel rounds half away from zero (2.5 becomes 3). R and Python round half to even (2.5 becomes 2) | Compare unrounded values, or round in one program only |
| Order of the two roots | Excel lists them in the order you wrote the formulas. numpy.roots and polyroot use their own order | Sort the roots before comparing |
| Complex roots | Excel returns text ("-1+2i"). R and Python return complex numbers | Use IMREAL and IMAGINARY to get numbers back |
=-5^2 is 25. On paper, in R and in Python, −5² is −25. In the quadratic formula you always want (−5)² = 25 for b², so referencing the cell (B2^2) is the safe habit.9.5 Charting it in Excel
Make a column of x values from about one unit left of the smaller root to one unit right of the larger root, in steps of 0.1. Next to it compute =$A$2*x^2+$B$2*x+$C$2. Select both columns and insert a Scatter with Smooth Lines chart. Do not use a Line chart: it spaces the x values evenly as labels and distorts the parabola. Then set the horizontal axis to cross at 0 so the roots are easy to read.
9.6 Excel errors you will probably hit
| Error | Cause | Fix |
|---|---|---|
#NUM! | D is negative, so SQRT fails | There are no real roots. Use the IMSQRT version |
#DIV/0! | a is 0 or the cell is empty | Enter a non-zero a, or solve the linear equation |
#VALUE! | A coefficient was typed as text, for example with a long dash instead of a minus sign | Retype the number with the keyboard minus key |
#NAME? | A misspelt function, such as SQR in place of SQRT | Check the spelling |
| Wrong answer, no error | Missing brackets around 2*A2, so only the square root is divided | Write /(2*A2) |
📈 10. How to Do the Quadratic Formula in R
R can solve a quadratic in one line with polyroot(), but writing the formula out shows the discriminant and the nature of the roots as well. The script below does both, checks the answer and draws the graph. It uses base R only, so there is nothing to install.
Rscript. Change only the three lines that set a, b and c.10.1 The complete script
R, base only, saves quadratic_formula_plot.png
# ============================================================
# Quadratic formula calculator in R (base R only)
# Solves a*x^2 + b*x + c = 0
# Worked example: 3x^2 - 5x - 2 = 0 -> x = -1/3 or x = 2
# ============================================================
# ---- 1. The problem: change only these three numbers ----
a <- 3
b <- -5
c <- -2
if (a == 0) stop("a must not be 0. With a = 0 the equation is linear.")
# ---- 2. Discriminant and nature of the roots ----
D <- b^2 - 4 * a * c
nature <- if (D > 0) {
"two different real roots"
} else if (D == 0) {
"one repeated real root"
} else {
"two complex conjugate roots (no real roots)"
}
# ---- 3. Roots with the quadratic formula ----
# as.complex() lets sqrt() return an imaginary number when D is negative
sqrtD <- sqrt(as.complex(D))
x1 <- (-b - sqrtD) / (2 * a)
x2 <- (-b + sqrtD) / (2 * a)
# ---- 4. Numerically stable version (avoids cancellation) ----
q <- -(b + ifelse(b >= 0, 1, -1) * sqrtD) / 2
s1 <- q / a
s2 <- if (q != 0) c / q else s1
# ---- 5. The same roots from polyroot(): ASCENDING order c, b, a ----
pr <- polyroot(c(c, b, a))
# ---- 6. Other results ----
h <- -b / (2 * a) # axis of symmetry
k <- c - b^2 / (4 * a) # vertex height
# ---- 7. Check by substituting back ----
f <- function(x) a * x^2 + b * x + c
residuals <- Mod(c(f(x1), f(x2)))
show <- function(z) if (abs(Im(z)) < 1e-12) format(round(Re(z), 4), nsmall = 4) else format(round(z, 4), nsmall = 4)
cat("Equation :", a, "x^2 +", b, "x +", c, "= 0\n")
cat("Discriminant : D =", D, "\n")
cat("Nature :", nature, "\n")
cat("Roots : x1 =", show(x1), ", x2 =", show(x2), "\n")
cat("Stable formula:", show(s1), ",", show(s2), "\n")
cat("polyroot() :", show(pr[1]), ",", show(pr[2]), "\n")
cat("Sum, product :", show(x1 + x2), "(= -b/a),", show(x1 * x2), "(= c/a)\n")
cat("Vertex : (", round(h, 4), ",", round(k, 4), ")\n")
cat("Check : residuals", signif(residuals[1], 3), "and", signif(residuals[2], 3), "\n")
verdict <- if (all(residuals < 1e-9)) "Verified" else "CHECK FAILED"
cat("Verdict :", verdict, "- result:", nature, "\n")
# ---- 8. One 300 dpi figure: parabola, roots, vertex, axis ----
half <- max(abs(Re(x2) - Re(x1)) * 0.9, 1.5)
xs <- seq(h - half, h + half, length.out = 400)
png("quadratic_formula_plot.png", width = 2100, height = 1350, res = 300)
plot(xs, f(xs), type = "l", lwd = 2.5, col = "#2563eb",
xlab = "x", ylab = "y", main = "Quadratic formula: roots, vertex and axis")
abline(h = 0, col = "#475569")
abline(v = h, col = "#9333ea", lty = 2)
points(h, k, pch = 18, cex = 1.8, col = "#9333ea")
if (D >= 0) points(c(Re(x1), Re(x2)), c(0, 0), pch = 19, cex = 1.5, col = "#16a34a")
grid(col = "#e5e7eb")
dev.off()
cat("Saved quadratic_formula_plot.png\n")
Expected output for the worked example: D = 49, roots x1 = −0.3333 and x2 = 2.0000, sum 1.6667, product −0.6667, vertex (0.8333, −4.0833), verdict Verified.
10.2 What each part does
| Code | What it does |
|---|---|
| D <- b^2 - 4 * a * c | The discriminant. In R, ^ is power and -5^2 is −25, so store b in a variable first |
| sqrt(as.complex(D)) | Plain sqrt(-16) returns NaN with a warning. as.complex makes it return 0+4i |
| (-b - sqrtD) / (2 * a) | The quadratic formula. The brackets around 2 * a matter |
| q <- -(b + sign * sqrtD) / 2 | The stable form, which avoids subtracting two nearly equal numbers |
| polyroot(c(c, b, a)) | Built-in root finder. Coefficients go in ascending order: constant first |
| Mod(f(x1)) | Size of the residual after substituting the root back. It should be about 0 |
| png(..., res = 300) | Opens a 300 dpi image file. dev.off() saves it |
10.3 What the figure shows
A blue parabola for y = 3x² − 5x − 2, a grey line at y = 0, green dots at the roots x = −1/3 and x = 2, a purple diamond at the vertex (0.8333, −4.0833), and a dashed purple axis of symmetry at x = 0.8333.
10.4 Common R problems and fixes
| Problem | Cause | Fix |
|---|---|---|
| Roots come out in a strange order or wrong | Coefficients given to polyroot as a, b, c | Use polyroot(c(c, b, a)) |
NaNs produced warning | sqrt() of a negative discriminant | Use sqrt(as.complex(D)) |
Result shows 2+0i | polyroot always returns complex numbers | Use Re() when Im() is about 0 |
| Root prints as 2.0000000000000004 | Floating-point rounding | Use round(x, 4) for display |
-5^2 gives −25 | Power is applied before the minus sign | Write (-5)^2 or store b first |
| You want −1/3, not −0.3333 | R works in decimals by default | MASS::fractions(x) shows the fraction |
round(2.5) gives 2 | R rounds half to even | Expected behaviour. Excel gives 3 |
10.5 Useful one-liners
| You want | R code |
|---|---|
| Both roots at once | polyroot(c(-2, -5, 3)) |
| Real parts only | Re(polyroot(c(-2, -5, 3))) |
| Discriminant | b^2 - 4*a*c |
| Roots as fractions | MASS::fractions(Re(polyroot(c(-2, -5, 3)))) |
| Vertex | c(-b/(2*a), c - b^2/(4*a)) |
| One root by search | uniroot(function(x) 3*x^2 - 5*x - 2, c(0, 5))$root |
📈 11. How to Do the Quadratic Formula in Python
Python gives you both kinds of answer. SymPy returns the exact roots, such as −1/3 or 2 − √3, and NumPy returns fast decimals. The script below prints both, checks them and saves the graph.
Install with pip install sympy numpy matplotlib if you do not already have them.
11.1 The complete script
Python 3 with SymPy, saves quadratic_formula_plot.png
# ============================================================
# Quadratic formula calculator in Python
# Solves a*x^2 + b*x + c = 0 exactly (SymPy) and in decimals
# Worked example: 3x^2 - 5x - 2 = 0 -> x = -1/3 or x = 2
# ============================================================
import cmath
import matplotlib
matplotlib.use("Agg") # remove this line in Jupyter or Colab
import matplotlib.pyplot as plt
import numpy as np
import sympy as sp
# ---- 1. The problem: change only these three numbers ----
a, b, c = sp.Rational(3), sp.Rational(-5), sp.Rational(-2)
if a == 0:
raise ValueError("a must not be 0. With a = 0 the equation is linear.")
# ---- 2. Discriminant and nature of the roots ----
D = b**2 - 4*a*c # ** is power in Python. ^ is XOR, not power.
if D > 0:
nature = "two different real roots"
elif D == 0:
nature = "one repeated real root"
else:
nature = "two complex conjugate roots (no real roots)"
# ---- 3. Exact roots with the quadratic formula ----
x1 = sp.simplify((-b - sp.sqrt(D)) / (2*a))
x2 = sp.simplify((-b + sp.sqrt(D)) / (2*a))
# ---- 4. Decimal roots, numerically stable (no cancellation) ----
af, bf, cf = float(a), float(b), float(c)
sqrtD = cmath.sqrt(bf*bf - 4*af*cf)
q = -(bf + (sqrtD if bf >= 0 else -sqrtD)) / 2
r1 = q / af
r2 = cf / q if q != 0 else r1
# ---- 5. Other results ----
h = -b / (2*a) # axis of symmetry
k = c - b**2 / (4*a) # vertex height
x = sp.symbols("x")
factored = sp.factor(a*x**2 + b*x + c)
def show(z):
"""Real numbers print as 2.0000, complex ones as -1.0000+2.0000j."""
return f"{z.real:.4f}" if abs(z.imag) < 1e-12 else f"{z:.4f}"
# ---- 6. Check by substituting back ----
res1 = sp.simplify(a*x1**2 + b*x1 + c)
res2 = sp.simplify(a*x2**2 + b*x2 + c)
print(f"Equation : {sp.expand(a*x**2 + b*x + c)} = 0")
print(f"Discriminant : D = {D}")
print(f"Nature : {nature}")
print(f"Exact roots : x1 = {x1}, x2 = {x2}")
print(f"Decimal roots : x1 = {show(complex(sp.N(x1)))}, x2 = {show(complex(sp.N(x2)))}")
lo, hi = sorted([r1, r2], key=lambda z: (z.real, z.imag))
print(f"Stable formula: {show(lo)}, {show(hi)}")
print(f"numpy.roots : {np.roots([af, bf, cf])}") # descending order: a, b, c
print(f"Sum, product : {x1 + x2} (= -b/a), {sp.simplify(x1*x2)} (= c/a)")
print(f"Vertex : ({h}, {k})")
print(f"Factored form : {factored}")
print(f"Check : residuals {res1} and {res2}")
verdict = "Verified" if res1 == 0 and res2 == 0 else "CHECK FAILED"
print(f"Verdict : {verdict}. Result: {nature}.")
# ---- 7. One 300 dpi figure: parabola, roots, vertex, axis ----
hf, kf = float(h), float(k)
half = max(abs(float(sp.re(sp.N(x2))) - float(sp.re(sp.N(x1)))) * 0.9, 1.5)
xs = np.linspace(hf - half, hf + half, 400)
ys = af*xs**2 + bf*xs + cf
fig, ax = plt.subplots(figsize=(7, 4.5))
ax.plot(xs, ys, color="#2563eb", lw=2.5, label="y = ax² + bx + c")
ax.axhline(0, color="#475569", lw=1)
ax.axvline(hf, color="#9333ea", lw=1.2, ls="--", label="axis of symmetry")
ax.plot([hf], [kf], "D", color="#9333ea", ms=8, label=f"vertex ({h}, {k})")
if D >= 0:
ax.plot([float(x1), float(x2)], [0, 0], "o", color="#16a34a", ms=9, label="roots")
ax.set_xlabel("x")
ax.set_ylabel("y")
ax.set_title("Quadratic formula: roots, vertex and axis of symmetry")
ax.grid(color="#e5e7eb")
ax.legend(frameon=False, fontsize=9)
fig.savefig("quadratic_formula_plot.png", dpi=300, bbox_inches="tight")
print("Saved quadratic_formula_plot.png")
Expected output for the worked example: D = 49, exact roots x1 = −1/3 and x2 = 2, decimal roots −0.3333 and 2.0000, sum 5/3, product −2/3, vertex (5/6, −49/12), factored form (x − 2)(3x + 1), verdict Verified. This script was run before publishing and printed exactly these values.
11.2 What each part does
| Code | What it does |
|---|---|
| sp.Rational(3) | Stores the coefficient exactly. Use sp.Rational(3, 4) for 3/4, because 3/4 alone is the float 0.75 |
| b**2 - 4*a*c | The discriminant. ** is power. ^ is XOR in Python and gives nonsense here |
| sp.sqrt(D) | An exact square root. Returns 7 for 49, 2*sqrt(3) for 12 and 4*I for −16 |
| cmath.sqrt(...) | A decimal square root that also works for negative numbers |
| q = -(b + sign*sqrtD) / 2 | The stable form: roots are q/a and c/q |
| np.roots([af, bf, cf]) | Built-in root finder. Coefficients go in descending order: a first |
| sp.factor(...) | The factored form, when one exists over the rationals |
| fig.savefig(..., dpi=300) | Saves the figure at print quality |
11.3 What the figure shows
The same picture as the R script: the blue parabola, green dots at x = −1/3 and x = 2, a purple diamond at the vertex (5/6, −49/12) and the dashed axis of symmetry. When D is negative no green dots are drawn, because the curve never meets the axis.
11.4 Common Python problems and fixes
| Problem | Cause | Fix |
|---|---|---|
| Discriminant is a strange small integer | b^2 was typed. ^ is XOR | Use b**2 |
ValueError: math domain error | math.sqrt of a negative number | Use cmath.sqrt or SymPy |
| Roots in the wrong order from NumPy | np.roots does not sort | Wrap it in sorted(...) or np.sort |
| You get 0.333333 and wanted 1/3 | Floats were used | Use sp.Rational or fractions.Fraction |
0.1 + 0.2 != 0.3 | Binary floating point | Compare with a tolerance, or use exact rationals |
| Division by zero | a = 0 | Check a first. The script raises a clear error |
round(2.5) gives 2 | Python rounds half to even | Expected behaviour. Excel gives 3 |
11.5 Useful one-liners
| You want | Python code |
|---|---|
| Exact roots | sp.solve(3*x**2 - 5*x - 2, x) |
| Decimal roots | np.roots([3, -5, -2]) |
| Discriminant | sp.discriminant(3*x**2 - 5*x - 2, x) |
| Factored form | sp.factor(3*x**2 - 5*x - 2) |
| Vertex form pieces | h = -b/(2*a); k = c - b**2/(4*a) |
| Exact fraction arithmetic | from fractions import Fraction; Fraction(-1, 3) |
python quadratic.py, or paste it into a Jupyter or Colab cell and replace the matplotlib.use("Agg") line with plt.show() at the end.📋 12. Reference Tables
12.1 Discriminant cases
| D = b² − 4ac | Number of real roots | Type of roots | Example | Roots |
|---|---|---|---|---|
| Positive, perfect square | 2 | Rational | x² − 5x + 6 = 0, D = 1 | 2 and 3 |
| Positive, not a square | 2 | Irrational | x² − 4x + 1 = 0, D = 12 | 2 ± √3 |
| Zero | 1 (repeated) | Rational | x² + 6x + 9 = 0, D = 0 | −3 |
| Negative | 0 | Complex conjugates | x² + 2x + 5 = 0, D = −16 | −1 ± 2i |
How to use it: compute D, find its row, and you know what kind of answer to expect before you finish.
12.2 Perfect squares from 1 to 30
| n | n² | n | n² | n | n² | n | n² | n | n² |
|---|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 7 | 49 | 13 | 169 | 19 | 361 | 25 | 625 |
| 2 | 4 | 8 | 64 | 14 | 196 | 20 | 400 | 26 | 676 |
| 3 | 9 | 9 | 81 | 15 | 225 | 21 | 441 | 27 | 729 |
| 4 | 16 | 10 | 100 | 16 | 256 | 22 | 484 | 28 | 784 |
| 5 | 25 | 11 | 121 | 17 | 289 | 23 | 529 | 29 | 841 |
| 6 | 36 | 12 | 144 | 18 | 324 | 24 | 576 | 30 | 900 |
How to use it: if your discriminant is in the n² column, the roots are rational and the quadratic factors.
12.3 Simplifying common square roots
| √D | Simplified | Decimal | √D | Simplified | Decimal |
|---|---|---|---|---|---|
| √8 | 2√2 | 2.8284 | √12 | 2√3 | 3.4641 |
| √18 | 3√2 | 4.2426 | √20 | 2√5 | 4.4721 |
| √24 | 2√6 | 4.8990 | √27 | 3√3 | 5.1962 |
| √28 | 2√7 | 5.2915 | √32 | 4√2 | 5.6569 |
| √40 | 2√10 | 6.3246 | √45 | 3√5 | 6.7082 |
| √48 | 4√3 | 6.9282 | √50 | 5√2 | 7.0711 |
| √72 | 6√2 | 8.4853 | √75 | 5√3 | 8.6603 |
| √98 | 7√2 | 9.8995 | √200 | 10√2 | 14.1421 |
How to use it: take the largest square factor out. √72 = √(36 × 2) = 6√2.
12.4 Sign patterns of a, b and c
| Signs | What you can say at once |
|---|---|
| a and c have opposite signs | −4ac is positive, so D is positive. There are always 2 real roots, one positive and one negative |
| a and c have the same sign | D may be positive, zero or negative. You must compute it |
| c = 0 | One root is 0, the other is −b ÷ a |
| b = 0 | Roots are ±√(−c ÷ a). Real only when a and c have opposite signs |
| a, b, c all positive | Any real roots are negative |
12.5 Three forms of a quadratic
| Form | Written as | Shows at a glance | Worked example |
|---|---|---|---|
| Standard form | ax² + bx + c | y-intercept c | 3x² − 5x − 2 |
| Factored form | a(x − r₁)(x − r₂) | The roots | (3x + 1)(x − 2) |
| Vertex form | a(x − h)² + k | The vertex (h, k) | 3(x − 5/6)² − 49/12 |
12.6 Powers of i for complex roots
| Power | Value | Power | Value |
|---|---|---|---|
| i | i | i³ | −i |
| i² | −1 | i⁴ | 1 |
| √(−1) | i | √(−16) | 4i |
| √(−3) | i√3 | √(−50) | 5i√2 |
📈 13. Example Results
Eight worked problems, each solved with the quadratic formula. They cover the cases you meet in class: clean roots, fractions, decimals, a real-world problem, a repeated root, complex roots, large numbers and a common trap.
A clean quadratic with whole-number roots
The case where the formula and factoring agree in two lines.
Solve x² − 7x + 10 = 0. Here a = 1, b = −7 and c = 10.
| Result | Value | Note |
|---|---|---|
| Standard form | x² − 7x + 10 = 0 | Every term on one side |
| Discriminant | 9 | From the whole-number form of the equation |
| Nature of roots | Two real roots | Read from the sign of D |
| Exact roots | x = 2 or x = 5 | Fractions and surds kept exact |
| Decimal roots | x₁ = 2.0000, x₂ = 5.0000 | To 4 decimal places |
| Vertex | (7/2, −9/4) | Turning point of the graph |
| Factored form | (x − 2)(x − 5) | When it exists |
| Check | Verified | Substituted back exactly |
What it means: D = 49 − 40 = 9, a perfect square, so the roots are rational: x = (7 ± 3) ÷ 2. The equation also factors as (x − 2)(x − 5).
How to write it: x = 2 or x = 5.
Fraction coefficients cleared first
Multiply through before you start and the fractions vanish.
Solve (2/3)x² + (1/3)x − 1 = 0. Multiply every term by 3 to get 2x² + x − 3 = 0.
| Result | Value | Note |
|---|---|---|
| Standard form | (2/3)x² + (1/3)x − 1 = 0 | Every term on one side |
| Discriminant | 25 | From the whole-number form of the equation |
| Nature of roots | Two real roots | Read from the sign of D |
| Exact roots | x = −3/2 or x = 1 | Fractions and surds kept exact |
| Decimal roots | x₁ = −1.5000, x₂ = 1.0000 | To 4 decimal places |
| Vertex | (−1/4, −25/24) | Turning point of the graph |
| Factored form | (1/3)(2x + 3)(x − 1) | When it exists |
| Check | Verified | Substituted back exactly |
What it means: With whole numbers, D = 1 + 24 = 25 and x = (−1 ± 5) ÷ 4. Multiplying the equation by 3 did not move the roots.
How to write it: x = 1 or x = −3/2.
Decimal coefficients
Decimals are fractions in disguise. Clear them the same way.
Solve 0.2x² − 1.1x + 0.9 = 0. Multiply every term by 10 to get 2x² − 11x + 9 = 0.
| Result | Value | Note |
|---|---|---|
| Standard form | (1/5)x² − (11/10)x + (9/10) = 0 | Every term on one side |
| Discriminant | 49 | From the whole-number form of the equation |
| Nature of roots | Two real roots | Read from the sign of D |
| Exact roots | x = 1 or x = 9/2 | Fractions and surds kept exact |
| Decimal roots | x₁ = 1.0000, x₂ = 4.5000 | To 4 decimal places |
| Vertex | (11/4, −49/80) | Turning point of the graph |
| Factored form | (1/10)(x − 1)(2x − 9) | When it exists |
| Check | Verified | Substituted back exactly |
What it means: D = 121 − 72 = 49 and x = (11 ± 7) ÷ 4. Working with 2, −11 and 9 avoids decimal slips.
How to write it: x = 1 or x = 4.5.
When does the ball hit the ground?
Two roots come out, and only one makes physical sense.
A ball is thrown up from 4 ft at 48 ft/s. Its height is h = −16t² + 48t + 4. Solve −16t² + 48t + 4 = 0. Dividing by −4 gives 4t² − 12t − 1 = 0.
| Result | Value | Note |
|---|---|---|
| Standard form | −16t² + 48t + 4 = 0 | Every term on one side |
| Discriminant | 160 | From the whole-number form of the equation |
| Nature of roots | Two real roots | Read from the sign of D |
| Exact roots | t = (3 ± √10)/2 | Fractions and surds kept exact |
| Decimal roots | t₁ = −0.0811, t₂ = 3.0811 | To 4 decimal places |
| Vertex | (3/2, 40) | Turning point of the graph |
| Factored form | −16(t − t₁)(t − t₂) with the two surd roots | When it exists |
| Check | Verified | Substituted back exactly |
What it means: D = 144 + 16 = 160 = 16 × 10, so √D = 4√10 and t = (3 ± √10) ÷ 2. The negative root is before the throw, so reject it. The vertex shows a maximum height of 40 ft at t = 1.5 s.
How to write it: The ball lands after t = (3 + √10) ÷ 2 ≈ 3.08 seconds.
A perfect square trinomial
D = 0, so the two roots are the same number.
Solve 9x² + 12x + 4 = 0. Here a = 9, b = 12 and c = 4.
| Result | Value | Note |
|---|---|---|
| Standard form | 9x² + 12x + 4 = 0 | Every term on one side |
| Discriminant | 0 | From the whole-number form of the equation |
| Nature of roots | Repeated root | Read from the sign of D |
| Exact roots | x = −2/3 (repeated root) | Fractions and surds kept exact |
| Decimal roots | x = −0.6667 | To 4 decimal places |
| Vertex | (−2/3, 0) | Turning point of the graph |
| Factored form | (3x + 2)² | When it exists |
| Check | Verified | Substituted back exactly |
What it means: D = 144 − 144 = 0, so x = −12 ÷ 18. The parabola touches the axis at its vertex, and the quadratic is (3x + 2)².
How to write it: x = −2/3 (repeated root).
A negative discriminant
Not a mistake: the roots are complex.
Solve 2x² − 2x + 5 = 0. Here a = 2, b = −2 and c = 5.
| Result | Value | Note |
|---|---|---|
| Standard form | 2x² − 2x + 5 = 0 | Every term on one side |
| Discriminant | −36 | From the whole-number form of the equation |
| Nature of roots | Complex roots | Read from the sign of D |
| Exact roots | x = 1/2 ± (3/2)i | Fractions and surds kept exact |
| Decimal roots | x₁ = 0.5000 − 1.5000i, x₂ = 0.5000 + 1.5000i | To 4 decimal places |
| Vertex | (1/2, 9/2) | Turning point of the graph |
| Factored form | Does not factor over the real numbers | When it exists |
| Check | Verified | Substituted back exactly |
What it means: D = 4 − 40 = −36, so √D = 6i and x = (2 ± 6i) ÷ 4. The parabola has its lowest point at (1/2, 9/2), above the axis, so it never crosses.
How to write it: No real solution. Over the complex numbers, x = 1/2 ± (3/2)i.
Big coefficients and a big surd
Factoring is hopeless here. The formula does not mind.
Solve x² − 2025x + 1000000 = 0. Here a = 1, b = −2025 and c = 1000000.
| Result | Value | Note |
|---|---|---|
| Standard form | x² − 2025x + 1000000 = 0 | Every term on one side |
| Discriminant | 100625 | From the whole-number form of the equation |
| Nature of roots | Two real roots | Read from the sign of D |
| Exact roots | x = (2025 ± 25√161)/2 | Fractions and surds kept exact |
| Decimal roots | x₁ = 853.8928, x₂ = 1171.1072 | To 4 decimal places |
| Vertex | (2025/2, −100625/4) | Turning point of the graph |
| Factored form | (x − x₁)(x − x₂) with the two surd roots | When it exists |
| Check | Verified | Substituted back exactly |
What it means: D = 4100625 − 4000000 = 100625 = 625 × 161, so √D = 25√161 and x = (2025 ± 25√161) ÷ 2. The roots multiply to exactly 1000000.
How to write it: x = (2025 ± 25√161) ÷ 2, about 853.89 or 1171.11.
Where a sign slip gives two wrong roots
The most common error in the whole topic.
Solve 2x² − 7x + 3 = 0. Here b = −7, so −b = +7.
| Result | Value | Note |
|---|---|---|
| Standard form | 2x² − 7x + 3 = 0 | Every term on one side |
| Discriminant | 25 | From the whole-number form of the equation |
| Nature of roots | Two real roots | Read from the sign of D |
| Exact roots | x = 1/2 or x = 3 | Fractions and surds kept exact |
| Decimal roots | x₁ = 0.5000, x₂ = 3.0000 | To 4 decimal places |
| Vertex | (7/4, −25/8) | Turning point of the graph |
| Factored form | (2x − 1)(x − 3) | When it exists |
| Check | Verified | Substituted back exactly |
What it means: Correct: x = (7 ± 5) ÷ 4. The slip is to write (−7 ± 5) ÷ 4, which gives −1/2 and −3. Those are the right sizes with the wrong signs, and the sum check exposes them: the roots must add to 7/2.
How to write it: x = 3 or x = 1/2.
✏️ 14. How to Use the Quadratic Formula by Hand, Step by Step
This is the pen and paper method a teacher expects to see in an exam, worked on the same example as Sections 7, 9, 10 and 11: 3x² − 5x − 2 = 0. After it come the keystrokes for putting the quadratic formula into a Casio or TI calculator.
14.1 The written method
- Write the equation in standard form, ax² + bx + c = 0. Move every term to one side. Here it is already done.
- Write down a, b and c with their signs. a = 3, b = −5, c = −2.
- Write the formula in letters. x = (−b ± √(b² − 4ac)) ÷ 2a. This line often earns a mark by itself.
- Work out the discriminant first. D = (−5)² − 4(3)(−2) = 25 + 24 = 49. Put b in brackets before you square it.
- Read the discriminant. D is positive and 49 = 7², so expect two rational roots.
- Substitute. x = (−(−5) ± √49) ÷ (2 × 3) = (5 ± 7) ÷ 6.
- Split the ±. x = (5 + 7) ÷ 6 = 12 ÷ 6 = 2, and x = (5 − 7) ÷ 6 = −2 ÷ 6 = −1/3.
- Check. 3(2)² − 5(2) − 2 = 12 − 10 − 2 = 0. 3(−1/3)² − 5(−1/3) − 2 = 1/3 + 5/3 − 2 = 0.
- Write the answer the way the question asks. x = 2 or x = −1/3. To 4 decimal places, x = 2.0000 or x = −0.3333.
14.2 How to put the quadratic formula into a calculator
There are three ways: type the formula directly, use the built-in equation mode, or store a short program. All three are shown for 3x² − 5x − 2 = 0.
| Calculator | Keys | What you see |
|---|---|---|
| Any scientific calculator, typing the formula | ( (−) ( (−) 5 ) + √ ( ( (−) 5 ) x² − 4 × 3 × (−) 2 ) ) ÷ ( 2 × 3 ) =. Then repeat with − in place of + | 2, then −0.3333 (or −1/3 in fraction display) |
| Casio fx-991EX (ClassWiz) | MENU A (Equation/Func), 2 (Polynomial), 2 (degree 2), then 3 = −5 = −2 =, then = to step through the answers | x₁ = 2, x₂ = −1/3, then the minimum point |
| Casio fx-991ES PLUS | MODE 5 (EQN), 3 (aX² + bX + c = 0), then 3 = −5 = −2 = = | X₁ = 2, X₂ = −1/3 |
| Casio fx-570MS and fx-991MS | Press MODE until EQN appears (three presses on these models), then 1. Press ▶ to reach the Degree? screen and press 2. Enter 3 = −5 = −2 =, then ▼ for the second root | x₁ = 2, x₂ = −0.3333. For complex roots an R⇔I mark appears and SHIFT Re⇔Im shows the imaginary part |
| TI-84 Plus CE, PlySmlt2 app | apps, choose PlySmlt2, press any key, choose POLYNOMIAL ROOT FINDER, set ORDER 2, press the NEXT soft key (graph), enter 3, −5, −2, then press the SOLVE soft key (graph) | x1 = 2, x2 = −1/3 |
| TI-84 Plus CE, on the graph | y= 3X² − 5X − 2, graph, then 2nd trace (calc), choose 2: zero, mark a left bound, a right bound and a guess for each root | X = −0.3333 and X = 2 |
Basic models such as the Casio fx-82MS and fx-82ES have no equation mode, so use the first row and type the formula. Menu numbers can differ between firmware versions and regional models. If your screen shows something different, check the equation chapter of the manual for your exact model.
A quadratic formula program for the TI-84. Press prgm, choose NEW, name it QUAD, and type these lines. sto→ gives the arrow, and Prompt and Disp are in the prgm I/O menu.
:Prompt A,B,C
:B²-4AC→D
:Disp "D=",D
:If D≥0
:Then
:Disp (-B+√(D))/(2A)
:Disp (-B-√(D))/(2A)
:Else
:Disp "NO REAL ROOTS"
:End
Run it with prgm, QUAD, enter. Type 3, −5 and −2 at the prompts and it shows D = 49, then 2 and −0.3333. Use the (-) key for negative numbers, not the subtraction key. Many exams allow stored programs and some do not, so check your exam rules first.
14.3 Practice problems with answers
Ten problems, easy to hard. Work each one on paper, then open the card to check. Every answer is exact.
1. x² − 5x + 6 = 0
D = 1. x = 2 or x = 3.
2. x² + 6x + 9 = 0
D = 0. One repeated root, x = −3.
3. 2x² + 3x − 2 = 0
D = 25. x = −2 or x = 1/2.
4. x² − 4x + 1 = 0
D = 12. x = 2 ± √3, about 0.2679 or 3.7321.
5. 3x² = 12
Rearrange to 3x² − 12 = 0. D = 16. x = −2 or x = 2.
6. x² + 2x + 5 = 0
D = −16. No real roots. x = −1 ± 2i.
7. 4x² − 4x − 7 = 0
D = 128. x = (1 ± 2√2)/2, about −0.9142 or 1.9142.
8. ½x² − 3x + 4 = 0
D = 4. x = 2 or x = 4.
9. x(x − 2) = 5
Rearrange to x² − 2x − 5 = 0. D = 24. x = 1 ± √6, about −1.4495 or 3.4495.
10. 5x² + 2x + 1 = 0
D = −16. No real roots. x = −1/5 ± (2/5)i.
14.4 Mistakes that lose marks
- The sign of −b. With b = −5, −b is +5, not −5.
- Squaring a negative b. (−5)² is 25. Typing −5² on a calculator gives −25.
- The sign of −4ac. When a and c have opposite signs, −4ac is positive and you add.
- Dividing only part of the top. The whole of −b ± √D is divided by 2a.
- Not rearranging first. 2x² = 4x + 3 has c = −3, not +3, once it is written as 2x² − 4x − 3 = 0.
- Rounding √D early. Keep the surd to the last line, then round once.
- Dividing both sides by x. This throws away the root x = 0.
- Stopping at one root. Unless D = 0, there are two.
🎯 15. When to Use the Quadratic Formula
The quadratic formula is the one method that always works. That does not make it the fastest every time.
Use the quadratic formula when:
- ✓ The discriminant is not a perfect square, so the roots are surds.
- ✓ The coefficients are decimals, fractions or large numbers.
- ✓ You tried to factor for a minute and found nothing.
- ✓ The question says "give your answer to 2 decimal places" or "in surd form".
- ✓ You expect complex roots.
Use something else when:
- ✗ The quadratic factors on sight, such as x² − 5x + 6. Factoring takes ten seconds.
- ✗ There is no x term, such as 3x² = 12. Divide and take a square root.
- ✗ There is no constant, such as x² − 4x = 0. Factor out x.
- ✗ You need the vertex or the minimum value. Complete the square.
- ✗ The equation is not a quadratic at all, for example it has x³ or 1/x.
Four real situations
| Situation | Equation | Best method | Why |
|---|---|---|---|
| When does a ball land? | −4.9t² + 20t + 1.5 = 0 | Quadratic formula | Decimal coefficients, D is not a square |
| A rectangle 3 m longer than wide has area 40 m² | x² + 3x − 40 = 0 | Factoring | (x + 8)(x − 5), small whole numbers |
| What is the lowest cost? | C = 2x² − 12x + 25 | Completing the square | You want the vertex, not the roots |
| Break-even points for profit | −0.5x² + 40x − 300 = 0 | Quadratic formula | Decimals, and both roots matter |
A quick decision path
- Is there no x term? Isolate x² and take ± the square root.
- Is there no constant? Factor out x.
- Compute D = b² − 4ac. Is it a perfect square? Then factor, or use the formula if you prefer.
- Is D positive but not a square, or negative? Use the quadratic formula.
- Do you need the turning point as well? Complete the square, or use h = −b ÷ 2a.
🔧 16. Common Mistakes and Troubleshooting
My answer is off by a sign
Likely cause: The sign of −b was missed. If b = −5 then −b = +5.
Fix: Write b in brackets when you substitute: −(−5). Then check that the roots add to −b ÷ a.
My discriminant is negative but the textbook has real roots
Likely cause: b was squared without brackets, giving −25 instead of 25, or −4ac was subtracted when it should have been added.
Fix: Compute b² and 4ac separately, then subtract. When a and c have opposite signs, D must be positive.
My calculator says Math ERROR or ERR:NONREAL ANS
Likely cause: You asked for the square root of a negative discriminant in real mode.
Fix: The equation has no real roots. Switch the calculator to complex mode, or write the answer with i.
The tool and my textbook disagree
Likely cause: The equation was typed without moving every term to one side, or a coefficient was mistyped.
Fix: Compare the Equation in standard form row of the results table with your book, term by term.
I got a decimal but the book has a surd
Likely cause: The square root was rounded on a calculator.
Fix: Keep √D exact and simplify it. This tool shows the exact form first for that reason.
My two roots are both wrong by a factor of 2
Likely cause: Only −b was divided by 2a, or the 2 in 2a was forgotten.
Fix: Divide the whole numerator, −b ± √D, by 2a.
Excel shows #NUM!
Likely cause: SQRT was given a negative discriminant.
Fix: Use IMSQRT and IMDIV for complex roots, or wrap the formula in IFERROR.
Python gives a strange discriminant
Likely cause: b^2 was typed. In Python ^ is XOR, not power.
Fix: Use b**2.
R returns the roots with +0i
Likely cause: polyroot always returns complex numbers.
Fix: Use Re() on the result when the imaginary parts are about 0.
I only found one root
Likely cause: You used + and forgot the −, or you divided both sides by x and lost x = 0.
Fix: Use both signs of ±. Never divide by the variable.
The calculator says this is not a quadratic
Likely cause: The x² terms cancelled, or a is 0.
Fix: Solve the linear equation bx + c = 0. The tool shows that answer for you.
My answer is right but I lost a mark
Likely cause: The question asked for a set number of decimal places or for exact form.
Fix: Read the last line of the question again and match the form it asks for.
⚖ 17. Assumptions and Limitations
Assumptions
- The equation is a quadratic in one variable. After moving everything to one side, the highest power must be 2. Check by expanding any brackets. If the x² terms cancel, the tool tells you the equation is linear.
- The coefficients are real numbers you type exactly. A decimal such as 0.333 is read as 333/1000, not as 1/3. If you mean one third, type 1/3.
- One letter stands for the unknown. x, t, n or any single letter works. Two different letters in one equation are rejected.
- Roots are reported over the complex numbers by default. If your course uses real numbers only, switch the Number system box to "Real numbers only" and a negative discriminant is reported as "No real solution".
- Decimals are rounded half away from zero to the number of places you choose. The exact form is never rounded.
Limitations
- Degree 2 only. Cubic and higher equations need other methods, such as the rational root theorem or a numerical root finder.
- No square roots or pi inside the coefficients. Type them as decimals. The answer is then exact for the decimal you typed, not for the surd you had in mind.
- No division by an expression in x. For an equation such as 1/x + x = 3, multiply through by x yourself first, and remember that x = 0 is then excluded.
- Very large square-free parts. Simplifying √D needs the square factors of D. For discriminants with more than about 13 digits the tool may leave a large surd partly unsimplified. The decimal roots stay correct.
- Word problems still need you. The tool solves the equation. Deciding which root makes sense, for example rejecting a negative length, is your job.
- Charts use ordinary floating-point numbers. For extreme coefficients the graph is a sketch. The printed roots are computed with exact integers and are not affected.
🏁 18. Conclusion
A quadratic formula calculator does one job well: it turns a, b and c into the roots of ax² + bx + c = 0, every time, whether or not the equation factors. The formula x = (−b ± √(b² − 4ac)) ÷ 2a is short enough to memorise and reliable enough to trust under exam pressure.
What the answer is
___ Solve a problem above to see your answer summarised here.
What it tells you
___ Solve a problem above.
The most useful habit is to compute the discriminant before anything else. Its sign tells you whether to expect two real roots, one repeated root or a complex pair, and whether it is a perfect square tells you if factoring would have worked. Students who do this catch most errors early, because a surprising discriminant is a warning that a sign went wrong.
Watch out for
___ Solve a problem above.
Three slips cause most wrong answers: forgetting that −b changes the sign of b, squaring a negative b without brackets, and dividing only part of the numerator by 2a. Research on how students solve quadratics finds the same pattern again and again (Vaiyavutjamai & Clements, 2006; Didiş & Erbaş, 2015). A ten-second check with the sum and product of the roots catches all three.
Next steps
___ Solve a problem above.
Type your own equation into the calculator above, read the steps once, and then cover them and repeat the working on paper. When your paper answer matches the verified answer three times in a row, you no longer need the quadratic formula calculator for that type of problem.
❓ 19. Frequently Asked Questions
Q1. What is the quadratic formula?
The quadratic formula is x = (−b ± √(b² − 4ac)) ÷ 2a. It gives the roots of any equation written as ax² + bx + c = 0, where a is not 0. You put the three coefficients a, b and c into the formula, and the ± sign produces the two roots.
Q2. How do you use a quadratic formula calculator?
Type the equation or enter a, b and c, then press Solve. The quadratic formula calculator on this page shows the exact roots, the decimal roots, the discriminant and every step. For 3x² − 5x − 2 = 0 it returns x = 2 and x = −1/3.
Q3. How do you calculate the quadratic formula step by step?
Write the equation as ax² + bx + c = 0, read off a, b and c, compute D = b² − 4ac, then work out x = (−b ± √D) ÷ 2a. Use + for one root and − for the other, simplify, and check both roots by substituting them back.
Q4. What is the discriminant and what does it tell you?
The discriminant is D = b² − 4ac, the part of the quadratic formula under the square root. If D is positive there are two real roots, if D is 0 there is one repeated root, and if D is negative there are no real roots, only two complex roots.
Q5. Can the quadratic formula solve every quadratic equation?
Yes, the quadratic formula solves every quadratic equation, as long as a is not 0. It works when the roots are whole numbers, fractions, surds or complex numbers. Factoring only works easily when the discriminant is a perfect square.
Q6. What happens if the discriminant is negative?
If the discriminant is negative, the equation has no real roots. The two roots are complex conjugates of the form p ± qi, where i² = −1. For x² + 2x + 5 = 0, D = −16 and the roots are −1 ± 2i.
Q7. How do you put the quadratic formula into a calculator?
Type the whole numerator in brackets, divide by 2a in brackets, and press equals: ( −b + √( b² − 4ac ) ) ÷ ( 2a ). Then repeat with a minus before the square root. Use the negative key, not the subtraction key, for negative numbers.
Q8. How do you do the quadratic formula on a scientific calculator such as the Casio fx-991EX?
On a Casio fx-991EX press MENU, choose Equation/Func, choose Polynomial, choose degree 2, then enter a, b and c, pressing = after each. The calculator shows x1 and x2. On models with no equation mode, type the formula with brackets around the numerator and around 2a.
Q9. How do you solve a quadratic on a TI-84 graphing calculator?
On a TI-84 Plus CE open the PlySmlt2 app, choose Polynomial Root Finder, set the order to 2, enter a, b and c, and press Solve. You can also graph the function and use the zero command in the calc menu, or store a short program that prompts for A, B and C.
Q10. Can you program the quadratic formula into a calculator?
Yes, on a programmable calculator such as the TI-84 you can store a program that asks for A, B and C and displays both roots. Section 14 of this page lists a ten-line TI-BASIC program. Check your exam rules first, because some exams do not allow stored programs.
Q11. How do you get exact answers instead of decimals from the quadratic formula?
Leave the square root unsimplified until the end, then take out the largest square factor. For x² − 4x + 1 = 0, D = 12, √12 = 2√3, and x = (4 ± 2√3) ÷ 2 = 2 ± √3. This calculator shows the exact form first and the decimal form under it.
Q12. Does the quadratic formula work with fractions and decimals?
Yes, the quadratic formula works with fraction and decimal coefficients. It is easier to multiply every term by a common denominator first, so that a, b and c are whole numbers. The roots do not change when you multiply the whole equation by the same non-zero number.
Q13. How do you factor a quadratic using the quadratic formula?
Find the roots r1 and r2 with the quadratic formula, then write the quadratic as a(x − r1)(x − r2). For 3x² − 5x − 2 the roots are 2 and −1/3, so it factors as 3(x − 2)(x + 1/3), which is (x − 2)(3x + 1).
Q14. What is the difference between the quadratic formula and completing the square?
Completing the square is the method and the quadratic formula is its result. If you complete the square on ax² + bx + c = 0 with letters, you arrive at the quadratic formula. Completing the square also gives the vertex, while the formula goes straight to the roots.
Q15. How do you find the zeros of a quadratic function with the quadratic formula?
Set the function equal to 0 and apply the quadratic formula. The zeros of f(x) = ax² + bx + c are x = (−b ± √(b² − 4ac)) ÷ 2a. On a graph they are the points where the parabola meets the x axis.
Q16. How do you find a quadratic equation from three points?
Substitute each point into y = ax² + bx + c to get three equations, then solve them for a, b and c. The From 3 Points tab of this calculator does that exactly. The points (0, −2), (1, −4) and (2, 0) give y = 3x² − 5x − 2.
Q17. How do you do the quadratic formula in Excel?
Put a, b and c in A2, B2 and C2, then type =(-B2+SQRT(B2^2-4*A2*C2))/(2*A2) for one root and the same formula with a minus before SQRT for the other. If the discriminant is negative, SQRT returns #NUM! and you need IMSQRT.
Q18. How do you solve a quadratic equation in R?
Use polyroot(c(c, b, a)), with the coefficients in ascending order. For 3x² − 5x − 2 = 0, polyroot(c(-2, -5, 3)) returns 2 and −0.3333 as complex numbers with a zero imaginary part. Wrap the result in Re() to keep the real parts.
Q19. How do you solve a quadratic equation in Python?
Use numpy.roots([a, b, c]) for decimals or sympy.solve for exact answers. For 3x² − 5x − 2 = 0, numpy.roots([3, -5, -2]) returns 2 and −0.3333. Remember that power is written ** in Python, because ^ means XOR.
Q20. Why does my quadratic formula answer not match the textbook?
The most common causes are a sign error in −b, squaring a negative b without brackets, dividing only part of the numerator by 2a, or not rearranging the equation to equal 0 first. Check with the sum and product rules: the roots must add to −b ÷ a and multiply to c ÷ a.
📑 20. Cite This Tool
Pushbanathan, R. (2026). Quadratic formula calculator [Interactive mathematics tool]. StatsUnlock. Retrieved November 10, 2026, from https://statsunlock.com/quadratic-formula-calculator/@misc{statsunlock_quadratic_formula_2026, title={Quadratic Formula Calculator}, author={Pushbanathan, Reegan}, year={2026}, publisher={StatsUnlock}, note={Interactive mathematics tool, accessed 2026-11-10}, url={https://statsunlock.com/quadratic-formula-calculator/}}Quadratic equations were solved with the StatsUnlock Quadratic Formula Calculator (Pushbanathan, 2026), which applies x = (-b +/- sqrt(b^2 - 4ac)) / (2a) in exact rational arithmetic and verifies each root by substitution.🔗 21. Related Tools
Simplify expressions and solve other kinds of equations, with steps.
Check the arithmetic inside b² − 4ac one operation at a time.
Compare two numbers, useful when you test whether D is above or below zero.
Every maths and algebra calculator on StatsUnlock in one place.
Fit a curve to data, including a squared term, when you have points instead of an equation.
Put a confidence interval around a measured value, with the working shown.
Another formula with a square root where exact and rounded answers differ.
Plot a set of roots or measurements and see their spread.
📖 22. Glossary of Terms
| Term | Plain-English meaning |
|---|---|
| Axis of symmetry | The vertical line x = −b ÷ 2a that cuts the parabola into two mirror halves. |
| Coefficient | The number multiplying a power of x. In 3x² − 5x − 2 the coefficients are 3 and −5. |
| Completing the square | Rewriting ax² + bx + c as a(x − h)² + k. The quadratic formula is derived this way. |
| Complex conjugates | A pair such as −1 + 2i and −1 − 2i, with the same real part and opposite imaginary parts. |
| Complex number | A number of the form p + qi, where i² = −1. |
| Constant term | The number with no x attached, called c. |
| Discriminant | D = b² − 4ac. Its sign tells you how many real roots there are. |
| Double root | Another name for a repeated root, which happens when D = 0. |
| Factored form | The quadratic written as a product, such as (3x + 1)(x − 2). |
| Imaginary unit | The symbol i, defined by i² = −1. |
| Irrational number | A number that cannot be written as a fraction, such as √3. |
| Leading coefficient | The number in front of x², called a. It must not be 0. |
| Parabola | The U-shaped graph of a quadratic function. |
| Perfect square | A whole number that is the square of another whole number, such as 49 = 7². |
| Quadratic equation | An equation that can be written as ax² + bx + c = 0 with a not 0. |
| Quadratic formula | x = (−b ± √(b² − 4ac)) ÷ 2a, which gives the roots of any quadratic equation. |
| Rational number | A number that can be written as a fraction of two whole numbers. |
| Root | A value of x that makes the equation true. Also called a solution or a zero. |
| Standard form | The arrangement ax² + bx + c = 0, with every term on one side. |
| Surd | A square root that does not simplify to a whole number or fraction, such as √13. |
| Vertex | The turning point of the parabola, at (−b ÷ 2a, c − b² ÷ 4a). |
| Vieta's formulas | The rules that the roots add to −b ÷ a and multiply to c ÷ a. |
| Zero of a function | An x value where the function equals 0. The zeros of y = ax² + bx + c are the roots of the equation. |
📚 23. References
These peer-reviewed journal articles support the methods and the teaching advice in this quadratic formula calculator. They cover the history of the method, accurate computation of quadratic roots, and research on how students learn and mis-learn quadratic equations.
- Aberth, O. (1973). Iteration methods for finding all zeros of a polynomial simultaneously. Mathematics of Computation, 27(122), 339–344. https://doi.org/10.1090/S0025-5718-1973-0329236-7
- Blinn, J. F. (2005). How to solve a quadratic equation. IEEE Computer Graphics and Applications, 25(6), 76–79. https://doi.org/10.1109/MCG.2005.134
- Blinn, J. F. (2006). How to solve a quadratic equation. Part 2. IEEE Computer Graphics and Applications, 26(2), 82–87. https://doi.org/10.1109/MCG.2006.35
- Booth, J. L., Barbieri, C., Eyer, F., & Paré-Blagoev, E. J. (2014). Persistent and pernicious errors in algebraic problem solving. The Journal of Problem Solving, 7(1), 10–23. https://doi.org/10.7771/1932-6246.1161
- Didiş, M. G., & Erbaş, A. K. (2015). Performance and difficulties of students in formulating and solving quadratic equations with one unknown. Educational Sciences: Theory & Practice, 15(4), 1137–1150. https://doi.org/10.12738/estp.2015.4.2743
- Forsythe, G. E. (1970). Pitfalls in computation, or why a math book isn't enough. The American Mathematical Monthly, 77(9), 931–956. https://doi.org/10.1080/00029890.1970.11992636
- Gandz, S. (1937). The origin and development of the quadratic equations in Babylonian, Greek, and early Arabic algebra. Osiris, 3, 405–557. https://doi.org/10.1086/368492
- Goldberg, D. (1991). What every computer scientist should know about floating-point arithmetic. ACM Computing Surveys, 23(1), 5–48. https://doi.org/10.1145/103162.103163
- Herscovics, N., & Linchevski, L. (1994). A cognitive gap between arithmetic and algebra. Educational Studies in Mathematics, 27(1), 59–78. https://doi.org/10.1007/BF01284528
- Jenkins, M. A., & Traub, J. F. (1970). A three-stage variable-shift iteration for polynomial zeros and its relation to generalized Rayleigh iteration. Numerische Mathematik, 14(3), 252–263. https://doi.org/10.1007/BF02163334
- Katz, V. J. (2007). Stages in the history of algebra with implications for teaching. Educational Studies in Mathematics, 66(2), 185–201. https://doi.org/10.1007/s10649-006-9023-7
- Kieran, C. (1981). Concepts associated with the equality symbol. Educational Studies in Mathematics, 12(3), 317–326. https://doi.org/10.1007/BF00311062
- Lima, R. N. de, & Tall, D. (2008). Procedural embodiment and magic in linear equations. Educational Studies in Mathematics, 67(1), 3–18. https://doi.org/10.1007/s10649-007-9086-0
- López, J., Robles, I., & Martínez-Planell, R. (2016). Students' understanding of quadratic equations. International Journal of Mathematical Education in Science and Technology, 47(4), 552–572. https://doi.org/10.1080/0020739X.2015.1119895
- Rittle-Johnson, B., & Star, J. R. (2007). Does comparing solution methods facilitate conceptual and procedural knowledge? An experimental study on learning to solve equations. Journal of Educational Psychology, 99(3), 561–574. https://doi.org/10.1037/0022-0663.99.3.561
- Sfard, A., & Linchevski, L. (1994). The gains and the pitfalls of reification: The case of algebra. Educational Studies in Mathematics, 26(2–3), 191–228. https://doi.org/10.1007/BF01273663
- Stacey, K., & MacGregor, M. (1999). Learning the algebraic method of solving problems. The Journal of Mathematical Behavior, 18(2), 149–167. https://doi.org/10.1016/S0732-3123(99)00026-7
- Tall, D., de Lima, R. N., & Healy, L. (2014). Evolving a three-world framework for solving algebraic equations in the light of what a student has met before. The Journal of Mathematical Behavior, 34, 1–13. https://doi.org/10.1016/j.jmathb.2014.03.001
- Vaiyavutjamai, P., & Clements, M. A. (2006). Effects of classroom instruction on students' understanding of quadratic equations. Mathematics Education Research Journal, 18(1), 47–77. https://doi.org/10.1007/BF03217429
- Zakaria, E., Ibrahim, & Maat, S. M. (2010). Analysis of students' error in learning of quadratic equations. International Education Studies, 3(3), 105–110. https://doi.org/10.5539/ies.v3n3p105
