HomeAll CategoriesQuadratic Formula Calculator with Steps (Free) | StatsUnlock

Quadratic Formula Calculator with Steps (Free) | StatsUnlock

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.

AlgebraStep by StepExact AnswerQuadratic FormulaGraphFree

⚡ 0. Quick Answer

A quadratic formula calculator solves ax² + bx + c = 0 by putting a, b and c into one formula.

x = −b ± √b² − 4ac2a

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.

Graph of y = 3x squared minus 5x minus 2 with the roots from the quadratic formulaAn upward parabola crossing the x axis at x = -1/3 and x = 2, with its vertex at (5/6, -49/12) and a dashed axis of symmetry.−10123−50510xx = −1/3x = 2vertex (5/6, −49/12)
The graph of y = 3x² − 5x − 2. The green dots are the two roots the quadratic formula gives, x = −1/3 and x = 2. The purple diamond is the vertex and the dashed line is the axis of symmetry, exactly halfway between the roots.

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.

MethodHow it worksBest whenWeak point
Quadratic formulaPut a, b, c into one formulaAlways. Needed when D is not a perfect squareMore arithmetic, sign slips with −b
FactoringWrite as (px + q)(rx + s) = 0D is a perfect square and the numbers are smallFails when the roots are irrational or complex
Completing the squareRewrite as (x + p)² = qYou also need the vertex, or a = 1 and b is evenFractions appear quickly
GraphingRead where the curve meets the x axisYou want a picture or an estimateGives 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

Solution
___
Press Solve to see the exact answer, the decimal answer and every step.

🧠 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.

The three discriminant cases of the quadratic formulaLeft: a parabola crossing the axis twice when D is positive. Middle: a parabola touching the axis once when D equals zero. Right: a parabola above the axis when D is negative.D > 0two real rootsD = 0one repeated rootD is negativeno real roots
The three cases. Left: D is positive and the parabola crosses the axis twice. Middle: D = 0 and it touches once. Right: D is negative and it never reaches the axis, so the roots are complex.
DiscriminantRootsGraphCan you factor it?
D > 0 and a perfect square2 real, rationalCrosses the axis twiceYes, with whole numbers or fractions
D > 0, not a perfect square2 real, irrational (surds)Crosses the axis twiceNo, use the formula
D = 01 repeated real rootTouches the axis at the vertexYes, it is a perfect square
D negative2 complex conjugates, no real rootsNever meets the axisNot 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.

1. Exam or homework answer
Standard form, then a, b and c, then D = b² − 4ac = ___, then x = (−b ± √D) / (2a) = ___.
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.
2. Final answer only
x = ___ or x = ___
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".
3. Teacher's answer key line
Equation | D = ___ | nature | roots | vertex
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.
4. Report or lab write-up sentence
The quadratic equation ___ was solved with the quadratic formula, giving ___.
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.
5. Plain text for a forum or chat
a*x^2 + b*x + c = 0 ; D = ___ ; x = ___
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

