Quadratic Equation Solver
Enter the coefficients (a, b, c) for the equation in the form: ax² + bx + c = 0
Results:
Enter coefficients and click "Calculate Roots" to see the solution.
Results:
'; if (isNaN(a) || isNaN(b) || isNaN(c)) { resultDiv.innerHTML = output + 'Please enter valid numbers for all coefficients.'; return; } if (a === 0) { if (b === 0) { if (c === 0) { resultDiv.innerHTML = output + 'This is the trivial equation 0 = 0, which has infinite solutions.'; } else { resultDiv.innerHTML = output + 'This is the equation ' + c + ' = 0, which has no solution.'; } } else { // Linear equation: bx + c = 0 => x = -c/b var x = -c / b; resultDiv.innerHTML = output + 'This is a linear equation (a=0). The root is: x = ' + x.toFixed(4) + ''; } return; } var discriminant = b * b – 4 * a * c; if (discriminant > 0) { var x1 = (-b + Math.sqrt(discriminant)) / (2 * a); var x2 = (-b – Math.sqrt(discriminant)) / (2 * a); output += 'The equation has two distinct real roots:'; output += 'x₁ = ' + x1.toFixed(4) + ''; output += 'x₂ = ' + x2.toFixed(4) + ''; } else if (discriminant === 0) { var x = -b / (2 * a); output += 'The equation has one real root (repeated root):'; output += 'x = ' + x.toFixed(4) + ''; } else { // discriminant < 0 var realPart = -b / (2 * a); var imaginaryPart = Math.sqrt(Math.abs(discriminant)) / (2 * a); output += 'The equation has two complex conjugate roots:'; output += 'x₁ = ' + realPart.toFixed(4) + ' + ' + imaginaryPart.toFixed(4) + 'i'; output += 'x₂ = ' + realPart.toFixed(4) + ' – ' + imaginaryPart.toFixed(4) + 'i'; } resultDiv.innerHTML = output; }Understanding the Quadratic Equation and Its Solver
A quadratic equation is a fundamental concept in algebra, representing a polynomial equation of the second degree. It is typically written in the standard form:
ax² + bx + c = 0
where 'x' represents an unknown variable, and 'a', 'b', and 'c' are numerical coefficients. The coefficient 'a' cannot be zero; if 'a' were zero, the equation would become a linear equation (bx + c = 0).
The Role of Coefficients (a, b, c)
- 'a' (Quadratic Coefficient): This coefficient determines the curvature of the parabola when the equation is graphed. If 'a' is positive, the parabola opens upwards; if 'a' is negative, it opens downwards. As mentioned, 'a' cannot be zero for it to be a quadratic equation.
- 'b' (Linear Coefficient): This coefficient influences the position of the parabola's vertex and its axis of symmetry.
- 'c' (Constant Term): This coefficient represents the y-intercept of the parabola, i.e., where the graph crosses the y-axis (when x = 0).
Solving Quadratic Equations: The Quadratic Formula
The most common and reliable method for finding the roots (or solutions) of a quadratic equation is using the quadratic formula:
x = [-b ± √(b² – 4ac)] / 2a
This formula provides the values of 'x' that satisfy the equation. The term inside the square root, (b² – 4ac), is called the discriminant, often denoted by the Greek letter Delta (Δ).
Understanding the Discriminant (Δ)
The discriminant plays a crucial role in determining the nature of the roots:
- If Δ > 0 (Positive Discriminant): The equation has two distinct real roots. This means the parabola intersects the x-axis at two different points.
- If Δ = 0 (Zero Discriminant): The equation has exactly one real root (also called a repeated or double root). The parabola touches the x-axis at exactly one point (its vertex).
- If Δ < 0 (Negative Discriminant): The equation has two complex conjugate roots. This means the parabola does not intersect the x-axis at all. The roots involve the imaginary unit 'i' (where i² = -1).
How to Use the Quadratic Equation Solver
Our Quadratic Equation Solver simplifies the process of finding these roots. Simply input the numerical values for the coefficients 'a', 'b', and 'c' into the respective fields. The calculator will then apply the quadratic formula and display the roots, indicating whether they are real, repeated, or complex.
Examples:
- Two Distinct Real Roots:
- Equation: x² – 5x + 6 = 0
- Coefficients: a=1, b=-5, c=6
- Discriminant: (-5)² – 4(1)(6) = 25 – 24 = 1 (Positive)
- Roots: x₁ = 3, x₂ = 2
- One Real (Repeated) Root:
- Equation: x² + 4x + 4 = 0
- Coefficients: a=1, b=4, c=4
- Discriminant: (4)² – 4(1)(4) = 16 – 16 = 0 (Zero)
- Root: x = -2
- Two Complex Conjugate Roots:
- Equation: x² + x + 1 = 0
- Coefficients: a=1, b=1, c=1
- Discriminant: (1)² – 4(1)(1) = 1 – 4 = -3 (Negative)
- Roots: x₁ = -0.5 + 0.8660i, x₂ = -0.5 – 0.8660i
This calculator is a valuable tool for students, engineers, and anyone needing to quickly and accurately solve quadratic equations without manual calculation.