Algebra & Equations

Equation Solver

Type any equation in x to get the answer with steps. Linear, quadratic and polynomial equations such as 5x−3=2x+95x - 3 = 2x + 9 are solved exactly, using x=−b±b2−4ac2ax = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} for quadratics.

Try

Any equation in x, such as 3(x + 2) = 5x - 4, x^2 - 5x + 6 = 0 or cos(x) = x. An expression without = is solved as f(x) = 0.

Left edge of the graph, e.g. -10 or -2pi. For equations that are not polynomials, also where the search starts.

Right edge of the graph and of any numerical search. b − a can be at most 2,000.

Result

Solution: x = 4

Solution

x=4x = 4

Equation type
Linear equation
Real solutions
1
Real solutions in [−10, 10]Shown on the graph and in the table
1
Method
Inverse operations

x = 4 is the only value that makes both sides equal: each side equals 17 there.

Graphs of both sides of 5x - 3 = 2x + 9
−60−40−2002040−10−50510xyLeft sideRight sideSolutions
Check: both sides of 5x - 3 = 2x + 9 at each real solution in [−10, 10]
#xLeft side f(x)Right side g(x)|f(x) − g(x)|
1417170
Step-by-step working (4 steps)
  1. Collect the x terms on the left

    Subtract 2x2x from both sides.

    3x−3=93x - 3 = 9
  2. Move the constant to the right

    Add 33 to both sides.

    3x=123x = 12
  3. Divide both sides by 3

    x=4x = 4
  4. Check by substitution

    Putting x = 4 into both sides gives 17 on each side.

Others, such as 2x=3x2^x = 3x, are solved numerically and graphed.

By Hira Noor, mathematicianLast reviewed Free, no sign-up, runs in your browserReport a problem

How to use this calculator

  1. Type the equation with an = sign, for example 5x - 3 = 2x + 9, x^2 - 5x + 6 = 0 or cos(x) = x. You may start with "solve for x:". Without an = sign, the expression is solved as f(x) = 0.
  2. Use x as the variable. Write products as 3x or 3*x, powers as x^2, and functions as sqrt(x), ln(x), e^x or sin(x). On a phone, the buttons under the box insert x², √, π and parentheses.
  3. Set the graph range from a to b. For linear and polynomial equations it only frames the graph and the check table, because the exact answer covers every real number. For other equations it is also where the solver searches, up to 2,000 wide.
  4. If the equation contains sin, cos or tan, an angle unit appears: choose degrees or radians.
  5. Read the answer at the top, then the step-by-step working, the check table and the graph of both sides.

Formulas

Linear equation with x on both sides

ax+b=cx+d⇒(a−c)x=d−b⇒x=d−ba−cax + b = cx + d \;\Rightarrow\; (a - c)x = d - b \;\Rightarrow\; x = \frac{d - b}{a - c}

Plain-text formula: ax + b = cx + d ⇒ (a − c)x = d − b ⇒ x = (d − b)/(a − c)

Collect the x terms on one side and the constants on the other, then divide by the coefficient of x. If a = c the x terms cancel: the equation holds for every x when b = d and has no solution otherwise.

Quadratic formula

ax2+bx+c=0⇒x=−b±b2−4ac2aax^2 + bx + c = 0 \;\Rightarrow\; x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}

Plain-text formula: ax^2 + bx + c = 0 ⇒ x = (−b ± √(b^2 − 4ac))/(2a)

The discriminant b² − 4ac decides the case: positive gives two real solutions, zero gives one repeated solution, negative gives two complex solutions. Cubic and higher polynomial equations are factored with the rational root theorem first.

Numerical root finding on an interval

h(x)=f(x)−g(x),h(xi)h(xi+1)<0⇒a root lies in (xi,xi+1)h(x) = f(x) - g(x), \qquad h(x_i)\,h(x_{i+1}) < 0 \;\Rightarrow\; \text{a root lies in } (x_i, x_{i+1})

Plain-text formula: h(x) = f(x) − g(x), h(x_i) h(x_(i + 1)) < 0 ⇒ a root lies in (x_i, x_(i + 1))

For equations that are not polynomials, the interval is split into 4,000 pieces. If the continuous function h changes sign across a piece, it has a zero there (the intermediate value theorem), and Brent’s method narrows it down by combining safe bisection with fast secant and inverse quadratic interpolation steps.

Residual

r=|f(x∗)−g(x∗)|r = \left| f(x^*) - g(x^*) \right|

Plain-text formula: r = |f(x^∗) − g(x^∗)|

Substituting a computed root back into both sides measures how well it solves the equation. Values around 10⁻¹⁵ to 10⁻¹² are normal floating-point rounding.

Reading the result

For linear, quadratic and polynomial equations, the answer at the top is exact. Fractions and square roots are kept, and the answer covers every real number, not just the graph range. If a quadratic part has no real roots, its complex solutions are listed. The table and graph check each real solution in the range.

For other equations, the answer is numerical and covers only the range you give. An empty result means no root was found there, not that none exists. Two roots very close together can be missed, and so can a root where the graph only touches the axis. Vertical asymptotes, as in tan⁡x\tan x or 1/x1/x, are never reported as roots. If the graph shows a root that is missing, narrow the range around it.

Decimal roots are shown to 10 significant digits. The residual |f(x) − g(x)| shows how closely the two sides agree at each root.

How to solve equations with variables on both sides

An equation such as 5x−3=2x+95x - 3 = 2x + 9 has x on both sides. The goal is to get every x term on one side and every constant on the other. Do the same thing to both sides at each step, so the equation stays balanced.