①
Quadratic Formula
x = (−b ± √(b² − 4ac)) ÷ 2a
a, b, cCoefficients of ax² + bx + c = 0. Real numbers, a not 0
xThe roots, the values that make the equation true
±Use + for one root and − for the other
RequiresThe equation rearranged so one side is 0
Example3x² − 5x − 2 = 0 gives x = (5 ± 7) ÷ 6, so x = 2 or x = −1/3
②
Discriminant
D = b² − 4ac
DThe number under the square root. Also written with the Greek letter delta
RuleD positive: 2 real roots. D = 0: 1 repeated root. D negative: 2 complex roots
NoteSquare b with its sign in brackets: (−5)² = 25, never −25
Example(−5)² − 4(3)(−2) = 25 + 24 = 49
③
Vertex and Vertex Form (Completing the Square)
y = a(x − h)² + k,   h = −b ÷ 2a,   k = c − b² ÷ 4a
(h, k)The vertex, the lowest point when a is positive and the highest when a is negative
x = hThe axis of symmetry
Use forGraphing, maximum and minimum problems
Exampleh = 5/6 and k = −49/12, so y = 3(x − 5/6)² − 49/12
④
The Check: Substitution
a·r² + b·r + c = 0 for each root r
rA root you want to test
RuleIf the left side is not exactly 0, the root is wrong
Example3(2)² − 5(2) − 2 = 12 − 10 − 2 = 0
⑤
Sum and Product of Roots (Vieta's Formulas)
x₁ + x₂ = −b ÷ a,   x₁ × x₂ = c ÷ a
x₁, x₂The two roots, real or complex
Use forA ten-second check, and for building an equation from its roots
Example2 + (−1/3) = 5/3 and 2 × (−1/3) = −2/3
⑥
Complex Roots (Negative Discriminant)
x = −b ÷ 2a ± (√|D| ÷ 2a)·i,   i² = −1
iThe imaginary unit, defined by i² = −1
|D|The discriminant made positive
RuleThe two roots are conjugates: same real part, opposite imaginary parts
Examplex² + 2x + 5 = 0 has D = −16, so x = −1 ± 2i
⑦
Stable Formula for Computers
q = −(b + sign(b)·√D) ÷ 2,   x₁ = q ÷ a,   x₂ = c ÷ q
sign(b)+1 when b is 0 or positive, −1 when b is negative
qA helper value that never subtracts two nearly equal numbers
Use forCode and spreadsheets when b² is far larger than 4ac
NoteGives the same roots as card 1 on paper. It only matters in floating-point arithmetic

🔀 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.

Start or result Data step Calculation step Yes or no check
Start A quadratic equation 3x² − 5x − 2 = 0
1
Move every term to one side ax² + bx + c = 0 Already in standard form: 3x² − 5x − 2 = 0
2
Read off a, b and c with their signs a = 3, b = −5, c = −2
CheckIs a different from 0?
YesIt is a quadratic. Here a = 3, so carry on.
No, stopWith a = 0 the equation is linear. Solve bx + c = 0 instead.
3
Work out the discriminant D = b² − 4ac (−5)² − 4(3)(−2) = 25 + 24 = 49
CheckIs D zero or positive?
YesThe roots are real. Here D = 49, so carry on.
NoD is negative. Write √D as i√|D| and carry on to get complex roots.
4
Take the square root of D √D √49 = 7, a perfect square, so the roots are rational
5
Put the numbers into the formula x = (−b ± √D) ÷ 2a x = (5 ± 7) ÷ 6
6
Split the ± and simplify (5 + 7) ÷ 6 = 2   and   (5 − 7) ÷ 6 = −1/3
CheckDoes each root give 0 when substituted back?
Yes3(2)² − 5(2) − 2 = 0 and 3(−1/3)² − 5(−1/3) − 2 = 0.
No, stopLook for a sign slip in −b or in −4ac, then redo step 3.
Result x = 2 or x = −1/3 Two real roots Verified Sum 5/3 = −b ÷ a and product −2/3 = c ÷ a.

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

  1. Choose how to enter the problem. Pick a tab: Type the Equation, Enter a, b, c, From 3 Points, or Batch (CSV).
  2. 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.
  3. Or load a sample problem. Open the Sample problem list and choose one of the ten named examples to see the format.
  4. Set the decimal places. Choose 2, 4, 6 or 10 decimal places for the rounded roots.
  5. 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.
  6. Press Solve. Nothing is calculated until you press Solve or press Enter in an input box.
  7. 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.
  8. Follow the step-by-step solution. Each step shows one move: standard form, the discriminant, the quadratic formula, the two roots and the check.
  9. 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.
  10. 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.

The whole thing in one line: with a, b, c in A2, B2, C2, type =(-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 wantExcel formulaNote
Discriminant=B2^2-4*A2*C2Keep 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 displayFormat Cells, Fraction, Up to two digitsShows −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.

Excel sheet: cell A2 holds 3Xquadratic-formula.xlsx - ExcelA2fx3ABC1abc23−5−2

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
Excel sheet: cell D2 holds =B2^2-4*A2*C2Xquadratic-formula.xlsx - ExcelD2fx=B2^2-4*A2*C2ABCD1abcDiscriminant23−5−249

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)
Excel sheet: cell E2 holds =(-B2+SQRT(D2))/(2*A2)Xquadratic-formula.xlsx - ExcelE2fx=(-B2+SQRT(D2))/(2*A2)ABCDE1abcDiscriminantRoot 123−5−2492

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)
Excel sheet: cell F2 holds =(-B2-SQRT(D2))/(2*A2)Xquadratic-formula.xlsx - ExcelF2fx=(-B2-SQRT(D2))/(2*A2)ABCDEF1abcDiscriminantRoot 1Root 223−5−2492−0.3333

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
Excel sheet: cell G2 holds =$A2*E2^2+$B2*E2+$C2Xquadratic-formula.xlsx - ExcelG2fx=$A2*E2^2+$B2*E2+$C2ABCDEFGH1abcDiscriminantRoot 1Root 2Check 1Check 223−5−2492−0.33330.00000.0000

