Quadratic Equation Calculator

Enter coefficients of ax2+bx+c=0ax^2+bx+c=0. A negative discriminant produces conjugate complex roots with the displayed real part and ±i times the imaginary magnitude. When a is zero, the equation is linear.

Results

Enter your values and select Calculate.

x=−b±b2−4ac2ax=\frac{-b\pm\sqrt{b^2-4ac}}{2a}

About this tool

This quadratic equation calculator solves equations of the form ax2+bx+c=0ax^2 + bx + c = 0 and returns the real or complex roots. Students use it to check algebra homework, and it also helps with physics, geometry and optimization problems that reduce to a quadratic. The discriminant, b2−4acb^2 - 4ac, determines the type of roots: positive gives two real roots, zero gives one repeated real root and negative gives a pair of complex conjugate roots.

How it works

Rearrange your equation so everything is on one side and equals zero, then read off a, b and c. For 2x2=3x+52x^2 = 3x + 5, that means 2x2−3x−5=02x^2 - 3x - 5 = 0, so a=2a = 2, b=−3b = -3 and c=−5c = -5. Enter each coefficient with its sign, and enter 0 for any missing term.

The calculator computes the discriminant first to decide which kind of roots to return. For real roots it uses an algebraically equivalent form of the quadratic formula that avoids losing precision when b is much larger than a and c. For complex roots it shows the shared real part and the imaginary magnitude, so the two roots are that real part plus and minus that many times i.

x=−b±b2−4ac2ax=\frac{-b\pm\sqrt{b^2-4ac}}{2a}

Example

The default equation is x2−3x+2=0x^2 - 3x + 2 = 0, with a=1a = 1, b=−3b = -3 and c=2c = 2. The discriminant is (−3)2−4⋅1⋅2=9−8=1(-3)^2 - 4 \cdot 1 \cdot 2 = 9 - 8 = 1, which is positive, so there are two real roots. Applying the quadratic formula gives x=(3±1)/2x = (3 \pm 1) / 2, so the roots are 2 and 1, with an imaginary magnitude of 0. You can check by factoring: (x−1)(x−2)=0(x - 1)(x - 2) = 0.

Assumptions and limits

Coefficients must be finite real numbers. When a is zero the tool solves the linear equation instead and reports the same root twice; if a and b are both zero there is no unique solution. Results are floating-point approximations, not exact radicals. Complex roots are shown as a real part plus an imaginary magnitude.

Frequently asked questions

What does the discriminant tell you?

The discriminant b2−4acb^2 - 4ac tells you how many real roots there are. If it is positive there are two distinct real roots, if it is zero there is one repeated root and if it is negative the roots are complex. For x2−3x+2=0x^2 - 3x + 2 = 0 the discriminant is 1, so there are two real roots, 1 and 2.

What are complex roots?

When the discriminant is negative, the roots have the form p±qip \pm qi, where i is the square root of -1. For x2+2x+5=0x^2 + 2x + 5 = 0 the roots are −1±2i-1 \pm 2i. Complex roots of an equation with real coefficients always come in conjugate pairs. On a graph, a negative discriminant means the parabola never touches the x-axis.

What happens if a is zero?

The equation becomes linear, bx+c=0bx + c = 0, with the single solution x=−c/bx = -c/b when b is not zero. It is no longer a quadratic equation. The calculator handles this case automatically and shows the linear root in both result fields. If a and b are both zero, there is either no solution or every x works, so no single root is returned.

How can I check the roots?

Substitute each root back into the equation and confirm the result is zero. You can also check that the roots add up to −b/a-b/a and multiply to c/ac/a. For the default equation, 2+1=32 + 1 = 3, which is −(−3)/1, and 2×1=22 \times 1 = 2, which is 2/1, so both checks pass.

How do I find the vertex of the parabola?

The vertex lies at x=−b/(2a)x = -b/(2a), halfway between the two roots. Substitute that x back into the expression to get the y-value. For x2−3x+2x^2 - 3x + 2, the vertex is at x=1.5x = 1.5 and y=−0.25y = -0.25. This calculator returns the roots only, so work out the vertex by hand with this rule.

Link with your values

Add these parameters to this page’s address to open it with the values filled in, for example to share a calculation or to link to it from an AI assistant. The result is calculated in the browser: the page HTML shows an example for the default values, and the tool sets the data-url-params attribute once the link’s values are applied.

ParameterValueIf omitted
aAnumberrequired
bBnumberrequired
cCnumberrequired

Examples

  • ?a=2&b=-4&c=-6
  • ?a=1&b=2&c=5

Write decimals with a point. Encode a space as %20, + as %2B, # as %23 and & as %26.

Result elements: [data-result-block="quadratic_calculator"]