Linear Equation Calculator

Solve ax + b = cx + d and see where the two sides cross.

Solution for x
Adjust the inputs

Your result updates live as you type.

A linear equation with x on both sides is solved by collecting the x terms on one side and the constants on the other. From ax + b = cx + d you get (a − c)x = d − b, so x = (d − b) ÷ (a − c). The whole method rests on doing the same thing to both sides, which keeps the equality intact.

The interesting cases are the ones where that division fails. If a equals c the two sides have the same gradient, so they are parallel lines. Should the constants also match, every value of x works and the equation is an identity; if they differ, no value works at all. Read graphically, solving the equation means finding where two straight lines cross, and parallel lines either coincide everywhere or nowhere. This page names which case you are in rather than returning a meaningless number.

The formula

ax + b = cx + d  ⟹  x = (d − b) ÷ (a − c)
a
Coefficient of x on the left
b
Constant on the left
c
Coefficient of x on the right
d
Constant on the right
a − c
Difference in gradient; zero means the lines are parallel

How it works, step by step

  1. Enter the coefficient and constant for the left-hand side.
  2. Enter the coefficient and constant for the right-hand side.
  3. The gauge shows the solution for x.
  4. The value both sides take at that x is shown below as a check.

Worked examples

3x + 7 = −2x + 22

Collecting terms gives (3 − (−2))x = 22 − 7, so 5x = 15 and x = 3. Both sides then equal 16, which is the check worth doing every time.

When there is no solution

For 4x + 1 = 4x + 9 the gradients match, so subtracting 4x from both sides leaves 1 = 9, which is false. The two lines are parallel and never meet. Had the constants agreed, every x would have worked instead.

How to read your score

—–0Negative solutionThe crossing point lies left of the origin.
0–5Small positiveA crossing close to the origin.
5–50ModerateThe two lines meet some way out along the axis.
50–—LargeNearly parallel lines, so the crossing is far from the origin.

Frequently asked questions

Why does a − c matter so much?

It is the gradient difference, and it is the denominator. When it is zero the two sides change at the same rate, so they either agree everywhere or nowhere — there is no single crossing point to find.

What does it mean for an equation to have infinitely many solutions?

That the two sides are the same expression written differently, so the statement is true for every x. It is called an identity rather than an equation to solve.

How do I check my answer?

Substitute it back into both sides separately. They must give the same number. This page does that automatically and shows both evaluations.

Can I use this for equations with brackets?

Expand the brackets first, then collect the x terms and the constants on each side. Once it is in the form ax + b = cx + d the four coefficients go straight in.

Linear equations and their solutions

Solving ax + b = cx + d
Equationa − cd − bSolutionBoth sides equal
3x + 7 = -2x + 225153.000016.0000
2x + 5 = 1x + 9144.000013.0000
5x + -3 = 2x + 6393.000012.0000
4x + 1 = 4x + 908none — paralleln/a
4x + 1 = 4x + 100any xn/a
1x + 0 = -1x + 8284.00004.0000

Rows four and five share a gradient, so one has no solution and the other has infinitely many.

Related calculators