G2 and H2 both show 0.0000, so x = 2 and x = −1/3 are verified.

9.3 The awkward cases

  • Negative discriminant. SQRT of a negative number returns #NUM!. Use =IMDIV(IMSUM(-B2,IMSQRT(D2)),2*A2), which returns text such as −1+2i. For the second root use IMSUB in place of IMSUM.
  • 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))/2 in 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

SituationWhat happensFix
You type =-B2^2 or =-5^2Excel gives +25, because it applies the minus before the power. R, Python and paper algebra give −25Write =-(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-16Floating-point storage, not a wrong answerTreat anything below 1E-9 as 0, or wrap the check in ROUND(..., 10)
Rounding 2.5 or 0.125ROUND 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 rootsExcel lists them in the order you wrote the formulas. numpy.roots and polyroot use their own orderSort the roots before comparing
Complex rootsExcel returns text ("-1+2i"). R and Python return complex numbersUse IMREAL and IMAGINARY to get numbers back
The −5² trap. In Excel, =-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

ErrorCauseFix
#NUM!D is negative, so SQRT failsThere are no real roots. Use the IMSQRT version
#DIV/0!a is 0 or the cell is emptyEnter 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 signRetype the number with the keyboard minus key
#NAME?A misspelt function, such as SQR in place of SQRTCheck the spelling
Wrong answer, no errorMissing brackets around 2*A2, so only the square root is dividedWrite /(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.

Copy the whole block. It runs top to bottom in RStudio, Posit Cloud or with 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

CodeWhat it does
D <- b^2 - 4 * a * cThe 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) / 2The 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

ProblemCauseFix
Roots come out in a strange order or wrongCoefficients given to polyroot as a, b, cUse polyroot(c(c, b, a))
NaNs produced warningsqrt() of a negative discriminantUse sqrt(as.complex(D))
Result shows 2+0ipolyroot always returns complex numbersUse Re() when Im() is about 0
Root prints as 2.0000000000000004Floating-point roundingUse round(x, 4) for display
-5^2 gives −25Power is applied before the minus signWrite (-5)^2 or store b first
You want −1/3, not −0.3333R works in decimals by defaultMASS::fractions(x) shows the fraction
round(2.5) gives 2R rounds half to evenExpected behaviour. Excel gives 3

10.5 Useful one-liners

You wantR code
Both roots at oncepolyroot(c(-2, -5, 3))
Real parts onlyRe(polyroot(c(-2, -5, 3)))
Discriminantb^2 - 4*a*c
Roots as fractionsMASS::fractions(Re(polyroot(c(-2, -5, 3))))
Vertexc(-b/(2*a), c - b^2/(4*a))
One root by searchuniroot(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.

Copy the whole block. It runs in a terminal, in Jupyter or in Google Colab. Change only the line that sets a, b and c.
sympyexact roots, fractions and surds
numpydecimal roots with numpy.roots
matplotlibthe figure
cmathsquare roots of negatives, standard library

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

CodeWhat 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*cThe 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) / 2The 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

ProblemCauseFix
Discriminant is a strange small integerb^2 was typed. ^ is XORUse b**2
ValueError: math domain errormath.sqrt of a negative numberUse cmath.sqrt or SymPy
Roots in the wrong order from NumPynp.roots does not sortWrap it in sorted(...) or np.sort
You get 0.333333 and wanted 1/3Floats were usedUse sp.Rational or fractions.Fraction
0.1 + 0.2 != 0.3Binary floating pointCompare with a tolerance, or use exact rationals
Division by zeroa = 0Check a first. The script raises a clear error
round(2.5) gives 2Python rounds half to evenExpected behaviour. Excel gives 3

11.5 Useful one-liners

You wantPython code
Exact rootssp.solve(3*x**2 - 5*x - 2, x)
Decimal rootsnp.roots([3, -5, -2])
Discriminantsp.discriminant(3*x**2 - 5*x - 2, x)
Factored formsp.factor(3*x**2 - 5*x - 2)
Vertex form piecesh = -b/(2*a); k = c - b**2/(4*a)
Exact fraction arithmeticfrom fractions import Fraction; Fraction(-1, 3)
R, Python, Excel and this page agree. All four give x = −0.3333 and x = 2.0000 for 3x² − 5x − 2 = 0, with D = 49. Run the script in a terminal with 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² − 4acNumber of real rootsType of rootsExampleRoots
Positive, perfect square2Rationalx² − 5x + 6 = 0, D = 12 and 3
Positive, not a square2Irrationalx² − 4x + 1 = 0, D = 122 ± √3
Zero1 (repeated)Rationalx² + 6x + 9 = 0, D = 0−3
Negative0Complex conjugatesx² + 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

nn²nn²nn²nn²nn²
11749131691936125625
24864141962040026676
39981152252144127729
41610100162562248428784
52511121172892352929841
63612144183242457630900

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

√DSimplifiedDecimal√DSimplifiedDecimal
√82√22.8284√122√33.4641
√183√24.2426√202√54.4721
√242√64.8990√273√35.1962
√282√75.2915√324√25.6569
√402√106.3246√453√56.7082
√484√36.9282√505√27.0711
√726√28.4853√755√38.6603
√987√29.8995√20010√214.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

SignsWhat 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 signD may be positive, zero or negative. You must compute it
c = 0One root is 0, the other is −b ÷ a
b = 0Roots are ±√(−c ÷ a). Real only when a and c have opposite signs
a, b, c all positiveAny real roots are negative

12.5 Three forms of a quadratic

FormWritten asShows at a glanceWorked example
Standard formax² + bx + cy-intercept c3x² − 5x − 2
Factored forma(x − r₁)(x − r₂)The roots(3x + 1)(x − 2)
Vertex forma(x − h)² + kThe vertex (h, k)3(x − 5/6)² − 49/12

12.6 Powers of i for complex roots

PowerValuePowerValue
iii³−i
i²−1i⁴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.

1
TEXTBOOK CASE

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.

a = 1b = −7c = 10D = 9Two real roots
ResultValueNote
Standard formx² − 7x + 10 = 0Every term on one side
Discriminant9From the whole-number form of the equation
Nature of rootsTwo real rootsRead from the sign of D
Exact rootsx = 2 or x = 5Fractions and surds kept exact
Decimal rootsx₁ = 2.0000, x₂ = 5.0000To 4 decimal places
Vertex(7/2, −9/4)Turning point of the graph
Factored form(x − 2)(x − 5)When it exists
CheckVerifiedSubstituted back exactly
Graph for example 1: x² − 7x + 10 = 0Parabola for x² − 7x + 10 = 0. It meets the horizontal axis at the roots.123456−2.502.55x
The green dots are the two roots. The purple diamond is the vertex.

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.

2
EXAM STYLE WITH FRACTIONS

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.

a = 2/3b = 1/3c = −1D = 25Two real roots
ResultValueNote
Standard form(2/3)x² + (1/3)x − 1 = 0Every term on one side
Discriminant25From the whole-number form of the equation
Nature of rootsTwo real rootsRead from the sign of D
Exact rootsx = −3/2 or x = 1Fractions and surds kept exact
Decimal rootsx₁ = −1.5000, x₂ = 1.0000To 4 decimal places
Vertex(−1/4, −25/24)Turning point of the graph
Factored form(1/3)(2x + 3)(x − 1)When it exists
CheckVerifiedSubstituted back exactly
Graph for example 2: (2/3)x² + (1/3)x − 1 = 0Parabola for (2/3)x² + (1/3)x − 1 = 0. It meets the horizontal axis at the roots.−2−1012−1012x
The green dots are the two roots. The purple diamond is the vertex.

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.

3
DECIMALS

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.

a = 1/5b = −11/10c = 9/10D = 49Two real roots
ResultValueNote
Standard form(1/5)x² − (11/10)x + (9/10) = 0Every term on one side
Discriminant49From the whole-number form of the equation
Nature of rootsTwo real rootsRead from the sign of D
Exact rootsx = 1 or x = 9/2Fractions and surds kept exact
Decimal rootsx₁ = 1.0000, x₂ = 4.5000To 4 decimal places
Vertex(11/4, −49/80)Turning point of the graph
Factored form(1/10)(x − 1)(2x − 9)When it exists
CheckVerifiedSubstituted back exactly
Graph for example 3: (1/5)x² − (11/10)x + (9/10) = 0Parabola for (1/5)x² − (11/10)x + (9/10) = 0. It meets the horizontal axis at the roots.012345−0.500.51x
The green dots are the two roots. The purple diamond is the vertex.

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.

4
REAL WORLD: PROJECTILE

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.

a = −16b = 48c = 4D = 160Two real roots
ResultValueNote
Standard form−16t² + 48t + 4 = 0Every term on one side
Discriminant160From the whole-number form of the equation
Nature of rootsTwo real rootsRead from the sign of D
Exact rootst = (3 ± √10)/2Fractions and surds kept exact
Decimal rootst₁ = −0.0811, t₂ = 3.0811To 4 decimal places
Vertex(3/2, 40)Turning point of the graph
Factored form−16(t − t₁)(t − t₂) with the two surd rootsWhen it exists
CheckVerifiedSubstituted back exactly
Graph for example 4: −16t² + 48t + 4 = 0Parabola for −16t² + 48t + 4 = 0. It meets the horizontal axis at the roots.0123−2002040t
The green dots are the two irrational roots. The purple diamond is the vertex.

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.

5
SPECIAL CASE: REPEATED ROOT

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.

a = 9b = 12c = 4D = 0Repeated root
ResultValueNote
Standard form9x² + 12x + 4 = 0Every term on one side
Discriminant0From the whole-number form of the equation
Nature of rootsRepeated rootRead from the sign of D
Exact rootsx = −2/3 (repeated root)Fractions and surds kept exact
Decimal rootsx = −0.6667To 4 decimal places
Vertex(−2/3, 0)Turning point of the graph
Factored form(3x + 2)²When it exists
CheckVerifiedSubstituted back exactly
Graph for example 5: 9x² + 12x + 4 = 0Parabola for 9x² + 12x + 4 = 0. It meets the horizontal axis at the roots.−2−1.5−1−0.500.5051015x
The parabola touches the axis once, at its vertex. That single point is the repeated root.

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).

