Equation Solver

Equation Solver

Solve linear, quadratic, cubic equations and systems of equations online. Step-by-step solutions with graphing. Free math equation solver calculator

Quadratic formula on paper takes 30 seconds. Solving a cubic with the Cardano formula by hand takes 20 minutes and you will probably get it wrong. Quartics are worse, quintics are impossible by radicals (Abel-Ruffini, 1824), and systems of equations need linear algebra. This solver handles linear, quadratic, cubic, quartic, polynomial root-finding (numeric), trigonometric, exponential, and linear systems — with steps shown for the analytically-solvable cases and reliable numeric methods for the rest.

What you can actually solve in closed form

  • Linear (ax + b = 0) — trivial, x = -b/a.
  • Quadratic (ax² + bx + c = 0) — closed form via the quadratic formula. Three discriminant cases: > 0 (two real roots), = 0 (one repeated), < 0 (complex conjugate pair).
  • Cubic (ax³ + bx² + cx + d = 0) — closed form via Cardano (1545) or trigonometric form. Always has at least one real root. The formula is real-valued for three real roots but requires complex arithmetic to evaluate.
  • Quartic — closed form via Ferrari (1540). Practical but tedious.
  • Quintic and higher — Abel-Ruffini: no general algebraic solution exists. Numeric methods only.
  • Special transcendentals — sin(x) = a, e^x = a, log(x) = a all have closed forms. Mixed (sin(x) + x = 0) generally do not.
  • Linear systems Ax = b — Gauss-Jordan elimination; closed form if A is invertible.

Working example: a quadratic with each discriminant case

Input

Solve: x² - 5x + 6 = 0

Output

Standard form: ax² + bx + c = 0 with a=1, b=-5, c=6.

Discriminant: Δ = b² - 4ac = 25 - 24 = 1
Δ > 0 → two distinct real roots

Quadratic formula: x = (-b ± √Δ) / (2a) = (5 ± 1) / 2
  x₁ = 3
  x₂ = 2

Verification: factoring x² - 5x + 6 = (x - 2)(x - 3) ✓

For a quadratic with Δ < 0 (e.g., x² + x + 1 = 0), the solver gives complex conjugate roots: x = (-1 ± i√3) / 2. Whether you want real or complex output depends on context — physics problems usually want real; signal processing wants complex.

When to use which method

  • Polynomial roots — for degree ≤ 4 use closed-form (exact when coefficients are integers; floating point otherwise). For degree ≥ 5 or for non-polynomial equations use numeric methods (Newton-Raphson, bisection).
  • Bisection — guaranteed convergence on a sign change in [a, b]. Slow (linear convergence) but bombproof. Use as fallback when faster methods fail.
  • Newton-Raphson — quadratic convergence near a root, but needs a good initial guess and the derivative. Diverges in pathological cases (multiple roots, oscillating behavior).
  • Brent's method — combines bisection's reliability with secant/inverse-quadratic interpolation's speed. The default in scipy.optimize.brentq. The right answer for "find a root in this interval" most of the time.
  • Symbolic — if exact symbolic answers matter, use a CAS (SymPy, Maple, Mathematica) — this tool is numeric.

Linear systems — when to use what

For Ax = b: if A is square and invertible, x = A^-1 b is the textbook answer but numerically wasteful. Production solvers use LU decomposition (general dense), Cholesky (symmetric positive-definite), or QR (rectangular least-squares). For sparse A, use specialized solvers (CG, BiCGSTAB).

If A is rectangular (more equations than unknowns), the system is overdetermined — typically no exact solution exists. Find the least-squares solution that minimizes ‖Ax - b‖². If fewer equations than unknowns (underdetermined), infinite solutions exist; pick a basis or specify a constraint (e.g., minimum-norm solution).

When to reach for this tool

  • You need to solve a quadratic or cubic in the middle of an interview, problem set, or design calculation and want to skip the algebra.
  • You are checking the result of a manual solution against a trusted reference.
  • You are computing physics or engineering quantities (projectile motion, RLC circuit analysis, beam deflection) where the equations are textbook but the algebra is tedious.
  • You are debugging a numeric solver in your own code and want to compare against a known-correct result on test inputs.

What this tool will not do

  • It will not do symbolic calculus or algebra. For symbolic integration, differentiation, simplification, factoring with symbolic parameters — use SymPy or Maple.
  • It will not solve differential equations. Equations involving y' (derivatives) need ODE-specific tools (scipy.integrate, MATLAB ode45).
  • It will not handle systems of nonlinear equations beyond simple cases. Multi-variable nonlinear systems require fsolve-style numeric solvers with good initial guesses; results depend heavily on the starting point.
  • It will not validate "is this the answer you wanted". Many equations have multiple roots; the solver returns all it finds, you pick the physically meaningful one.

Frequently asked questions

Why does my quadratic have "complex roots"?

Discriminant Δ = b² - 4ac is negative. The parabola does not cross the x-axis. There are no real solutions; the complex roots are mathematically valid (and important in physics/engineering) but represent "this equation has no real-number answer". For physics problems where x is a length or time, complex roots usually mean the input has no physical solution.

How can I tell if my numeric solver is converging to the right root?

Check: (1) plug the answer back into the original equation — residual should be near zero; (2) try several initial guesses — converging to the same answer is a good sign; (3) sketch the function — count crossings, compare with the count of roots found. Numeric solvers can converge to local minima of the residual that are not actual roots.

What is the difference between "exact" and "numeric" solutions?

Exact: symbolic expression like x = (1 + √5)/2 (the golden ratio). Numeric: approximation like x ≈ 1.6180339887. For irrational or transcendental roots, exact form is more compact but harder to manipulate further; numeric is good for "plug in and move on".

Can I solve sin(x) = x?

Only x = 0 (analytically obvious). For sin(x) = x/2, the equation has solutions ≈ ±1.8954942670... — numerical only. Mixed polynomial and transcendental equations almost never have closed-form solutions.

Why does Newton's method give different answers from different starting points?

Newton-Raphson converges to whichever root the gradient leads to from your starting point. For functions with multiple roots, the basin of attraction is fractal-shaped — small changes in initial guess can land you on different roots. Use bisection or Brent on bracketed intervals for predictability.

How do I solve a system of 5 equations in 5 unknowns?

If linear: write as Ax = b, use LU decomposition. If nonlinear: scipy.optimize.fsolve, Newton-Krylov, or trust-region methods. Both need good initial guesses for nonlinear systems. For pathological systems (ill-conditioned, multiple solutions), consult a numerical analyst — there is no universal recipe.

Related tools

Last updated · E-Utils editorial team