Education

Equation Solver

Solving an equation means finding the values of x that make both sides equal — the point where a graph crosses the x-axis. Enter the coefficients and the solver works through the appropriate method: rearrangement for linear, the quadratic formula for quadratics, and a numerically stable method for cubics.

Result
—
First root (x₁)
—
Second root (x₂)
—
Third root (x₃)
—
Root type
—
Discriminant (quadratic only)
—

What "solving" means

An equation ax + b = c is a statement that is true for certain values of x. Solving finds those values. Graphically, each root is where the curve crosses the x-axis — which is why a quadratic can have at most two roots and a cubic at most three, and why the "no real roots" case simply means the curve never touches the axis.

Linear equations: one root

ax + b = 0 → x = −b ÷ a

$3x − 7 = 0$ gives $x = 7/3 ≈ 2.333. One root because a line crosses the axis exactly once. The special cases matter: if a = 0 and b = 0, then every real number is a solution; if a = 0 and b ≠ 0, there is no solution. Those two are worth recognising rather than dividing by zero.

Quadratic equations

ax² + bx + c = 0 is solved by the quadratic formula, derived by completing the square:

x = [−b ± √(b² − 4ac)] ÷ 2a

The discriminant b² − 4ac decides the case before you take any root: positive means two real roots, zero means one repeated root, negative means two complex roots. $x^2 - 5x + 6 = 0$ has D = 1 and roots 3 and 2 — a case where factoring is faster, which is the normal relationship between the formula and factoring.

The full derivation, three worked examples and the numerically stable form are in the quadratic formula guide, and the dedicated quadratic solver also returns the vertex.

Cubic equations

ax³ + bx² + cx + d = 0 has no comparable closed-form formula that is useful in practice — the general cubic formula exists but involves complex intermediate arithmetic that obscures rather than reveals the roots. Two practical alternatives:

Factorisation. If the polynomial has a rational root (and for integer coefficients, the rational root theorem says the candidates are the factors of d divided by the factors of a), then dividing out that root leaves a quadratic. Test the likely candidates first — it is far faster than any numerical method when it works.

Numerical methods. Newton's method iterates x ← x − f(x)/f'(x) from a starting guess. This calculator uses it from several starting points and reports every distinct real root it converges to, which handles all three cases: three real roots, one real root with a complex pair, and three complex roots.

Worked example: a cubic with known roots

(x − 1)(x − 2)(x − 3) = x³ − 6x² + 11x − 6

So a = 1, b = −6, c = 11, d = −6, and the roots are 1, 2 and 3. The solver reports exactly that, which is a useful check: it confirms the coefficient expansion and the root-finding are both correct.

A less friendly example, x³ + 2x + 1 = 0: the rational root theorem gives ±1 as candidates, and neither works, so there is no rational root and numerical methods are the route. The single real root is approximately −0.4534, with the other two complex. This is a common shape for real problems — most cubics with no rational root have one real root and a complex pair.

Why numerical roots need care

Two failure modes are worth knowing. False convergence happens when the iteration lands on a stationary point where f' ≈ 0 — the method stalls rather than fails, which is why this solver tries several starting points instead of one. Scale sensitivity matters for large coefficients: with a = 1,000,000, the same algorithm can lose precision. When the coefficients are large integers, testing rational roots first is more reliable than any numerical approach.

Checking your own answers

Two cheap checks, both worth doing:

  • Substitute back. Plug the root into the original polynomial; it should give exactly 0 (or very close, if the root is rounded).
  • Check Vieta's relations. For a monic cubic the roots sum to −b, the pairwise products sum to c, and the product is −d. For a monic quadratic, the roots sum to −b/a and multiply to c/a. This catches a mis-transcribed coefficient immediately, and it is the same consistency check the quadratic solver uses internally.

Frequently asked questions

How do I solve a quadratic equation?

Use x = [−b ± √(b² − 4ac)] ÷ 2a. The discriminant b² − 4ac tells you the case first: positive for two real roots, zero for one repeated root, negative for two complex roots. If the factors are integers, factoring is faster.

Can every cubic be solved exactly?

A formula exists, but it involves complex intermediate values and is rarely useful by hand. In practice: test for rational roots (candidates are factors of d over factors of a) and factor if you find one; otherwise use a numerical method such as Newton's method.

How many roots can an equation have?

A degree-n polynomial has at most n real roots. So a linear equation has at most 1, a quadratic at most 2, and a cubic at most 3. An equation with fewer real roots than its degree has complex roots.

How do I check a solution?">

Substitute the root back into the original equation — it should give 0. For extra confidence, check Vieta's relations: the roots of a monic quadratic sum to −b/a and multiply to c/a, and for a monic cubic they sum to −b, pairwise products sum to c, and the product is −d.

Frequently asked questions

1. How do I solve a quadratic equation?

Use x = [-b +/- sqrt(b^2 - 4ac)] / 2a. The discriminant b^2 - 4ac tells you the case first: positive for two real roots, zero for one repeated root, negative for two complex roots. If the factors are integers, factoring is faster.

2. Can every cubic be solved exactly?

A formula exists, but it involves complex intermediate values and is rarely useful by hand. In practice: test for rational roots (candidates are factors of d over factors of a) and factor if you find one; otherwise use a numerical method such as Newton's.

3. How many roots can an equation have?

A degree-n polynomial has at most n real roots. So a linear equation has at most 1, a quadratic at most 2, and a cubic at most 3. An equation with fewer real roots than its degree has complex roots.

4. How do I check a solution?

Substitute the root back into the original equation - it should give 0. For extra confidence check Vieta's relations: the roots of a monic quadratic sum to -b/a and multiply to c/a; for a monic cubic they sum to -b, pairwise products sum to c, and the product is -d.

Related tools