6
NO REAL SOLUTION

A negative discriminant

Not a mistake: the roots are complex.

Solve 2x² − 2x + 5 = 0. Here a = 2, b = −2 and c = 5.

a = 2b = −2c = 5D = −36Complex roots
ResultValueNote
Standard form2x² − 2x + 5 = 0Every term on one side
Discriminant−36From the whole-number form of the equation
Nature of rootsComplex rootsRead from the sign of D
Exact rootsx = 1/2 ± (3/2)iFractions and surds kept exact
Decimal rootsx₁ = 0.5000 − 1.5000i, x₂ = 0.5000 + 1.5000iTo 4 decimal places
Vertex(1/2, 9/2)Turning point of the graph
Factored formDoes not factor over the real numbersWhen it exists
CheckVerifiedSubstituted back exactly
Graph for example 6: 2x² − 2x + 5 = 0Parabola for 2x² − 2x + 5 = 0. It does not meet the horizontal axis.−10120510xno x-intercepts
The whole curve sits above the axis, so there is no green dot: no real root exists.

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.

7
LARGE NUMBERS

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.

a = 1b = −2025c = 1000000D = 100625Two real roots
ResultValueNote
Standard formx² − 2025x + 1000000 = 0Every term on one side
Discriminant100625From the whole-number form of the equation
Nature of rootsTwo real rootsRead from the sign of D
Exact rootsx = (2025 ± 25√161)/2Fractions and surds kept exact
Decimal rootsx₁ = 853.8928, x₂ = 1171.1072To 4 decimal places
Vertex(2025/2, −100625/4)Turning point of the graph
Factored form(x − x₁)(x − x₂) with the two surd rootsWhen it exists
CheckVerifiedSubstituted back exactly
Graph for example 7: x² − 2025x + 1000000 = 0Parabola for x² − 2025x + 1000000 = 0. It meets the horizontal axis at the roots.80010001200−250000250005000075000x
The green dots are the two irrational roots. The purple diamond is the vertex.

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.

