🇺🇸 USC
Math & Conversion
✏️

Algebra Calculator

Solve equations for x, simplify expressions and evaluate them, with every step shown

To solve an equation for x, do the same operation to both sides until x stands alone. Type an equation such as 3(x − 4) + 2 = 5x − 6 into this algebra calculator and it expands, combines like terms and isolates x step by step to reach x = −2, then substitutes the answer back as a check. It also works as a find x calculator for quadratic, cubic, rational and exponential equations, giving exact fractions and radicals where they exist and clearly labeled decimals where they do not.

✅

Last updated October 2026

Method: Polynomial and rational equations are solved with exact fraction arithmetic. Each side is expanded and like terms are combined, fractions are cleared, linear equations are isolated one operation at a time, and quadratics use the discriminant and the quadratic formula (NIST DLMF equation 1.11.11). Degree three and up uses the rational root test with synthetic division, then the quadratic formula, the cubic formula (mathjs polynomialRoot) or the Durand-Kerner iteration. Every other equation is scanned from −1,000,000 to 1,000,000 for sign changes and refined by bisection and Newton's method.

Included: Solve, Simplify and Evaluate modes; exact fractions, radicals and complex roots; repeated roots with their multiplicity; restrictions and extraneous solutions in rational equations; identities and contradictions; a substitution check for every answer; and a Read as line that shows how your input was understood.

Not included: Systems of two or more equations, inequalities, solving a formula for one letter in terms of others, calculus and matrices. Roots of polynomials of degree five and up, and of exponential or trigonometric equations, are given as decimals rather than exact forms.

✏️ Enter your problem

What do you want to do?
Try:
Decimal places for approximate answers
How to type math
  • Multiply with * or by writing terms side by side: 3x, 2(x + 1), (x + 1)(x - 1)
  • Powers with ^: x^2, 2^x, e^(2x)
  • Fractions with /; put a longer denominator in parentheses: 1/(2x) (while 1/2x means one half times x)
  • sqrt(x), cbrt(x), abs(x) or |x|, pi, e
  • log(x) is base 10, ln(x) is the natural log; sin, cos and tan use radians
  • Use any single letter as the unknown (x, y, t, n ...), except i, which is the imaginary unit
Read as: 3(x − 4) + 2 = 5x − 6

✏️ Solution

x = −2
Type
Linear equation
Solutions
1 real solution
Method
Exact (algebraic steps)

📋 Step-by-step solution

  1. 1. Distribute and remove the parentheses:
    3x − 12 + 2 = 5x − 6
  2. 2. Combine like terms on each side:
    3x − 10 = 5x − 6
  3. 3. Subtract 3x from both sides:
    −10 = 2x − 6
  4. 4. Add 6 to both sides:
    −4 = 2x
  5. 5. Divide both sides by 2:
    −2 = x
  6. 6. Rewrite with x on the left:
    x = −2

✅ Check by substitution

x = −2 ✓
Left side: 3(−2 − 4) + 2 = −16
Right side: 5(−2) − 6 = −16
Everything is computed in your browser. Polynomial and rational equations are solved with exact fractions and radicals; degree 3 and up use the rational root test, then the cubic formula or a numeric root finder; other equations are solved numerically and labeled with ≈.

Algebra calculator with steps: how equations get solved for x

This algebra solver takes one equation in one unknown, finds every value that makes it true and shows the algebra a teacher expects to see. Linear and quadratic equations are solved with exact arithmetic, so x/3 + 2 = x/2 − 1 returns x = 18 and x² = 4x + 1 returns x = 2 ± √5 instead of rounded decimals. Equations without an algebraic formula, such as 2^x = 10, are solved numerically, and every such answer carries the ≈ sign.

Sister pages go deeper on single equation types. The Linear Equation Calculator focuses on ax + b = cx + d, the Quadratic Formula Calculator adds the vertex of the parabola, the Polynomial Calculator adds, subtracts and multiplies polynomials, the Order of Operations Calculator evaluates long numeric expressions, and the System of Equations Calculator solves two or three equations together. Use this equation calculator when you have a single equation of any type and want the answer, the steps and a check in one place.

How the solver reads and classifies an equation

