Arithmetic, Algebra & Number Theory Equations, Systems & Polynomials Linear equation in one unknown; balance (equivalence) transformations

Linear Equation Solver (ax + b = cx + d)

Enter the four numbers in ax + b = cx + d and this solver returns x as an exact fraction and as a decimal, substitutes it back into both sides to prove the answer, and names the case you are in. Every one-variable linear equation reduces to this shape, including one-step and two-step equations and equations with the variable on both sides. It also handles the two outcomes students most often get wrong: an equation with no solution at all, and one that every number satisfies.

Calculator

This calculator runs in your browser. Enable JavaScript for live results — the inputs, formula and worked example below remain fully readable without it.

Inputs this calculator takes, with typical values
InputWhat to enterExample
a — coefficient of x on the leftThe number multiplying x on the left of the equals sign. Enter 0 if the left side has no x.3
b — constant on the leftThe term on the left with no x, including its sign.5
c — coefficient of x on the rightThe number multiplying x on the right. Enter 0 for an equation like 3x + 5 = 17.1
d — constant on the rightThe term on the right with no x, including its sign.13

It returns

  • Solution x — Blank when the equation has no solution or infinitely many.
  • x as an exact value
  • Type of solution
  • Left side at x: ax + b
  • Right side at x: cx + d

The formula

x=dbac
(ac)x=db

In plain text: x = (d − b) / (a − c), provided a ≠ c

  • aCoefficient of x on the left side
  • bConstant on the left side
  • cCoefficient of x on the right side
  • dConstant on the right side
  • xThe unknown

When a = c the x terms cancel. The equation is then an identity if b = d and a contradiction otherwise.

Updated Category Equations, Systems & Polynomials Verified against published test cases Reading time 12 min

What a linear equation is and why one shape covers them all

A linear equation in one unknown is any equation in which x appears only to the first power — never squared, never inside a root, never in a denominator with another x. Every such equation, no matter how it is dressed up, can be rearranged into ax + b = cx + d. That is why a single formula solves the whole family.

Look at how varied the disguises are. 5x = 20 is the case b = c = 0. 2x + 3 = 11 is the two-step case with c = 0. 4x − 7 = x + 8 has the variable on both sides. 3(x − 2) = 2(x + 4) becomes 3x − 6 = 2x + 8 once you expand. Even (x + 1)/3 = (x − 5)/2 becomes linear after you multiply through by 6. All four reduce to four numbers.

Geometrically, each side of the equation is a straight line. Solving asks where the two lines meet. Two straight lines in a plane either cross at exactly one point, run parallel and never meet, or lie exactly on top of each other. Those three geometric possibilities are precisely the three algebraic outcomes — one solution, none, infinitely many — and no fourth case exists. The chart on this page draws both lines so you can see which one you have.

The method: why moving terms across is legal

Solving a linear equation rests on one principle: whatever you do to one side you must do to the other, and only operations that are reversible are allowed. Adding, subtracting, and multiplying or dividing by a non-zero number all qualify. Each step produces an equation with exactly the same solution set as the one before, which is what "equivalent equation" means.

Applied to ax + b = cx + d, the standard route is three moves:

  1. Subtract cx from both sides to gather every x on the left: (ac)x + b = d.
  2. Subtract b from both sides to gather every constant on the right: (ac)x = db.
  3. Divide both sides by (ac): x = (db) / (ac).

Step 3 is the one with a condition attached, and it is the whole reason this calculator reports a solution type rather than always a number. Division by zero is not a permitted operation, so when a = c the method stops at step 2 with 0·x = db. If d = b that reads 0 = 0, true for every x. If db it reads 0 = something non-zero, true for no x.

Two operations that look harmless are not reversible and must be avoided. Multiplying both sides by an expression that could be zero can introduce solutions that do not satisfy the original equation. Dividing both sides by an expression containing x can destroy a genuine solution. Neither arises in the four-number form on this page, but both are common when you clear denominators earlier in the working, which is why you check the answer by substitution.

Worked example: solving 3x + 5 = x + 13 by hand

Take the calculator's default equation, 3x + 5 = x + 13, so a = 3, b = 5, c = 1, d = 13.

  1. Move the x terms to one side. Subtract x from both sides: 3xx + 5 = 13, which is 2x + 5 = 13.
  2. Move the constants to the other side. Subtract 5: 2x = 8.
  3. Divide by the coefficient. x = 8 ÷ 2 = 4.
  4. Check by substitution. Left side: 3(4) + 5 = 12 + 5 = 17. Right side: 4 + 13 = 17. They match, so x = 4 is correct.