8
TRAP: THE SIGN OF −b

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.

a = 2b = −7c = 3D = 25Two real roots
ResultValueNote
Standard form2x² − 7x + 3 = 0Every term on one side
Discriminant25From the whole-number form of the equation
Nature of rootsTwo real rootsRead from the sign of D
Exact rootsx = 1/2 or x = 3Fractions and surds kept exact
Decimal rootsx₁ = 0.5000, x₂ = 3.0000To 4 decimal places
Vertex(7/4, −25/8)Turning point of the graph
Factored form(2x − 1)(x − 3)When it exists
CheckVerifiedSubstituted back exactly
Graph for example 8: 2x² − 7x + 3 = 0Parabola for 2x² − 7x + 3 = 0. It meets the horizontal axis at the roots.0123−2.502.55x
The green dots are the two roots. The purple diamond is the vertex.

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

  1. Write the equation in standard form, ax² + bx + c = 0. Move every term to one side. Here it is already done.
  2. Write down a, b and c with their signs. a = 3, b = −5, c = −2.
  3. Write the formula in letters. x = (−b ± √(b² − 4ac)) ÷ 2a. This line often earns a mark by itself.
  4. Work out the discriminant first. D = (−5)² − 4(3)(−2) = 25 + 24 = 49. Put b in brackets before you square it.
  5. Read the discriminant. D is positive and 49 = 7², so expect two rational roots.
  6. Substitute. x = (−(−5) ± √49) ÷ (2 × 3) = (5 ± 7) ÷ 6.
  7. Split the ±. x = (5 + 7) ÷ 6 = 12 ÷ 6 = 2, and x = (5 − 7) ÷ 6 = −2 ÷ 6 = −1/3.
  8. Check. 3(2)² − 5(2) − 2 = 12 − 10 − 2 = 0. 3(−1/3)² − 5(−1/3) − 2 = 1/3 + 5/3 − 2 = 0.
  9. 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.

