How to Solve Equations: Solving for x Step by Step
By the Calculator.hair team · Updated · 9 min read
Short answer
To solve an equation, do the same operation to both sides until x stands alone, undoing addition and subtraction first, then multiplication and division. For 3x + 5 = 20, subtract 5 to get 3x = 15, then divide by 3 to get x = 5. Check by substituting back: 3 × 5 + 5 = 20. Quadratics and systems of equations need their own methods.
Key takeaways
- An equation stays balanced as long as you do the same thing to both sides.
- Simplify each side first, collect the x terms on one side, then divide by the coefficient of x.
- Substituting your answer into the original equation catches almost every mistake.
- A system of two linear equations has one solution, no solution, or infinitely many.
- The form of the equation picks the method: a squared term calls for the quadratic formula, and x in an exponent calls for logarithms.
How do you solve for x?
You solve for x by applying inverse operations to both sides of the equation until x is alone on one side. An inverse operation undoes another one: subtraction undoes addition, and division undoes multiplication. Because the two sides of an equation are equal, they stay equal if you change both in the same way.
Take 3x + 5 = 20. The number multiplying x, here 3, is called the coefficient. Subtract 5 from both sides to get 3x = 15, then divide both sides by 3 to get x = 5. Test the answer in the original equation: 3 × 5 + 5 = 20, so it works. The equation solver shows the same working, along with a check that both sides match.
What are the steps for solving a linear equation?
A linear equation is one where x appears only to the first power, with no x², and it takes five steps at most: clear parentheses, combine like terms, move the x terms to one side, move the constants to the other, and divide by the coefficient. Not every equation needs all five.
Worked example: solve 4(x − 2) = 2x + 6. The table follows each step, and the answer of x = 7 matches what our equation solver returns.
| Step | What you do | Result |
|---|---|---|
| 1. Clear parentheses | Multiply 4 by each term inside | 4x − 8 = 2x + 6 |
| 2. Move x terms | Subtract 2x from both sides | 2x − 8 = 6 |
| 3. Move constants | Add 8 to both sides | 2x = 14 |
| 4. Divide | Divide both sides by 2 | x = 7 |
| 5. Check | Substitute 7 into both original sides | 4 × 5 = 20 and 14 + 6 = 20 |
How do you solve an equation with fractions?
Multiply every term on both sides by the least common denominator, which removes the fractions in one step. The least common denominator is the smallest number that all the denominators divide into evenly, and the LCM calculator will find it for you.
Worked example: solve x/2 + x/3 = 5. The denominators 2 and 3 share a least common multiple of 6. Multiplying each term by 6 gives 3x + 2x = 30, so 5x = 30 and x = 6. Check: 6/2 + 6/3 = 3 + 2 = 5. If you would rather keep the fractions and combine them, see how to add fractions.
Word problems turn into the same kind of equation once you name the unknown. Suppose a phone plan costs $20 a month plus $0.25 a minute, and the bill is $50. With x as the minutes used, 0.25x + 20 = 50. Subtract 20 to get 0.25x = 30, then divide by 0.25 to get x = 120 minutes.
Can a linear equation have no solution?
Yes. If the x terms cancel and leave a false statement, the equation has no solution, and if they leave a true statement, every number is a solution.
In 2x + 1 = 2x + 5, subtracting 2x from both sides leaves 1 = 5, which is never true, so no value of x works. In 2(x + 1) = 2x + 2, the two sides are the same expression and x cancels to leave 2 = 2. An equation like this is called an identity, and it holds for every real number. Our solver reports these as "No solution" and "Every real x (identity)."
How do you solve a system of two equations?
A system of two equations asks for one pair of values, x and y, that makes both equations true, and you find it by reducing the problem to one unknown through elimination or substitution. Both methods give the same answer, so pick whichever needs less arithmetic.
Elimination adds or subtracts the equations so that one variable cancels. Take 2x + y = 11 and x − y = 1. The y terms are already opposites, so adding the equations gives 3x = 12, and x = 4. Putting that into the second equation gives 4 − y = 1, so y = 3. Check the first equation: 2 × 4 + 3 = 11.
Substitution solves one equation for a variable and inserts the result into the other. It works well when a variable already has a coefficient of 1. Take 2x + 3y = 8 and x − y = −1. The second equation gives x = y − 1. Substituting into the first gives 2(y − 1) + 3y = 8, which simplifies to 5y − 2 = 8, so y = 2 and x = 1.
The system tool on the equation solver page handles two or three unknowns and reports the determinant, a number computed from the coefficients. For two unknowns the determinant is a₁b₂ − a₂b₁, where a and b are the x and y coefficients of each equation. When it equals 0, the system has either no solution or infinitely many, as the table shows.
| System | Determinant | Outcome | What the lines do |
|---|---|---|---|
| 2x + y = 11, x − y = 1 | −3 | One solution: x = 4, y = 3 | Cross at one point |
| x + y = 3, 2x + 2y = 10 | 0 | No solution | Parallel, never meet |
| x + y = 3, 2x + 2y = 6 | 0 | Infinitely many solutions | Same line |
When does an equation need a different method?
An equation needs a different method as soon as x is squared, sits in an exponent, or appears under a root, inside a denominator, inside absolute value bars or inside a trig function. Isolating x with basic inverse operations stops working in those cases, so match the form of the equation to the method below.
Answers in the first four rows come from our calculators. The last five rows are our own arithmetic, because our equation solver accepts only polynomials in x up to the fourth power.
| Equation type | Example | Method | Answer |
|---|---|---|---|
| Linear | 3x + 5 = 20 | Inverse operations | x = 5 |
| Quadratic | x² − 7x + 6 = 0 | Factoring or the quadratic formula | x = 6 or x = 1 |
| Single power | x³ = 27 | Take the matching root | x = 3 (real root) |
| Cubic or quartic | x³ − 6x² + 11x − 6 = 0 | Factoring or a numeric solver | x = 1, 2, 3 |
| x in an exponent | 2^x = 32 | Logarithms | x = 5 |
| x under a root | √(x + 3) = x − 3 | Square both sides, then check | x = 6 |
| x in a denominator | 1/x = 2 | Multiply both sides by x | x = 0.5 |
| Absolute value | |x − 2| = 3 | Split into two equations | x = 5 or x = −1 |
| Trigonometric | sin x = 0.5 | Inverse sine | x = 30° or 150°, plus multiples of 360° |
How do you solve an equation with x squared?
Move every term to one side so the equation reads ax² + bx + c = 0, then factor it or apply the quadratic formula. If there is no x term, as in x² = 49, take the square root of both sides and keep both signs: x = 7 or x = −7. The quadratic formula calculator handles the general case, and our quadratic formula guide explains how the formula works and what the discriminant tells you.
For a single power such as x⁵ = 32, take the matching root. The root calculator gives the fifth root of 32 as 2, and it also simplifies radicals, for example √50 = 5√2.
Squaring both sides can create false answers, so always check them. In √(x + 3) = x − 3, squaring gives x + 3 = x² − 6x + 9, which rearranges to x² − 7x + 6 = 0, with roots 6 and 1. Testing x = 6 gives √9 = 3 on the left and 3 on the right, so it is valid. Testing x = 1 gives √4 = 2 on the left and −2 on the right, so it is rejected. A root that appears only because of the squaring step is called an extraneous solution.
What can our algebra solver do, and what are its limits?
Our equation solver solves polynomial equations in the variable x up to degree 4, where degree means the highest power of x. Linear and quadratic equations get full step-by-step working. Cubic and quartic equations are solved numerically, shown to 8 decimal places, with a table that checks each root instead of written steps.
- It accepts parentheses, decimals and fractions with a number on the bottom, such as x/4 + 3 = 7 or (x + 1)/2 = 3.
- The variable must be x, so rewrite y + 2 = 5 as x + 2 = 5 before you enter it.
- It returns an error for exponents that contain x, trig functions, square root signs, absolute value bars, x in a denominator and powers above x⁴.
- For quadratics with a negative discriminant it returns complex roots, such as x = −2 ± i for x² + 4x + 5 = 0.
What mistakes should you avoid when solving equations?
Most wrong answers come from a sign slip or from changing only part of one side of the equation.
- Distributing to only the first term: 4(x − 2) is 4x − 8, not 4x − 2.
- Forgetting that a minus sign in front of parentheses flips every sign inside: −(x − 3) is −x + 3.
- Multiplying only some terms when you clear fractions. Every term on both sides must be multiplied, including whole numbers.
- Dividing both sides by x, which can erase a solution. In x² = 3x, dividing by x loses x = 0. Rearrange to x² − 3x = 0 and factor instead.
Calculators in this guide
Frequently asked questions
Is there a math solver that shows steps?
Yes. Our equation solver shows step-by-step working for linear and quadratic equations, plus a check of each answer. Cubic and quartic equations are solved numerically, so they show the check table without written steps.
How do you solve for x when it is on both sides?
Subtract the smaller x term from both sides so x remains on one side only, then isolate it as usual. In 5x − 3 = 2x + 12, subtracting 2x gives 3x − 3 = 12, then 3x = 15 and x = 5.
How many solutions can an equation have?
A linear equation has one solution, none, or infinitely many. A polynomial of degree n has at most n real solutions, so a quadratic has at most two and a cubic at most three.
How do you rearrange a formula to solve for one variable?
Treat the other letters as if they were numbers and use the same inverse operations. To solve P = 2l + 2w for w, subtract 2l and divide by 2, which gives w = (P − 2l) ÷ 2.