Calculator Scientific Online

Quadratic Equation Solver

Use this calculator to find the roots (solutions) of a quadratic equation in the standard form: ax² + bx + c = 0.

Understanding Quadratic Equations

A quadratic equation is a polynomial equation of the second degree, meaning it contains at least one term in which the unknown variable is raised to the power of two. The standard form of a quadratic equation is written as:

ax² + bx + c = 0

Where:

  • x represents the unknown variable.
  • a, b, and c are coefficients, with a not equal to zero.

The "roots" or "solutions" of a quadratic equation are the values of x that satisfy the equation, making the entire expression equal to zero. Graphically, these are the x-intercepts where the parabola (the graph of a quadratic function) crosses the x-axis.

The Quadratic Formula

The most common method to find the roots of a quadratic equation is by using the quadratic formula:

x = [-b ± √(b² - 4ac)] / 2a

The term inside the square root, (b² - 4ac), is called the discriminant, often denoted by Δ (Delta). The value of the discriminant determines the nature of the roots:

  • If Δ > 0: There are two distinct real roots. The parabola intersects the x-axis at two different points.
  • If Δ = 0: There is exactly one real root (sometimes called a repeated or double root). The parabola touches the x-axis at exactly one point.
  • If Δ < 0: There are two complex conjugate roots. The parabola does not intersect the x-axis.

How to Use This Calculator

  1. Identify Coefficients: Look at your quadratic equation and identify the values for a, b, and c. Remember to include their signs (positive or negative).
  2. Enter Values: Input these values into the respective fields: "Coefficient 'a'", "Coefficient 'b'", and "Coefficient 'c'".
  3. Calculate: Click the "Calculate Roots" button.
  4. Interpret Results: The calculator will display the roots of your equation, indicating if they are real or complex.

Examples

Let's look at some common scenarios:

Example 1: Two Distinct Real Roots

Equation: x² - 3x + 2 = 0

  • a = 1
  • b = -3
  • c = 2

Using the calculator with these values will yield: Root 1: 2, Root 2: 1

Example 2: One Real Root (Repeated)

Equation: x² - 4x + 4 = 0

  • a = 1
  • b = -4
  • c = 4

Using the calculator with these values will yield: Root 1: 2, Root 2: 2

Example 3: Two Complex Conjugate Roots

Equation: x² + 2x + 5 = 0

  • a = 1
  • b = 2
  • c = 5

Using the calculator with these values will yield: Root 1: -1 + 2i, Root 2: -1 – 2i

Example 4: Missing Terms

Equation: 2x² - 8 = 0 (Here, b = 0)

  • a = 2
  • b = 0
  • c = -8

Using the calculator with these values will yield: Root 1: 2, Root 2: -2

.calculator-container { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f9f9f9; border: 1px solid #ddd; padding: 20px; border-radius: 8px; max-width: 700px; margin: 20px auto; box-shadow: 0 4px 8px rgba(0,0,0,0.05); } .calculator-container h2 { color: #333; text-align: center; margin-bottom: 20px; } .calculator-container p { color: #555; line-height: 1.6; } .calculator-inputs label { display: block; margin-bottom: 8px; color: #333; font-weight: bold; } .calculator-inputs input[type="number"] { width: calc(100% – 22px); padding: 10px; margin-bottom: 15px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; } .calculator-inputs button { background-color: #007bff; color: white; padding: 12px 20px; border: none; border-radius: 4px; cursor: pointer; font-size: 16px; width: 100%; box-sizing: border-box; transition: background-color 0.3s ease; } .calculator-inputs button:hover { background-color: #0056b3; } .calculator-result { background-color: #e9ecef; border: 1px solid #ced4da; padding: 15px; margin-top: 20px; border-radius: 4px; font-size: 1.1em; color: #333; min-height: 50px; display: flex; align-items: center; justify-content: center; text-align: center; font-weight: bold; } .calculator-article { margin-top: 30px; padding-top: 20px; border-top: 1px solid #eee; } .calculator-article h3 { color: #333; margin-top: 25px; margin-bottom: 15px; } .calculator-article ul { list-style-type: disc; margin-left: 20px; color: #555; } .calculator-article ol { list-style-type: decimal; margin-left: 20px; color: #555; } .calculator-article li { margin-bottom: 8px; } .calculator-article code { background-color: #e0e0e0; padding: 2px 4px; border-radius: 3px; font-family: 'Courier New', Courier, monospace; color: #c7254e; } function calculateQuadraticRoots() { var a = parseFloat(document.getElementById("coefficientA").value); var b = parseFloat(document.getElementById("coefficientB").value); var c = parseFloat(document.getElementById("coefficientC").value); var resultDiv = document.getElementById("quadraticResult"); if (isNaN(a) || isNaN(b) || isNaN(c)) { resultDiv.innerHTML = "Please enter valid numbers for all coefficients."; return; } if (a === 0) { resultDiv.innerHTML = "Coefficient 'a' cannot be zero for a quadratic equation. This would be a linear equation."; return; } var discriminant = b * b – 4 * a * c; var root1, root2; if (discriminant > 0) { root1 = (-b + Math.sqrt(discriminant)) / (2 * a); root2 = (-b – Math.sqrt(discriminant)) / (2 * a); resultDiv.innerHTML = "Root 1: " + root1.toFixed(4) + "Root 2: " + root2.toFixed(4); } else if (discriminant === 0) { root1 = -b / (2 * a); resultDiv.innerHTML = "Root 1: " + root1.toFixed(4) + "Root 2: " + root1.toFixed(4) + " (repeated root)"; } else { var realPart = (-b / (2 * a)).toFixed(4); var imaginaryPart = (Math.sqrt(Math.abs(discriminant)) / (2 * a)).toFixed(4); resultDiv.innerHTML = "Root 1: " + realPart + " + " + imaginaryPart + "iRoot 2: " + realPart + " – " + imaginaryPart + "i (complex conjugate roots)"; } }

Leave a Comment