CalculatorKeysWhat 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 answersx₁ = 2, x₂ = −1/3, then the minimum point
Casio fx-991ES PLUSMODE 5 (EQN), 3 (aX² + bX + c = 0), then 3 = −5 = −2 = =X₁ = 2, X₂ = −1/3
Casio fx-570MS and fx-991MSPress 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 rootx₁ = 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 appapps, 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 graphy= 3X² − 5X − 2, graph, then 2nd trace (calc), choose 2: zero, mark a left bound, a right bound and a guess for each rootX = −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

SituationEquationBest methodWhy
When does a ball land?−4.9t² + 20t + 1.5 = 0Quadratic formulaDecimal coefficients, D is not a square
A rectangle 3 m longer than wide has area 40 m²x² + 3x − 40 = 0Factoring(x + 8)(x − 5), small whole numbers
What is the lowest cost?C = 2x² − 12x + 25Completing the squareYou want the vertex, not the roots
Break-even points for profit−0.5x² + 40x − 300 = 0Quadratic formulaDecimals, and both roots matter

A quick decision path

  1. Is there no x term? Isolate x² and take ± the square root.
  2. Is there no constant? Factor out x.
  3. Compute D = b² − 4ac. Is it a perfect square? Then factor, or use the formula if you prefer.
  4. Is D positive but not a square, or negative? Use the quadratic formula.
  5. 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

  1. 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.
  2. 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.
  3. One letter stands for the unknown. x, t, n or any single letter works. Two different letters in one equation are rejected.
  4. 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".
  5. Decimals are rounded half away from zero to the number of places you choose. The exact form is never rounded.

