Math Equation Calculator

Quadratic Equation Solver

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:

ax² + bx + c = 0

where 'x' represents an unknown, and 'a', 'b', and 'c' are coefficients, with 'a' not equal to zero. The solutions to a quadratic equation are called its roots, and they represent the x-intercepts of the parabola defined by the equation.

This calculator helps you find the roots of any quadratic equation by simply entering the coefficients 'a', 'b', and 'c'.

Enter Coefficients

Enter values and click 'Calculate Roots' to see the solutions.

Understanding the Quadratic Formula

The roots of a quadratic equation are found using the quadratic formula:

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

The term inside the square root, (b² – 4ac), is called the discriminant (Δ). Its value 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 (a repeated root). The parabola touches the x-axis at exactly one point.
  • If Δ < 0: There are no real roots. Instead, there are two complex conjugate roots. The parabola does not intersect the x-axis.

Examples of Quadratic Equations

  • Example 1: Two Real Roots
    Equation: x² – 3x + 2 = 0
    Coefficients: a=1, b=-3, c=2
    Discriminant: (-3)² – 4(1)(2) = 9 – 8 = 1 (Δ > 0)
    Roots: x1 = 2, x2 = 1
  • Example 2: One Real Root (Repeated)
    Equation: x² – 4x + 4 = 0
    Coefficients: a=1, b=-4, c=4
    Discriminant: (-4)² – 4(1)(4) = 16 – 16 = 0 (Δ = 0)
    Root: x = 2
  • Example 3: Complex Roots
    Equation: x² + 2x + 5 = 0
    Coefficients: a=1, b=2, c=5
    Discriminant: (2)² – 4(1)(5) = 4 – 20 = -16 (Δ < 0)
    Roots: x1 = -1 + 2i, x2 = -1 – 2i
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('result'); 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 is a linear equation.'; return; } var discriminant = b * b – 4 * a * c; var x1, x2; if (discriminant > 0) { x1 = (-b + Math.sqrt(discriminant)) / (2 * a); x2 = (-b – Math.sqrt(discriminant)) / (2 * a); resultDiv.innerHTML = 'Two Real Roots:x1 = ' + x1.toFixed(4) + 'x2 = ' + x2.toFixed(4); } else if (discriminant === 0) { x1 = -b / (2 * a); resultDiv.innerHTML = 'One Real Root (Repeated):x = ' + x1.toFixed(4); } else { var realPart = (-b / (2 * a)).toFixed(4); var imaginaryPart = (Math.sqrt(Math.abs(discriminant)) / (2 * a)).toFixed(4); resultDiv.innerHTML = 'No Real Roots (Complex Roots):x1 = ' + realPart + ' + ' + imaginaryPart + 'ix2 = ' + realPart + ' – ' + imaginaryPart + 'i'; } }

Leave a Reply

Your email address will not be published. Required fields are marked *