Solve for X Calculator

Type your equation exactly as you found it, equals sign and all, and get every solution worked out one legal move at a time and checked back against the original. Quadratics always show both roots.

Try one:
Put this calculator on your website for free

Copy one snippet and give your visitors a working Solve for X Calculator.

How this solve for x calculator works

You type the equation the way it appeared in front of you, homework sheet, textbook, or a post someone is arguing about, and we solve it the way a tutor would at a whiteboard: one legal move at a time, with your actual numbers in every line, and the answer plugged back into your original equation at the end as proof. Not a canned example that looks vaguely like your problem. Your equation, your steps.

The syntax is deliberately relaxed. Write 2x instead of 2*x, 2(x + 1) with no multiplication sign, fractions like 3/4, and pasted symbols like the times sign or a superscript squared all get understood. If something does not parse, the error tells you which character caused the problem and what to try instead. The page solves for x by default, but any single letter works: type 3n + 7 = 22 and it solves for n, and says so.

The steps are generated by the same code that produces the answer, so they can never disagree with it. That includes the last step, the check, which substitutes each solution into the equation you typed, not into our tidied-up version of it.

The one rule everything else follows from

Every move in algebra is the same move: do the identical thing to both sides. An equation is a claim that two expressions are the same number. If they really are the same number, then adding 5 to both, subtracting 3x from both, or dividing both by 2 keeps them the same number. That is the entire game. "Move the 7 to the other side and flip its sign" is not a separate rule you have to memorize; it is just "subtract 7 from both sides" described by its after-effect. Once you see that, solving for x stops being a bag of tricks and becomes one trick, applied until the letter stands alone.

The formula

Linear: ax + b = c  →  x = (c - b) / a
Quadratic: ax2 + bx + c = 0  →  x = (-b ± √(b2 - 4ac)) / (2a)

Here a, b, and c are the numbers left over once every term is expanded and collected. A linear equation isolates x by undoing what was done to it, in reverse order: constants first, then the coefficient. A quadratic gets moved into standard form and handed to the quadratic formula, whose ± sign is the whole reason quadratics have two answers. The expression under the square root, b2 - 4ac, is the discriminant, and it tells you what kind of answer is coming before you finish (more on that below).

Worked example: a linear equation

Take 3x + 7 = 22. This is the calculator's actual output for that input:

x = 5

  1. The equation as we read it. 3x+7 = 22
  2. Subtract 7 from both sides. Now the x term stands alone: 3x = 15
  3. Divide both sides by 3. x = 15 / 3, which is 5.
  4. Check x = 5. Substitute it into the original equation: 3(5)+7 = 22. The left side works out to 22 and the right side to 22. True.

Notice what each step is: the same operation applied to both sides, chosen to peel one layer off the x. The 7 was added last when the expression was built, so it comes off first. The check at the end is not decoration; substituting back into the original equation is the only proof that matters, and it catches slips that feel fine in the middle of the algebra.

Why x squared equals 16 has two answers

Here is the one that fills comment sections. An equation like 5x2 + 3 = 83 simplifies to x2 = 16, and most people confidently answer x = 4. The calculator answers x = 4 or x = -4, and it is right, because (-4)2 is also 16. A negative number times itself is positive; squaring destroys the sign, so un-squaring cannot recover it. Both signs were possible, so both are answers.

The confusion has a precise source worth knowing. The square root symbol √16 is defined to mean only the positive root, 4. That is a convention about the symbol, so that √ can be a function with a single output. But the equation x2 = 16 was never asking for √16; it was asking for every number whose square is 16, and there are two. That is why your teacher writes x = ±√16. The ± is not pedantry. It is the second answer, the one hiding behind a notational convention, and dropping it costs marks in class and arguments online.

Run the 5x2 + 3 = 83 chip above and watch the machinery agree: standard form 5x2 - 80 = 0, discriminant (0)2 - 4(5)(-80) = 1600, square root 40, and the formula delivers (0 + 40) / 10 = 4 and (0 - 40) / 10 = -4. Both get checked against the original equation, and both come back true.

The zero-product property

When an equation arrives already factored with a zero on the right, like (x+2)(x-3) = 0, the worst thing you can do is multiply it back out and reach for the quadratic formula. The factored form is the gift. A product of numbers can only equal zero if at least one of the factors is zero; there is no other way to multiply your way to nothing. So each factor takes a turn: x + 2 = 0 gives x = -2, and x - 3 = 0 gives x = 3. Done, two solutions, no formula needed. The calculator recognizes this shape and narrates it instead of expanding, because that is the better lesson and the faster path. It even handles a factored cubic like (x+1)(x-2)(x+3) = 0 this way, since the property does not care how many factors are queued up.