Read the same working through the formula. ac = 3 − 1 = 2 is the combined coefficient from step 1. db = 13 − 5 = 8 is the combined constant from step 2. Dividing gives 8/2 = 4. The formula is not a different technique; it is the three moves already carried out.

Now a case that does not come out whole. Solve 3x + 1 = 2. Here ac = 3 and db = 1, so x = 1/3. The decimal 0.333333 is a rounded value; the exact answer is the fraction, and that is the form to give unless a question asks for decimals. Substituting confirms it: 3(1/3) + 1 = 1 + 1 = 2 ✓.

Finally, a trap. Solve 2x + 3 = 2x + 5. Subtract 2x from both sides and you are left with 3 = 5. Nothing has gone wrong with your algebra — that is the answer. The statement 3 = 5 is false regardless of x, so the equation has no solution. Change the 5 to a 3 and the same working leaves 3 = 3, which is true regardless of x, so every real number is a solution.

How to read the result

Start with the type of solution. "Unique solution" is the ordinary case and the number beside it is your answer. "No solution" means the two lines are parallel: same slope, different intercept. "Infinitely many solutions" means they are the same line, and the honest way to write the answer is "all real numbers", not "x = 0" and not "no solution". Confusing the last two is the single most common error on this topic, and the difference is easy to see: 0 = 0 is true, 3 = 5 is not.

Then compare the left side and right side outputs. On a unique solution they must be equal, and if they differ by more than a rounding wisp you have entered a coefficient wrongly. This substitution check is the only verification that catches a mistake made while rearranging the original problem into ax + b = cx + d, because the calculator can only see the four numbers you typed.

Prefer the exact value output when it shows a fraction. A rounded decimal is fine for a measurement but wrong for an exam answer, and it compounds if the result feeds another calculation. If you need the fraction in a different form, the fraction simplifier and the decimal to fraction converter handle the conversions.

One numerical caution. When a and c are very close, ac is small and the quotient is large and sensitive: changing a from 1.0001 to 1.0002 moves the answer by thousands. The calculator flags that regime. It is not a failure of the method — it is the geometry, since two nearly parallel lines cross a long way from the origin and their crossing point moves quickly.

Reference: the three outcomes and how to recognise them

Every row is the same three-step method applied to different coefficients; substitute to verify.
Equationa − cd − bReduces toSolution
3x + 5 = x + 13282x = 8x = 4
2x + 3 = 11282x = 8x = 4
−3x + 7 = 2x − 8−5−15−5x = −15x = 3
3x + 1 = 2313x = 1x = 1/3
x + 4 = 410x = 0x = 0
2x + 3 = 2x + 5020 = 2No solution
2x + 6 = 2x + 6000 = 0All real numbers
5 = 5000 = 0All real numbers

x = 0 and "no solution" are different answers: the first is a number that works, the second means no number works.

Getting a messy equation into ax + b = cx + d

  1. Clear any brackets

    Multiply out. 3(x − 2) = 2(x + 4) becomes 3x − 6 = 2x + 8, so a = 3, b = −6, c = 2, d = 8. Watch the sign on every term inside a bracket that follows a minus.

  2. Clear any fractions

    Multiply every term by the least common denominator. For (x + 1)/3 = (x − 5)/2, multiply by 6 to get 2(x + 1) = 3(x − 5), then expand to 2x + 2 = 3x − 15. The least common multiple calculator finds the denominator to use.

  3. Collect like terms on each side

    Combine repeated x terms and repeated constants before reading off the coefficients. 2x + 5 + 3x − 1 = 7 tidies to 5x + 4 = 7.

  4. Read off the four numbers

    Take signs with the terms they belong to. In 4x − 7 = x + 8, b is −7, not 7. A missing constant is 0; a bare x has coefficient 1.

  5. Solve, then substitute into the original

    Check against the equation you started with, not the tidied version. That is what catches an expansion or sign error made in step 1.

Mistakes that produce a wrong x

  • Changing only one side. Subtracting 5 from the left and forgetting the right breaks the balance and every later step inherits the error.
  • Dropping a sign when moving a term. Moving −7 across the equals sign makes it +7. Writing it as "subtract −7 from both sides" keeps you honest.
  • Multiplying only some terms when clearing fractions. Every term gets multiplied, including whole numbers with no visible denominator.
  • Reporting x = 0 for a contradiction. 0 = 2 has no solution; it does not have the solution 0. Check whether the surviving statement is true or false.
  • Reporting "no solution" for an identity. If the x terms vanish and what remains is true, every number is a solution.
  • Dividing by a coefficient that is zero. When a = c there is nothing to divide by, and the method has to stop and classify instead.
  • Rounding a fraction too early. Writing 0.33 for 1/3 and substituting it back makes a correct answer look wrong.