Limitations

  1. Degree 2 only. Cubic and higher equations need other methods, such as the rational root theorem or a numerical root finder.
  2. 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.
  3. 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.
  4. 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.
  5. Word problems still need you. The tool solves the equation. Deciding which root makes sense, for example rejecting a negative length, is your job.
  6. 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

APA 7th edition
Pushbanathan, R. (2026). Quadratic formula calculator [Interactive mathematics tool]. StatsUnlock. Retrieved November 10, 2026, from https://statsunlock.com/quadratic-formula-calculator/
BibTeX
@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/}}
Methods or working sentence
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

📖 22. Glossary of Terms

TermPlain-English meaning
Axis of symmetryThe vertical line x = −b ÷ 2a that cuts the parabola into two mirror halves.
CoefficientThe number multiplying a power of x. In 3x² − 5x − 2 the coefficients are 3 and −5.
Completing the squareRewriting ax² + bx + c as a(x − h)² + k. The quadratic formula is derived this way.
Complex conjugatesA pair such as −1 + 2i and −1 − 2i, with the same real part and opposite imaginary parts.
Complex numberA number of the form p + qi, where i² = −1.
Constant termThe number with no x attached, called c.
DiscriminantD = b² − 4ac. Its sign tells you how many real roots there are.
Double rootAnother name for a repeated root, which happens when D = 0.
Factored formThe quadratic written as a product, such as (3x + 1)(x − 2).
Imaginary unitThe symbol i, defined by i² = −1.
Irrational numberA number that cannot be written as a fraction, such as √3.
Leading coefficientThe number in front of x², called a. It must not be 0.
ParabolaThe U-shaped graph of a quadratic function.
Perfect squareA whole number that is the square of another whole number, such as 49 = 7².
Quadratic equationAn equation that can be written as ax² + bx + c = 0 with a not 0.
Quadratic formulax = (−b ± √(b² − 4ac)) ÷ 2a, which gives the roots of any quadratic equation.
Rational numberA number that can be written as a fraction of two whole numbers.
RootA value of x that makes the equation true. Also called a solution or a zero.
Standard formThe arrangement ax² + bx + c = 0, with every term on one side.
SurdA square root that does not simplify to a whole number or fraction, such as √13.
VertexThe turning point of the parabola, at (−b ÷ 2a, c − b² ÷ 4a).
Vieta's formulasThe rules that the roots add to −b ÷ a and multiply to c ÷ a.
Zero of a functionAn 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.

  1. 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
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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
  11. 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
  12. Kieran, C. (1981). Concepts associated with the equality symbol. Educational Studies in Mathematics, 12(3), 317–326. https://doi.org/10.1007/BF00311062
  13. 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
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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
  19. 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
  20. 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
STATS UNLOCK · statsunlock.com · Quadratic Formula Calculator
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Statistical Models

Important Plots & Charts

Calculators and Converters