Equation Solver
Solve linear equations in the form ax + b = c. Enter your equation and get the value of x instantly.
Solving linear and quadratic equations
A linear equation has exactly one solution unless it has none or infinitely many. A quadratic has two, which may coincide or may be complex. Knowing which case you are in before you start saves you from misreading a valid "no solution" as an error.
Formula
Linear: ax + b = 0 => x = -b / a | Quadratic: ax^2 + bx + c = 0 => x = (-b +/- sqrt(b^2 - 4ac)) / 2a
Both require a to be non-zero. If a = 0 in a quadratic, it is really a linear equation.
The three outcomes of a linear equation
Rearranging ax + b = 0 gives x = -b/a, provided a is not zero. When a is zero, two distinct things can happen and they mean opposite things.
- a is non-zero: exactly one solution, x = -b/a. The normal case.
- a = 0 and b is non-zero: the equation reduces to b = 0, which is false. No solution exists. Graphically, two parallel lines that never meet.
- a = 0 and b = 0: the equation reduces to 0 = 0, true for every x. Infinitely many solutions. Graphically, the same line twice.
- The last two cases are not failures of the method. In systems of equations they signal an inconsistent or an under-determined model, which is genuine information.
The discriminant tells you the answer before you solve
For a quadratic, the quantity D = b^2 - 4ac under the square root determines the nature of the roots without computing them.
- D > 0: two distinct real roots. The parabola crosses the x-axis twice.
- D = 0: one repeated real root at x = -b/2a. The parabola touches the axis at its vertex.
- D < 0: two complex conjugate roots. The parabola never touches the axis. In physical models this usually means the condition you are solving for cannot occur.
- D being a perfect square additionally tells you the roots are rational, which means the quadratic factorises neatly over the integers.
Checks that catch arithmetic errors
Vieta's formulas give two independent checks that take seconds. For ax^2 + bx + c = 0, the sum of the roots is -b/a and their product is c/a.
If your two roots do not sum to -b/a, you have made an error. This catches sign mistakes, which are by far the most frequent, and it is faster than substituting back into the original equation.
One numerical warning: when b^2 is much larger than 4ac, the standard formula subtracts two nearly equal numbers for one of the roots and loses precision. The stable alternative computes the larger root first, then obtains the smaller as c / (a x larger root).
Worked example
Solve 2x^2 - 7x + 3 = 0. Here a = 2, b = -7, c = 3.
Discriminant: D = 49 - 24 = 25, a perfect square, so expect two rational roots.
Roots: x = (7 +/- 5) / 4, giving x = 3 and x = 0.5.
Check with Vieta: the sum should be -b/a = 3.5, and 3 + 0.5 = 3.5. The product should be c/a = 1.5, and 3 x 0.5 = 1.5. Both hold, so the answer is confirmed without substitution.
Reading the discriminant
| b^2 - 4ac | Roots | Graph |
|---|---|---|
| Positive, perfect square | Two rational | Crosses axis at two rational points |
| Positive, not a perfect square | Two irrational | Crosses axis twice |
| Zero | One repeated real | Touches axis at the vertex |
| Negative | Two complex conjugates | Never touches the axis |
Frequently Asked Questions
Related calculators
References
- NIST Digital Library of Mathematical Functions - algebraic equations
- IEEE 754-2019 - floating-point arithmetic standard
Last reviewed: 2026-08-07. This page is informational. For legal, medical, tax, or financial decisions, confirm the result with a qualified professional.