Linear equation solver with step-by-step working
Type an equation with brackets, fractions or decimals. The solver clears the denominators, expands the brackets, moves the terms across, explains every step and at the end checks the root by substitution.
3(x - 2) = 2x + 5
(x + 1)/3 - (2x - 1)/5 = 1
0.5x + 1.2 = 0.3x - 0.4
5 - 2(x - 1) = 3x
(x + 2)^2 = x^2 + 8
2(x + 1) = 2x + 2
x + 1 = x + 2
Loading the solver…
What you can type
Any equation in one unknown that becomes linear after simplifying, that is, reduces to the form $ax = b$. Brackets: 3(x - 2) = 2x + 5. Fractions with a slash: (x + 1)/3 - (2x - 1)/5 = 1. Decimals with a point: 0.5x + 1.2 = 0.3x - 0.4. The unknown can appear on both sides and even squared, as long as the squares cancel later: (x + 2)^2 = x^2 + 8 is also a linear equation, just in disguise.
If an $x^2$ is left after expanding the brackets, the solver will honestly say that the equation is quadratic and give you a link to the right solver. If the unknown is in a denominator, as in $\frac{1}{x} = 2$, that’s a rational equation, and it isn’t solved here.
How to solve it: five steps in order
- Clear the fractions. Find the lowest common multiple of all the denominators and multiply every term on both sides by it. For decimals it’s convenient to multiply by $10$, $100$ and so on.
- Expand the brackets. Multiply the factor in front of a bracket by each term inside. A minus in front of a bracket changes the signs of all the terms in it.
- Move terms across. Collect the terms with the unknown on the left and the numbers on the right. A term that crosses the equals sign changes its sign.
- Collect like terms. Add up the coefficients of $x$ and add up the numbers. You get an equation of the form $ax = b$.
- Divide by the coefficient of $x$. If $a \ne 0$ there is one root: $x = \frac{b}{a}$. If $a = 0$ it’s a special case, discussed below.
The last step, which people often skip, is the check: substitute the number you found into the original equation, before any rearranging. If the left and right sides agree, the root is right. The solver does this itself, computing both sides exactly, without rounding.
Why this is allowed
An equation is like a pair of scales in balance. If you add the same weight to both pans, or take the same weight off both, the balance isn’t disturbed. If you double all the weights on both pans, it isn’t disturbed either. In the language of algebra these are two rules: you can add the same number (or expression) to both sides of an equation, and you can multiply both sides by the same number other than zero. Such changes don’t affect the roots: the equation before and after has exactly the same solutions.
“Moving a term across and changing its sign” isn’t a separate rule, just shorthand for the first one. In $3x - 6 = 2x + 5$, add $6$ to both sides and subtract $2x$: you get $3x - 2x = 5 + 6$. It looks as if $-6$ and $2x$ “jumped” over the equals sign and changed sign, but really we just added the same thing to both pans. Around 820 al-Khwarizmi called this operation “al-jabr”, restoring, and that word gave us the name “algebra”.
You can’t multiply by zero for an obvious reason: any equation would turn into the true statement $0 = 0$, and the roots would be lost. That’s why the last step needs the condition $a \ne 0$.
If after collecting like terms $a = 0$, the equation becomes $0 \cdot x = b$, and there’s nothing to divide by. There are two outcomes. If $b \ne 0$, the equality is false for every $x$: there is no solution. If $b = 0$, it is true for every $x$: any number works. The graph shows this at once: the left and right sides are two straight lines. Usually they cross at one point, and its $x$-coordinate is the root. Parallel lines never cross (no solution), and coinciding lines cross everywhere (any number is a root).
Worked examples
Example 1. Fractions: $\frac{x + 1}{3} - \frac{2x - 1}{5} = 1$
The common denominator of $3$ and $5$ is $15$. Multiply every term by it, including the $1$ on the right: $5(x + 1) - 3(2x - 1) = 15$. Expand the brackets, minding the minus in front of the second: $5x + 5 - 6x + 3 = 15$. Move terms across: $5x - 6x = 15 - 5 - 3$, that is, $-x = 7$, and $x = -7$.
Check in the original equation: $\frac{-7 + 1}{3} - \frac{2 \cdot (-7) - 1}{5} = -2 - (-3) = 1$. Correct.
Example 2. Decimals: $0.5x + 1.2 = 0.3x - 0.4$
Every number has one digit after the point, so multiply both sides by $10$: $5x + 12 = 3x - 4$. Then as usual: $5x - 3x = -4 - 12$, $2x = -16$, $x = -8$. Check: $0.5 \cdot (-8) + 1.2 = -2.8$ and $0.3 \cdot (-8) - 0.4 = -2.8$.
Example 3. A minus in front of a bracket: $5 - 2(x - 1) = 3x$
$-2(x - 1) = -2x + 2$: the minus in front of the bracket changes the sign of both terms. We get $5 - 2x + 2 = 3x$; moving terms across, $-2x - 3x = -5 - 2$, that is, $-5x = -7$ and $x = \frac{7}{5} = 1.4$. Check: $5 - 2 \cdot 0.4 = 4.2$ and $3 \cdot 1.4 = 4.2$.
Example 4. When there’s no solution and when there are infinitely many
$x + 1 = x + 2$: moving terms across, $x - x = 2 - 1$, that is, $0 \cdot x = 1$. For no $x$ is zero equal to one: there is no solution. The lines $y = x + 1$ and $y = x + 2$ are parallel.
$2(x + 1) = 2x + 2$: after expanding the brackets both sides are the same, and we get $0 \cdot x = 0$. This is true for every $x$: any number works. Such an equality is called an identity.
Example 5. The problem known as Diophantus’s epitaph
The Greek Anthology has a problem in verse about the life of Diophantus: his childhood took up a sixth of his life, another twelfth passed before his beard grew, a seventh before he married; five years later a son was born, who lived half as long as his father, and the father died four years after the son. If his whole life was $x$ years, then
$$\frac{x}{6} + \frac{x}{12} + \frac{x}{7} + 5 + \frac{x}{2} + 4 = x.$$
The common denominator is $84$: $14x + 7x + 12x + 420 + 42x + 336 = 84x$, that is, $75x + 756 = 84x$, so $9x = 756$ and $x = 84$. Whether the story is true nobody knows, but the equation solves honestly. Type it into the solver as x/6 + x/12 + x/7 + 5 + x/2 + 4 = x.
Common mistakes
- Not multiplying every term by the common denominator. In Example 1 the $1$ on the right must be multiplied by $15$ too. Forget it and you get $5(x + 1) - 3(2x - 1) = 1$ and the wrong answer $x = 7$.
- Losing the brackets around a numerator. $15 \cdot \frac{2x - 1}{5} = 3(2x - 1) = 6x - 3$, not $6x - 1$: the whole numerator is multiplied by three.
- Letting a minus in front of a bracket change only the first term. $-(2x - 1) = -2x + 1$, not $-2x - 1$. This is the most common mistake in all of school algebra.
- Forgetting to change the sign when moving a term across. $3x - 6 = 2x + 5$ gives $3x - 2x = 5 + 6$, not $5 - 6$.
- Dividing by the wrong coefficient or losing its sign. From $-5x = -7$ it follows that $x = \frac{7}{5}$, not $-\frac{7}{5}$ and not $-\frac{5}{7}$.
- Concluding “$x = 0$” from $0 \cdot x = 0$. Zero is just one of infinitely many answers. And $0 \cdot x = 5$ doesn’t give “$x = 5$”: there is no solution.
- Dividing both sides by an expression containing the unknown. For example, “cancelling” $x$ in $x^2 = x$ leaves only $x = 1$ and loses the root $x = 0$. You may divide only by something that is certainly not zero.
See also
Scales, al-Khwarizmi, the traps of dividing and word problems are in the chapter “Equations: the art of balance”, together with a trainer. If an $x^2$ is left in the equation, go to the quadratic equation solver; if the sign isn’t “=” but “<” or “>”, go to the inequality solver: the steps are almost the same, but dividing by a negative number flips the inequality sign. Higher-degree equations are handled by the higher-degree equation solver.
Where this is explained
Other solvers
- Quadratic equation
- System of linear equations
- Higher-degree equations and factoring
- Inequalities by the interval method
- Derivative
- Integral
- Limit
- Curve sketching
- Fraction arithmetic
- GCD, LCM and Euclid's algorithm
- Prime factorisation
- Solving a triangle
- Matrices: determinant, inverse, rank, eigenvalues
- Trigonometric equation
- Exponential and logarithmic equations
- Percentages, compound interest, loans
- Permutations and combinations
- Number bases
- Complex numbers
- Congruences
- Progressions
- Probability: Bayes and Bernoulli trials
- Differential equation