One equation with one unknown is the simplest solvable case. Two neighbouring problems come up constantly.

More than one unknown. A single equation such as 2x + 3y = 12 has infinitely many solutions; you need as many independent equations as unknowns to pin down a point. Two equations in two unknowns go to the 2×2 system solver, and three in three to the 3×3 system solver, both of which use determinants rather than substitution.

Higher powers. The moment an x² appears, the balance method no longer isolates x, and you need the quadratic formula instead. The tell is that a quadratic has up to two solutions while a linear equation has at most one.

Proportions are linear equations in disguise: a/b = c/x becomes ax = bc by cross-multiplication. The proportion solver does that step for you, and it is the right tool for scale drawings, unit pricing and recipe scaling.

Linear equations also underpin most everyday algebra without announcing themselves. Converting a temperature, finding a break-even point, working out how long a journey takes at a constant speed, or reversing a percentage are all one-unknown linear problems; the reverse percentage calculator is a linear solver with a percentage interface on top.

Key terms

Coefficient
The number multiplying the unknown. In 3x + 5 the coefficient is 3; in a bare x it is 1.
Equivalent equations
Equations with exactly the same solution set. Every legal step in solving produces an equivalent equation.
Identity
An equation true for every value of the unknown, such as 2x + 6 = 2x + 6. It reduces to a true statement with no x left.
Contradiction
An equation true for no value of the unknown, such as 2x + 3 = 2x + 5. It reduces to a false statement with no x left.
Solution set
The collection of all values that satisfy the equation: one number, the empty set, or all real numbers.

Frequently asked questions

How do I solve an equation with x on both sides?

Move all the x terms to one side and all the constants to the other, then divide. For 4x − 7 = x + 8, subtract x to get 3x − 7 = 8, add 7 to get 3x = 15, and divide by 3 to get x = 5. Which side you collect the x terms on does not matter mathematically, but choosing the side with the larger coefficient keeps the result positive and avoids a sign slip.

What does it mean when x cancels out completely?

It means the equation is either an identity or a contradiction, and which one depends on the statement that survives. If you are left with something true such as 0 = 0 or 5 = 5, every real number is a solution. If you are left with something false such as 0 = 2, no number is a solution. Both are legitimate answers, and neither is "x = 0".

How do I handle fractions in a linear equation?

Multiply every term by the least common denominator to clear them before you do anything else. For x/2 + x/3 = 5, the LCD is 6, so multiply through to get 3x + 2x = 30, then 5x = 30 and x = 6. Multiplying every term is the part people miss — the 5 on the right becomes 30. You can also enter the decimal coefficients directly here, but the fraction route keeps the answer exact.

Can a linear equation have two solutions?

No. A linear equation in one unknown has exactly one solution, no solution, or infinitely many — never two, never three. Geometrically the two sides are straight lines, and two straight lines cannot cross at exactly two points. If you find two answers, either the equation contains an x² or a square root that you have missed, or an absolute value, which splits into two separate linear equations.

Why should I check my answer by substitution?

Because it catches errors the algebra cannot. Substituting x back into the original equation tests every step at once, including a bracket you expanded wrongly or a sign you dropped. This calculator does it for you: the left side and right side outputs must be equal. Substitute into the equation you were given, not the rearranged version, or you will re-use the same mistake.

What if the coefficient of x is zero on both sides?

Then there is no unknown left and the equation is a statement about constants. If the two constants are equal it is true and every x satisfies it; if they differ it is false and no x does. This happens more often than it sounds — it is what an equation collapses to whenever the x terms are identical on both sides, and the calculator warns you when it detects the case.

Is x = 4 the same as saying the answer is 4?

Yes for a unique solution, but write the whole statement. In word problems the number alone is rarely the answer: if x was defined as the number of hours, the answer is "4 hours", and a negative or fractional value may need rejecting on physical grounds even though it solves the equation. Solving the equation and answering the question are two separate steps.

How accurate is the decimal answer?

It is computed in double precision and shown to six decimal places, which is far more than most problems need. The exact value output gives a reduced fraction whenever your coefficients are whole numbers, and that is the form to prefer. Accuracy only becomes a real concern when a and c are nearly equal, because dividing by a very small a − c amplifies any imprecision in the inputs; the calculator flags that case.

References