Quadratic Formula Derivation — Step-by-Step CAS Verification
Complete derivation of the quadratic formula with automated CAS verification. Learn how mode=solve verifies equation-solving steps and detects lost or extraneous solutions.
Introduction
This tutorial demonstrates the mode=solve feature by deriving the quadratic formula with step-by-step CAS verification. You'll learn why mode=solve is essential for equation-solving derivations and how it detects lost or extraneous solutions.
a is NOT an algebraic equivalence (the expressions differ by factor a), but the equations have the same solutions when a ≠ 0.Understanding the Difference
Let's understand why mode=chain fails for equation-solving derivations:
| Mode | What It Checks | Use For |
|---|---|---|
| chain | Algebraic equivalence: simplify(expr1 - expr2) == 0 | Factoring, expanding, simplifying |
| solve | Solution-set equivalence: solveset(eq1) == solveset(eq2) | Equation solving, isolating variables |
Consider the step "divide both sides by a":
ax² + bxandx² + (b/a)xare NOT algebraically equivalent- But the equations
ax² + bx = -candx² + (b/a)x = -c/ahave the SAME solution set
The Derivation
Step 1: Start with the General Quadratic Equation
We begin with the standard form of a quadratic equation where a ≠ 0:
General Quadratic Equation
The starting point of our derivation
where a=0.
Step 2: Subtract c from Both Sides
Subtract c
Moving the constant term to the right side
Expected Result: ✅ EQUIV (same solution set)
Step 3: Divide Both Sides by a
This is where mode=solve shines. This step would FAIL with mode=chain because the expressions are NOT algebraically equivalent.
Divide by a
This step requires mode=solve because expressions differ by factor a
Expected Result: ✅ EQUIV (same solution set when a ≠ 0)
mode=chain checks if ax² + bx equals x² + (b/a)x. These are NOT equal (they differ by factor a). But mode=solve checks if the equations have the same solutions, which they do.Step 4: Complete the Square
Add (b/2a)² to both sides:
Complete the Square
Adding (b/2a)² to both sides
Expected Result: ✅ EQUIV
Step 5a: Simplify the Right Side
Combine the fractions on the right side:
Simplify Right Side
Combining fractions
Expected Result: ✅ EQUIV
Step 5b: Factor the Left Side as a Perfect Square
Factor as Perfect Square
The left side is a perfect square trinomial
Expected Result: ✅ EQUIV
Step 6: Take the Square Root of Both Sides
This is a critical step. We must use ± to capture both solutions:
Take Square Root
Using ± to preserve both solutions
Expected Result: ✅ EQUIV (the ± captures both solutions)
x + b/(2a) = sqrt(b² - 4ac)/(2a) (without ±), the CAS would return NARROWS because we'd lose one solution.Step 7: Solve for x
Solve for x
The final step - isolating x
Expected Result: ✅ EQUIV — We've derived the quadratic formula!
Full Derivation Chain
Here's the complete derivation verified in one block:
Complete Quadratic Formula Derivation
All steps verified together
Expected Result: ✅ EQUIV for all steps
Demonstrating NARROWS and WIDENS
The mode=solve feature can detect when derivation steps lose or introduce solutions.
Example: NARROWS (Lost Solutions)
When we take a square root without ±, we lose solutions:
Lost Solutions Example
Taking square root without ± loses the negative solution
Expected Result: ⚠️ NARROWS — The first equation has solutions {-2, 2}, but the second only has {2}. We lost the x = -2 solution.
Example: WIDENS (Extraneous Solutions)
When we square both sides, we can introduce extraneous solutions:
Extraneous Solutions Example
Squaring both sides introduces an extra solution
Expected Result: ⚠️ WIDENS — The first equation has solution {2}, but the second has {-2, 2}. We added the extraneous solution x = -2.
Example: Correct Use of ±
Using ± preserves the solution set:
Preserving Solutions with ±
Using ± keeps both solutions
Expected Result: ✅ EQUIV — Both equations have the same solution set {-2, 2}.
Domain Options
The domain attribute specifies where to look for solutions:
| Domain | Description | Example |
|---|---|---|
| R (default) | Real numbers | x² = 4 → {-2, 2} |
| C | Complex numbers | x² = -1 → {i, -i} |
| Z | Integers | 2x = 4 → {2} |
| N | Natural numbers | x = 2 → {2} |
Example: Complex Domain
Complex Domain Example
Finding solutions in the complex numbers
Expected Result: ✅ EQUIV — Both have solutions {i, -i} in the complex domain.
When to Use Each Mode
| Scenario | Mode | Reason |
|---|---|---|
| Verify identity: sin²(x) + cos²(x) = 1 | equivalence | Expression identity |
| Factor: x² - 1 = (x-1)(x+1) | chain | Expression rewrite |
| Simplify: (x²-1)/(x-1) = x+1 | chain | Algebraic simplification |
| Solve: ax² + bx + c = 0 → quadratic formula | solve | Equation derivation |
| Isolate variable: 2x + 3 = 7 → x = 2 | solve | Solution-set transformation |
Status Indicators for mode=solve
| Status | Meaning | Example |
|---|---|---|
| ✅ EQUIV | Same solution set (valid transformation) | 2x = 4 → x = 2 |
| ⚠️ NARROWS | Lost solutions (e.g., forgot ± when taking square root) | x² = 4 → x = 2 |
| ⚠️ WIDENS | Extraneous solutions (e.g., squared both sides) | x = 2 → x² = 4 |
| ❓ UNKNOWN | Cannot determine relationship | Complex expressions |
| ❌ ERROR | Parse or solve failed | Invalid LaTeX |
Multiple Solutions Syntax
Use \pm or \text{or} to express multiple solutions:
Multiple Solutions Syntax
Two ways to express multiple solutions
Using ±: x=±2
Using "or": x=2orx=−2
Both are equivalent to the solution set {-2, 2}.
Best Practices
mode=solve.assumptions="a != 0" since we divide by a.\pm when taking square roots of both sides to preserve all solutions. The CAS will warn you with NARROWS if you forget.solve_var=x to explicitly tell the CAS which variable you're solving for. This helps when you have multiple variables like a, b, c, and x.Next Steps
Now that you understand mode=solve, explore more CAS verification examples in the CAS Verification Demo, which covers mode=equivalence and mode=chain for expression verification.
Related Content
CAS Verification Demo — Automated Math Checking
Interactive examples demonstrating AutEng's Computer Algebra System (CAS) verification. See how mathematical expressions and derivations are automatically verified with SymPy.
KaTeX Syntax Quick Reference — Math Equations in Markdown
Complete reference for KaTeX mathematical notation including common formulas, symbols, and usage patterns for technical documentation.
Calculus in Technical Documentation — Derivatives and Integrals
Master calculus notation in technical docs with KaTeX. Learn derivatives, integrals, limits, and differential equations for software, physics, and engineering documentation.
Set Theory and Logic Notation — Mathematical Foundations
Complete guide to set theory and logic notation in technical documentation. Learn sets, operations, logic symbols, quantifiers, and proof notation with KaTeX.
Ready to Start?
Start creating beautiful technical documentation with AutEng.
Get Started with AutEng