Your input is first parsed into an expression tree, and the Read as line shows the result in standard notation so you can catch a typo or an unintended reading before trusting the answer. The solver then subtracts the right side from the left and looks at what is left, because that decides the method:

  • Polynomial (only whole-number powers of x): expanded with exact fractions. Degree 1 is linear, degree 2 is quadratic, and degree 3 and up goes through the rational root test.
  • Rational (x in a denominator): every denominator becomes a restriction, both sides are multiplied by the least common denominator, and the resulting polynomial equation is solved and checked against the restrictions.
  • Anything else (x in an exponent, under a root, or inside abs, log or sin): solved numerically by scanning for sign changes.
  • No x left after simplifying: an identity, true for all real numbers, or a contradiction with no solution.

The formulas behind every step

Each method rests on a short list of facts. The first line is the balance rule that every algebra step uses; the others are applied once an equation is in standard form:

If a = b, then a + c = b + c and a·c = b·c ax + b = cx + d  ⇒  x = (d − b) / (a − c),  a ≠ c ax² + bx + c = 0  ⇒  x = (−b ± √D) / (2a),  D = b² − 4ac Rational root test: a rational root of aₙxⁿ + … + a₀ is ±p/q, with p dividing a₀ and q dividing aₙ Newton step: xₙ₊₁ = xₙ − f(xₙ) / f′(xₙ)

The quadratic formula and its discriminant are the standard results listed in the NIST Digital Library of Mathematical Functions, which also states that a polynomial of degree n has exactly n roots when complex and repeated roots are counted. That is why the calculator always reports how many real and complex solutions it found.

Worked example 1: a linear equation with parentheses

Solve 3(x − 4) + 2 = 5x − 6. Distributing the 3 turns the left side into 3x − 12 + 2, and combining the constants leaves 3x − 10 = 5x − 6. There are x-terms on both sides and the right side has the larger coefficient, so the solver subtracts 3x from both sides to keep the coefficient positive:

Step Operation Result
StartOriginal equation3(x − 4) + 2 = 5x − 6
1Distribute the 33x − 12 + 2 = 5x − 6
2Combine like terms3x − 10 = 5x − 6
3Subtract 3x from both sides−10 = 2x − 6
4Add 6 to both sides−4 = 2x
5Divide both sides by 2−2 = x, so x = −2
CheckSubstitute x = −23(−2 − 4) + 2 = −16 and 5(−2) − 6 = −16

Both sides equal −16, so x = −2 is the only solution. Gathering x on the right is a choice, not a rule: subtracting 5x first gives −2x − 10 = −6 and the same answer, with one more negative sign to manage.

Worked example 2: a quadratic that is not in standard form

Solve (x − 1)² = 3x + 7. Squaring the binomial gives x² − 2x + 1 = 3x + 7, and subtracting 3x + 7 from both sides puts the equation in standard form, x² − 5x − 6 = 0, with a = 1, b = −5 and c = −6. The discriminant is D = (−5)² − 4(1)(−6) = 25 + 24 = 49. Because 49 is a perfect square, both roots are rational:

x = (5 ± √49) / 2 = (5 ± 7) / 2  ⇒  x = 6 or x = −1

The factored form (x − 6)(x + 1) = 0 confirms the pair. Substituting x = 6 gives (6 − 1)² = 25 on the left and 3·6 + 7 = 25 on the right; substituting x = −1 gives 4 on both sides. If the discriminant were not a perfect square, the calculator would simplify the radical instead: x² = 4x + 1 leads to D = 20, √20 = 2√5 and x = 2 ± √5, about 4.236068 and −0.236068.

Worked examples 3 and 4: a rational equation and an exponential one

Solve 1/x + 1/(x + 1) = 1/2. Before any algebra the solver records the restrictions x ≠ 0 and x ≠ −1, because either value would put a zero in a denominator. Writing the left side as one fraction gives (2x + 1)/(x² + x) = 1/2, and multiplying both sides by the common denominator 2x(x + 1) clears every fraction: 4x + 2 = x² + x. Rearranged, that is x² − 3x − 2 = 0 with D = 9 + 8 = 17, so x = (3 ± √17)/2, about 3.561553 and −0.561553. Neither value breaks a restriction, and either one makes the left side equal 0.5.

Now solve 2^x = 10. With x in the exponent the equation is not a polynomial, so the solver switches to its numeric method. It scans f(x) = 2^x − 10, finds a sign change between x = 3.3 (where 2^x ≈ 9.849) and x = 3.35 (where 2^x ≈ 10.196), and bisects that interval until the value is fixed to full precision: x ≈ 3.321928. By hand you would take logarithms of both sides, x = log 10 ÷ log 2 = 3.3219280949, which matches the numeric result in every displayed digit.

16 equations solved: type, answer and method

Every row below was produced by the calculator on this page at its default setting of six decimal places. Exact rows show integers, fractions, radicals or complex numbers; numeric rows show decimals.