What the discriminant tells you before you solve

For any quadratic in standard form, the number b2 - 4ac decides the shape of the answer before you compute it. The calculator names it and computes it in its own step every time, because knowing which of three worlds you are in is half of understanding the problem:

DiscriminantSolutionsPicture
PositiveTwo distinct real rootsThe parabola crosses the x axis twice
ZeroOne repeated (double) rootThe parabola touches the axis at exactly one point
NegativeNo real roots; a complex conjugate pair p ± qiThe parabola never reaches the axis

That last row deserves a straight sentence rather than a shrug. "No solution" is not quite honest; the honest version is "no real solution." An equation like x2 + 2x + 5 = 0 has a negative discriminant, so no point on the number line satisfies it, but the pair of complex numbers -1 + 2i and -1 - 2i genuinely does, and the calculator will show you the substitution balancing perfectly, imaginary parts cancelling and all.

When there is no x to find

Two special cases catch people off guard, and both are real answers rather than errors. If every x term cancels and you are left with a true statement, like 4x + 2 = 4x + 2 collapsing to 2 = 2, the equation is an identity: both sides were the same expression all along, and every value of x works. Infinitely many solutions is a legitimate answer, and it means the equation contains no information that pins x down. If the x terms cancel and leave a false statement, like 3x + 5 = 3x + 9 collapsing to 5 = 9, the equation is a contradiction: both sides grow in lockstep, permanently 4 apart, and no x can close a gap the constants built in. No solution, and the calculator says why instead of just shrugging.

This page or the quadratic formula calculator

Our quadratic formula calculator takes a, b, and c as three separate boxes, which is exactly right when your equation is already in standard form and you want the formula applied cleanly. This page takes the equation as you found it, 5x2 + 3 = 83 or x2 = 2x + 15, and does the getting-to-standard-form part too, which is where most of the actual mistakes happen. Use whichever matches what is in front of you.

An honest boundary line, in the same spirit as our derivative calculator: this page solves linear and quadratic equations completely, with exact answers, and stops there. Degree three and beyond, x in a denominator, x in an exponent, and functions like sin or sqrt of x are all outside its lane, and it will tell you so plainly rather than half-solve them. For untangling the arithmetic side of an expression, the order of operations calculator is next door, and for equations of lines specifically, the y = mx + b calculator speaks slope and intercept. Fractions as coefficients are welcome here; if the fractions themselves are the struggle, the fraction calculator shows that arithmetic step by step too.

Frequently asked questions

How do you solve for x?

Apply the same operation to both sides of the equation until x stands alone. Undo what was done to x in reverse order: constants first, then the coefficient. For example, 3x + 7 = 22 becomes 3x = 15 after subtracting 7 from both sides, then x = 5 after dividing both by 3. If the equation has an x squared term, move everything to one side and use the quadratic formula. Always substitute the answer back into the original equation to confirm it.

Why does x squared equals 16 have two answers?

Because both 4 and -4 give 16 when squared; squaring destroys the sign, so un-squaring cannot recover it. The square root symbol is defined to mean only the positive root, which is a convention about the symbol, but the equation asks for every number whose square is 16, and there are two. That is why the solution is written x = plus or minus 4.

What does no solution mean?

It means no value of x makes the equation true. This happens when the x terms cancel and leave a false statement: 3x + 5 = 3x + 9 collapses to 5 = 9, which is never true, because both sides grow in lockstep and stay permanently 4 apart. For quadratics, a negative discriminant means no real solution, but a complex pair still exists, which is a different situation and this calculator says which one you are in.

What if x is on both sides of the equation?

Gather the x terms on one side by subtracting the smaller x term from both sides, then continue as usual. For 7x - 3 = 2x + 12, subtracting 2x from both sides gives 5x - 3 = 12, then x = 3. This calculator does that move for you and shows it as its own step.

What is the discriminant and what does it tell me?

For a quadratic in standard form, the discriminant is b squared minus 4ac, the expression under the square root in the quadratic formula. Positive means two distinct real solutions, zero means one repeated root, and negative means no real solution but a complex conjugate pair. It tells you the shape of the answer before you finish solving.

Can this solve equations with letters other than x?

Yes. Any single letter works: type 3n + 7 = 22 and it solves for n, and states that in the result. What it cannot do is solve for two letters at once; an equation with both x and y in it is one equation with two unknowns, and pinning both down takes a system of two equations.

What equations can this calculator not solve?

It solves linear and quadratic polynomial equations in one variable, completely and exactly. Degree three and higher, x in a denominator, x in an exponent like 2 to the x, and equations involving functions like sine or square root of x are outside its scope, and it tells you so directly rather than guessing. For those you want a computer algebra system or a numerical solver.

Related calculators