First expand any parentheses and combine like terms on each side. Then subtract the smaller x term from both sides: taking 2x2x away gives 3x−3=93x - 3 = 9. Next move the constant: adding 3 to both sides gives 3x=123x = 12. Finally divide by the coefficient of x to get x=4x = 4, and check by substitution: 5(4)−3=175(4) - 3 = 17 and 2(4)+9=172(4) + 9 = 17.

Two special cases appear when the x terms cancel. If what is left is true, as in 2(x+1)=2x+22(x + 1) = 2x + 2, which leaves 2=22 = 2, every real number is a solution (an identity). If it is false, as in x+1=x+2x + 1 = x + 2, which leaves 1=21 = 2, there is no solution. The solver shows the step where the x terms cancel and names the case. For more practice, follow the guide to solving a linear equation.

What this equation solver can solve

Exactly, with steps: linear equations with fractions, decimals and parentheses; quadratic equations with real or complex solutions; and polynomial equations up to degree 6, factored with the rational root theorem.

Numerically: any other equation in one variable, such as ex=3−xe^x = 3 - x, ln⁡x=1/x\ln x = 1/x or sin⁡x=0.5\sin x = 0.5, on an interval you choose.

Elsewhere on the site: two or more equations with several unknowns go to the system of equations calculator, inequalities to the inequality calculator, and equations in other letters, derivatives or integrals to the step-by-step math solver.

Equations with no algebraic solution

Many equations that mix different kinds of functions, such as cos⁡x=x\cos x = x or 2x=3x2^x = 3x, cannot be solved with algebra alone: no rearrangement isolates x. Their solutions still exist and can be computed to full precision numerically. The solution of cos⁡x=x\cos x = x, about 0.7390851332, even has a name: the Dottie number.

For 2x=3x2^x = 3x on the interval from −10 to 10, the solver finds two sign changes and refines them to x ≈ 0.4578223732 and x ≈ 3.31317838. At the second root both sides equal about 9.939535141. The graphing calculator shows the same intersections interactively, and the guide to solving any equation explains how to choose a good interval.

Worked example

Solve 3(x + 2) = 5x − 4

Solve 3(x + 2) = 5x − 4 for x. The equation has parentheses and x on both sides.

  1. Expand the parentheses: 3x+6=5x−43x + 6 = 5x - 4.
  2. Collect the x terms on the left by subtracting 5x5x from both sides: −2x+6=−4-2x + 6 = -4.
  3. Move the constant by subtracting 6 from both sides: −2x=−10-2x = -10.
  4. Divide both sides by −2: x=5x = 5.
  5. Check by substitution: 3(5+2)=213(5 + 2) = 21 and 5(5)−4=215(5) - 4 = 21, so both sides agree.

Answer: The solution is x = 5. The graphs of y = 3(x + 2) and y = 5x − 4 cross at the point (5, 21).

Frequently asked questions

Is this equation solver free?

Yes. It is free with no sign-up, the steps are never behind a paywall, and there is no limit on how many equations you solve. The calculation runs in your browser.

Does the equation solver show the steps?

Yes. Linear equations are solved the way you would by hand: expand, collect the x terms, move the constants and divide. Quadratics use the discriminant and the quadratic formula, higher polynomials are factored, and for numerical equations the steps explain the search and the check.

How do you solve an equation with variables on both sides?

Move every x term to one side and every constant to the other by adding or subtracting the same amount on both sides, then divide by the coefficient of x. For 5x−3=2x+95x - 3 = 2x + 9, subtract 2x2x to get 3x−3=93x - 3 = 9, add 3 to get 3x=123x = 12, and divide by 3 to get x=4x = 4.

Can it solve for a variable other than x?

This page uses x only. To solve for y, t or another letter, or to rearrange an equation with two variables, use the step-by-step math solver, which accepts input such as "solve for y: 2x + 3y = 6".

Can it find complex solutions?

Yes, for polynomial equations. For example, x2+2x+5=0x^2 + 2x + 5 = 0 gives x=−1−2ix = -1 - 2i and x=−1+2ix = -1 + 2i. Equations that are not polynomials are solved over the real numbers only.

Why did the solver miss a root I can see on the graph?

This can happen with numerical equations when two roots lie within one sampling step of each other, or the graph only touches the axis without crossing it. Narrow the interval around the root (for example from 1.9 to 2.1) so the step becomes much smaller, and run it again.

Does it use degrees or radians?

Radians by default. Switch the angle unit to degrees for equations such as sin x = 0.5 meant in degrees, which then gives x = 30 and x = 150 between 0 and 360.

Quadratic Formula Calculator

Solve ax² + bx + c = 0 with the quadratic formula: exact roots, discriminant, vertex, graph and steps.

Algebra & Equations

Inequality Calculator

Linear, compound, absolute-value, quadratic and rational inequalities solved step by step.

Algebra & Equations

Polynomial Root Finder

All real and complex roots of a polynomial up to degree 10, with multiplicities, exact forms and steps.

Algebra & Equations

Graphing Calculator

Plot functions, equations, inequalities, parametric and polar curves; find roots and intersections.

Tools

Step-by-Step Math Solver

Free worked solutions for equations, systems, inequalities, factoring, derivatives, integrals, limits and matrices.

Tools

Sources and further reading

  1. College Algebra 2e, Section 2.2: Linear Equations in One Variable (J. Abramson) (opens in a new tab), OpenStax, Rice University
  2. College Algebra 2e, Section 2.5: Quadratic Equations (J. Abramson) (opens in a new tab), OpenStax, Rice University
  3. Algorithms for Minimization without Derivatives (R. P. Brent), Chapter 4: an algorithm with guaranteed convergence for finding a zero of a function, Prentice-Hall, 1973; reprinted by Dover Publications

Results are calculated in your browser with methods checked by automated tests, and are intended for learning and general use. For engineering, medical, financial, legal or safety-critical decisions, verify important values independently and follow the rounding rules your work requires. How accurate are these results?