Algebra and equations
Linear equation solver
Enter the four numbers in ax + b = cx + d. The solver moves the terms across, divides, and checks the answer by putting it back in both sides.
Press Calculate. The answer and every step of the working will show here.
How it works
A linear equation has one unknown, x, which appears only to the first power. The general form ax + b = cx + d covers most of what students meet, from simple ones like 3x = 12 (set b = 0, c = 0, d = 12) to ones with x on both sides.
The method is the balance method. An equation is like a scale: whatever you do to one side you must do to the other. First, collect the x terms on one side by subtracting cx from both sides. That leaves (a - c)x + b = d. Next, collect the plain numbers on the other side by subtracting b from both sides, giving (a - c)x = d - b. Finally divide both sides by (a - c) to get x = (d - b) / (a - c).
That last division only works if a - c is not zero. When a and c are equal, the x terms cancel, and one of two things happens. If d - b is also zero, both sides become 0 = 0, which is true for every x, so there are infinitely many solutions. If d - b is not zero, you get something like 0 = 4, which is never true, so there is no solution. The solver says which case you have and explains why.
It always finishes with a check: the answer is put back into both sides of the original equation, and the two results must match.
The formula
- Equation: ax + b = cx + d
- Solution: x = (d - b) / (a - c), when a is not equal to c
- If a = c and b = d: infinitely many solutions
- If a = c and b is not d: no solution
Worked example
Solve 3x + 5 = x + 13. Subtract x from both sides: 3x - x + 5 = 13, which is 2x + 5 = 13. Subtract 5 from both sides: 2x = 13 - 5 = 8. Divide both sides by 2: x = 4. Check: the left side is 3 × 4 + 5 = 17, and the right side is 1 × 4 + 13 = 17. Both sides match.
More examples
x on one side only. 5x = 7 has a = 5, b = 0, c = 0, d = 7. Divide by 5 to get x = 7/5, or 1.4. Answers do not have to be whole numbers.
A negative coefficient. -2x + 4 = 3x - 1. Subtract 3x: -5x + 4 = -1. Subtract 4: -5x = -5. Divide by -5: x = 1. Check: -2 × 1 + 4 = 2 and 3 × 1 - 1 = 2.
No solution. 2x + 3 = 2x + 7. After subtracting 2x you are left with 3 = 7, which is false, so no value of x works. The two sides describe parallel lines.
Infinitely many solutions. 2x + 3 = 2x + 3. Both sides are the same expression, so the equation is true for every x.
Common mistakes
- Changing only one side. Subtracting 5 from the left and forgetting the right breaks the balance. Every move must be done to both sides.
- Sign errors when moving terms. Moving +5 across the equals sign gives -5, and moving -5 gives +5. Writing the subtraction out as a step avoids this.
- Dividing only part of a side. If 2x + 6 = 14 becomes x + 6 = 7, the 6 was not divided. Subtract 6 first, then divide.
- Skipping the check. Putting the answer back in takes ten seconds and catches nearly every slip.
When to use it
Linear equations are the first big topic in algebra, and they never go away. Any time two things change at a steady rate and you want to know when they are equal, you are solving one: comparing phone plans, working out when two savers have the same balance, or finding how long a trip takes at a constant speed.
Students use the solver to check homework and to see the same steps applied to many different numbers. Because it names the special cases, it also helps explain why some equations have no answer at all.
Common questions
What is a linear equation?
An equation in which the unknown appears only to the first power, with no x squared, no x in a denominator and no square roots of x. Its graph is a straight line, which is where the name comes from.
How do I enter an equation with no x on one side?
Use 0 for that coefficient. For 4x - 6 = 10, enter a = 4, b = -6, c = 0 and d = 10. The answer is x = 4.
What if my equation has brackets or fractions?
Simplify first. Expand the brackets, for example 2(x + 3) = 2x + 6, and multiply through by the common denominator to clear fractions. Then collect the terms into the form ax + b = cx + d.
Why does the solver sometimes say no solution?
When the x terms cancel and what is left is false, such as 3 = 7. Geometrically, each side is a line with the same slope but a different starting height, so the lines never meet.
What does infinitely many solutions mean?
The two sides are identical, so every number makes the equation true. It is an identity, like x + x = 2x.
Can the answer be a fraction or a negative number?
Yes. For whole-number inputs the solver also shows the exact fraction beside the decimal, for example 7/5 beside 1.4. Negative answers are fine, and the check works the same way.
You might also need
- System of Equations SolverSolve two linear equations in x and y by elimination, with no-solution and infinite cases.
- Quadratic Equation SolverSolve ax² + bx + c = 0 with the discriminant, real or complex roots, and the vertex.
- Fraction CalculatorAdd, subtract, multiply or divide fractions and mixed numbers, with the answer simplified.
Need a quick calculation instead? The free scientific calculator on the homepage handles roots, powers, trig and logs, and the math guides explain each method step by step.