Equation Type Answer Method
3(x − 4) + 2 = 5x − 6Linearx = −2Exact
x/3 + 2 = x/2 − 1Linear, fractionsx = 18Exact
0.5x + 1.25 = 2Linear, decimalsx = 1.5Exact
2(x + 3) = 2x + 6IdentityAll real numbersExact
2(x + 3) = 2x + 5ContradictionNo solutionExact
(x − 1)² = 3x + 7Quadraticx = −1, x = 6Exact
x² = 4x + 1Quadraticx = 2 ± √5Exact
x² − 4x + 13 = 0Quadraticx = 2 ± 3iExact
x³ = 7x − 6Cubicx = −3, x = 1, x = 2Exact
x³ − 2 = 0Cubicx ≈ 1.259921, x ≈ −0.629961 ± 1.091124iExact steps, numeric roots
x⁴ − 5x² + 6 = 0Quarticx = ±√2, x = ±√3Exact
1/x + 1/(x + 1) = 1/2Rationalx = (3 ± √17)/2Exact
(x² − 1)/(x − 1) = 2RationalNo solution (x = 1 rejected)Exact
√(x + 3) = x − 3Radicalx = 6Numeric
|2x − 3| = 5Absolute valuex = −1, x = 4Numeric
2^x = 10Exponentialx ≈ 3.321928Numeric

Two rows deserve a closer look. The (x² − 1)/(x − 1) = 2 row reduces to x = 1, which the restriction check throws out, so an equation that seems to produce an answer correctly ends with no solution. The √(x + 3) = x − 3 row would give two candidates, x = 1 and x = 6, if you squared both sides by hand; only x = 6 satisfies the original equation, because √4 = 2 is not equal to 1 − 3 = −2.

How to use the calculator and type your equation

Pick a mode and type into the box; the result updates as you type. Solve needs exactly one equals sign, and if you leave it out the expression is set equal to 0. Simplify expands, combines like terms and cancels common factors in a fraction, so 2x + 3(x − 4) − x² + 5x² becomes 4x² + 5x − 12 and (x² − 9)/(x − 3) becomes x + 3 with the note x ≠ 3. Evaluate substitutes a value: 3x² − 2x + 1 at x = 4 is 48 − 8 + 1 = 41. Type numbers without thousands separators (1000, not 1,000), because the comma also separates the two inputs of log(x, b); the calculator points this out instead of guessing. The table shows how common inputs are read, which is where most surprises come from:

You type Read as Why
3x+2=113x + 2 = 11Spaces are optional
x(x+4)x(x + 4)A letter before parentheses multiplies
1/2x(1/2)xOne half times x
1/(2x)1/(2x)One over 2x
e^2xe²xe squared, times x
e^(2x)e^(2x)Parentheses keep 2x in the exponent
-x^2−x²The power is applied before the minus sign
sqrt(x+1)√(x + 1)The √ symbol works too
|x-3||x − 3|Same as abs(x − 3)
log(x), ln(x)log(x), ln(x)Base 10 and base e

Who this calculator is for

Students in pre-algebra, Algebra 1 and Algebra 2 use it to check homework and to compare a clean set of steps with their own. Parents and tutors use the step list to find where a solution went wrong, since a single sign error shows up as a mismatch in the substitution check. Test-prep students working toward the SAT, ACT, GED or a placement exam use it to drill equation types quickly. Anyone who needs a math equation solver for a practical problem, such as the month when two price plans cost the same or the rate in a growth formula, can type the equation directly. People who search for a variable calculator or a solve for x calculator usually want exactly this: one unknown, solved and checked.

Key terms

  • Variable (unknown): the letter you solve for; any single letter except i works.
  • Coefficient: the number multiplying a power of the variable, such as 5 in 5x².
  • Like terms: terms with the same power of the variable, which can be added together.
  • Degree: the highest power of the variable after simplifying; it decides which method applies.
  • Discriminant: D = b² − 4ac for a quadratic; positive means two real roots, zero means one repeated root, negative means a complex pair.
  • Root or solution: a value of the variable that makes both sides equal.
  • Multiplicity: how often a root repeats; in (x − 1)²(x + 2) = 0, x = 1 is a double root.
  • Identity and contradiction: an equation that is true for every value of the variable, and one that is true for none.
  • Restriction and extraneous solution: a value excluded because it makes a denominator zero, and a candidate that fails the original equation.

Exact or numeric: what changes the answer

