Longhand

Linear Equation Calculator

Shaheer Bin RamzanBy Shaheer Bin Ramzan
Reviewed November 2026 · Formula sources

Solve any equation of the form ax + b = cx + d. Enter the four numbers, and use 0 for a term that is missing.

How to solve a linear equation

The goal is to get x alone. Whatever you do to one side, you do to the other, so the equation stays balanced.

  1. Expand any brackets and combine like terms on each side.
  2. Move the x terms to one side by subtracting the smaller one from both sides.
  3. Move the plain numbers to the other side.
  4. Divide both sides by the coefficient of x.
  5. Check by substituting your answer back into the original equation.

Worked examples

One x term: 3x + 5 = 20

Subtract 5 from both sides to get 3x = 15, then divide by 3. So x = 5. In the calculator, enter a = 3, b = 5, c = 0 and d = 20.

x on both sides: 2x + 3 = 5x − 9

Move the x terms left and the numbers right: (2 − 5)x = −9 − 3, so −3x = −12 and x = 4. Check: 2(4) + 3 = 11 and 5(4) − 9 = 11.

A real-life case: comparing two taxis

One taxi charges 3 plus 2 per km, and another charges 1 plus 3 per km. The costs match when 2x + 3 = 3x + 1. Then (2 − 3)x = 1 − 3, so −x = −2 and x = 2. The fares are equal at 2 km.

Equations with no solution or infinitely many

Try 2x + 4 = 2x + 9. Subtracting 2x from both sides leaves 4 = 9, which is false, so there is no solution. Now try 2x + 4 = 2x + 4. Both sides are identical, so you get 4 = 4 and every value of x works. The calculator reports both cases instead of returning an error.

Common mistakes

The usual slip is a sign error when moving a term across the equals sign, so write the subtraction out in full. Another is dividing only one side, or forgetting to multiply every term when clearing a bracket. Always substitute your answer back in: if the two sides do not match, the working has an error. To see the same line as a graph, use the slope, distance and midpoint calculator, and for equations with x² use the quadratic formula calculator.

Frequently asked questions

What is a linear equation?

A linear equation has a variable raised only to the first power, such as 3x + 5 = 20. Its graph is a straight line, and it has at most one solution.

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

Subtract the smaller x term from both sides so x appears once, move the plain numbers to the other side, then divide by the coefficient of x.

What does “no solution” mean?

It happens when the x terms cancel and what is left is false, such as 0 = 5. The two sides can never be equal, whatever x is.

What does “infinitely many solutions” mean?

It happens when both sides are the same expression, so the x terms cancel and you are left with a true statement such as 0 = 0. Every value of x works.

More Algebra calculators

Browse every algebra calculator.

Other calculators