The same keystrokes can produce different kinds of answer, and four things decide which:

  • The type of equation. Polynomials of degree one and two always get exact answers. From degree three up, rational roots and factors that reduce to quadratics are exact; the rest are decimals.
  • Where the parentheses go. 1/(2x) = 4 gives x = 1/8, while 1/2x = 4 gives x = 8, because the second is read as one half times x.
  • Decimals in the input. 0.5x + 1.25 = 2 is still solved exactly, because the decimals are converted to fractions, and the answer is shown as 1.5 with 3/2 beside it.
  • Restrictions. In a rational equation, a value that makes a denominator zero is removed even when the algebra produces it.

Tips for solving equations by hand

  • Clear fractions first: multiplying x/3 + 2 = x/2 − 1 by 6 gives 2x + 12 = 3x − 6 with no fractions left.
  • Gather the x-terms on the side where the coefficient is larger, so it stays positive.
  • Move everything to one side before factoring a quadratic, and never divide both sides by x: x² = 3x has two solutions, 0 and 3.
  • Simplify radicals and keep exact forms until the very last step.
  • Check every answer in the original equation, not a rearranged version, so extraneous solutions show up.

Limitations

The solver handles one equation in one unknown. It does not solve systems, inequalities or a formula for one letter in terms of others, so substitute numbers for the other letters first. Numeric answers come from a search between −1,000,000 and 1,000,000, so a solution outside that range, or two solutions closer together than the 0.05 grid near zero, can be missed. Periodic equations such as sin(x) = 0.5 have infinitely many solutions, and the calculator lists the 12 closest to 0. Fractional powers are principal roots, so x^(1/3) is undefined for negative x; type cbrt(x) for a real cube root. Polynomials are limited to degree 60, and at very high degrees some complex roots cannot be computed accurately enough to list.

Related calculators

Sources

Algebra needs no outside data: every step is a rule of arithmetic applied to your own equation. The formulas and the software behavior described on this page can be checked against these primary references:

  • NIST Digital Library of Mathematical Functions, §1.11 Zeros of Polynomials: the quadratic formula with D = b² − 4ac (equation 1.11.11), the statement that a polynomial of degree n has exactly n zeros counting multiplicity, Horner's scheme for synthetic division, and the cubic and quartic formulas.
  • mathjs documentation, expression syntax: implicit multiplication takes precedence over division except in the number/number pattern, which is why 1/2x is read as (1/2)x.
  • mathjs documentation, polynomialRoot: closed-form numeric roots of linear, quadratic and cubic polynomials, used for cubic factors that have no rational root.
  • Worked examples and tables: every value on this page was produced by the calculator above and confirmed by substitution.

⚠️ Common mistakes & edge cases

Typing 1/2x when you mean 1/(2x)

The parser follows the standard rule and reads 1/2x as one half times x, so 1/2x = 4 gives x = 8. If you meant one over 2x, type 1/(2x) = 4 and the answer is x = 1/8. The Read as line tells you which one you entered.

Dropping the minus sign in front of parentheses

5 − (x − 3) means 5 − x + 3, not 5 − x − 3. With the sign handled correctly, 5 − (x − 3) = 2x + 2 gives x = 2. Dropping it gives x = 0, which fails the check: the left side would be 8 and the right side 2.

Dividing both sides by x

Dividing x² = 3x by x leaves x = 3 and silently loses x = 0, which also works. Move everything to one side instead, x² − 3x = 0, and factor: x(x − 3) = 0 gives both solutions, exactly as the calculator reports them.

Squaring both sides without checking

Squaring √(x + 3) = x − 3 gives x² − 7x + 6 = 0, with candidates x = 1 and x = 6. Only x = 6 works; x = 1 makes the left side 2 and the right side −2. The numeric solver works on the original equation, so it reports x = 6 alone.

Writing e^2x for e^(2x)

e^2x is read as e² times x, so e^2x = 10 gives x ≈ 1.353353, which is 10 divided by e². The exponential equation e^(2x) = 10 needs the parentheses and gives x ≈ 1.151293, which is ln 10 divided by 2.

Rounding before the end

Using 2.24 for √5 turns the exact root 2 + √5 into 4.24, and substituting that into x² − 4x − 1 leaves 0.0176 instead of 0. Keep 2 + √5 exact and round only the final decimal, 4.236068.

Note: Exact answers are exact for the numbers you type. Numeric answers are computed in full double precision, shown to the decimal places you choose and always marked with ≈.

❓ Frequently asked questions

How do I solve for x with this algebra calculator?

Type the equation with one equals sign, for example 4(x + 2) = 2x + 18, and keep the Solve mode selected. The solver distributes to get 4x + 8 = 2x + 18, subtracts 2x from both sides, subtracts 8 and divides by 2, so x = 5. It then substitutes x = 5 into the original equation, where both sides equal 28, so you can see the answer is right.

Does the algebra calculator show its work step by step?

Yes. Every solution comes with a numbered list of steps written the way a teacher would write them: distribute, combine like terms, move terms across the equals sign, clear fractions, apply the quadratic formula or the rational root test, and finally check each answer by substitution. Steps handled by a numeric method, as in 2^x = 10, are labeled as numeric and explain how the answer was narrowed down.

What kinds of equations can this equation solver handle?

Any equation in one unknown built from numbers, the four operations, powers, parentheses and common functions. Linear and quadratic equations are solved exactly. Cubic and higher polynomials go through the rational root test before the cubic formula or a numeric root finder. Rational equations are cleared of fractions with their restrictions checked, and exponential, logarithmic, radical, absolute value and trigonometric equations are solved numerically.

How do I type exponents, fractions and square roots?

Use ^ for powers (x^2, 2^x) and / for fractions, with parentheses around any denominator longer than a single number or letter: 1/(2x) means one over 2x, while 1/2x means one half times x. Square roots are sqrt(x) or the √ symbol, absolute values are abs(x) or |x|, log(x) is base 10 and ln(x) is the natural logarithm. The Read as line under the input shows exactly how your entry was understood.

What does it mean when the answer is All real numbers or No solution?

If both sides simplify to the same thing, the equation is an identity and every number works: 2(x + 3) = 2x + 6 becomes 6 = 6 once the x-terms cancel. If the x-terms cancel and a false statement is left, such as 6 = 5 from 2(x + 3) = 2x + 5, the equation is a contradiction with no solution. A rational equation such as x/x = 1 is an identity with one exception: all real numbers except x = 0.

Why are some answers shown with ≈ instead of =?

An equals sign means the answer is exact: an integer, a fraction, a radical such as 2 + √5 or a complex number such as 2 + 3i. The ≈ sign means the value was computed in decimals, either because no exact formula exists (2^x = 10 gives x ≈ 3.321928, which is log 10 divided by log 2) or because a polynomial of degree three or more has no rational roots left. The decimal-place buttons show 2, 4, 6 or 8 places.

Can the solver find complex or imaginary solutions?

Yes, for polynomial equations. When the discriminant of a quadratic is negative, the complex pair is shown exactly: x² + 2x + 10 = 0 has D = −36 and x = −1 ± 3i. Polynomials of higher degree list their complex roots as decimals. Equations that are not polynomials are searched for real solutions only.

What is an extraneous solution, and why did the calculator reject one?

An extraneous solution is a value that comes out of the algebra but does not satisfy the original equation, usually because it makes a denominator zero or because both sides were squared. In (x² − 1)/(x − 1) = 2, canceling x − 1 leaves x + 1 = 2 and x = 1, but x = 1 makes the original denominator 0, so the solver rejects it and reports no solution.

Can I solve for a variable other than x, or for two variables at once?

Any single letter works as the unknown, so 5t − 3 = 2t + 9 gives t = 4 and the steps use t throughout. The letter i is reserved for the imaginary unit, and e and pi are read as constants. An equation with two different letters, such as 2x + 3y = 12, has infinitely many solutions on its own; to pin down one pair of values you need a second equation and the System of Equations Calculator.

Is this math solver free, and is my equation saved anywhere?

It is free and needs no account. Every calculation runs in your browser, using exact fraction arithmetic and the open-source mathjs library for reading the input, so the equations you type are not sent to a server or stored.

💡 Good to know

Every polynomial has as many roots as its degree

Counted with multiplicity and including complex values, a polynomial of degree n has exactly n roots. That is why x³ − 2 = 0 shows one real root, x ≈ 1.259921, and a complex pair, x ≈ −0.629961 ± 1.091124i: three roots for a cubic.

There is no general formula past degree four

Quadratics, cubics and quartics have formulas in radicals, but general equations of degree five and higher do not (the Abel-Ruffini theorem). For x⁵ − x − 1 = 0 the calculator therefore reports the real root as a decimal, x ≈ 1.167304, together with two complex pairs.

A check takes seconds and catches most errors

Substituting the answer into the original equation is the fastest way to catch a sign slip. In worked example 1, x = −2 makes both sides equal −16; a wrong answer such as x = 2 would give −4 on the left and 4 on the right.

Related Calculators