Free Algebra Solver
Linear equations

Linear Equation Calculator

Solve one-variable linear equations with parentheses, fractions, decimals, or the variable on both sides.

Preview 5x + 9 = 2x - 12 (Solve) Ready
Examples
Solution

Worked example: 5x + 9 = 2x - 12

Worked example. Edit the problem above and press Solve to solve your own.

Problem5x + 9 = 2x - 12
  1. Simplify both sides of the equation

    Remove parentheses and combine like terms before isolating x.

    5x + 9 = 2x - 12
    Original equation
    5x + 9 = 2x − 12
    Simplify multiplication and combine like terms

    Only equivalent simplifications are used, so the solution set is unchanged.

  2. Subtract 2x from both sides

    Subtract 2x so every x-term is on the left.

    5x + 9 − 2x = 2x − 12 − 2x
    Subtract 2x on both sides
    3x + 9 = −12
    Combine the x-terms

    Doing the same operation on both sides keeps the equation balanced.

  3. Subtract 9 from both sides

    Subtract 9 to leave only the variable term on the left.

    3x + 9 − 9 = −12 − 9
    Subtract 9 on both sides
    3x = −21
    Simplify both sides

    Adding or subtracting the same number on both sides preserves equality.

  4. Divide both sides by 3

    Undo the multiplication attached to x.

    3x/3 = −21/3
    Divide the entire left and right sides by 3
    x = −7
    Reduce both fractions

    Dividing both sides by the same nonzero number preserves equality.

  5. Check the answer in the original equation

    Substitute the proposed value into both sides of the original equation.

    x = −7
    Proposed solution
    5(−7) + 9 = 2(−7) - 12
    Substitute −7 for x
    −26 = −26
    Both sides are equal, so it checks out

    A value is a solution only when it makes the original equation true.

Answerx = −7

Linear equations guide

Using the linear equation calculator

This linear equation calculator solves one-variable equations with x on one or both sides, parentheses, fractions and decimals. Each answer comes with steps and a substitution check.

How do you solve a linear equation?

Simplify each side, collect the variable terms on one side and the numbers on the other, then divide by the coefficient. For 5x + 9 = 2x − 12, subtract 2x to get 3x + 9 = −12, subtract 9 to get 3x = −21, and divide by 3 to get x = −7.

What is a linear equation?

A linear equation is one where the variable appears only to the first power, with no x², no x under a root and no x in a denominator. Examples are 3x − 7 = 11 and 5x + 9 = 2x − 12.

The name comes from graphing: y = 2x + 1 makes a straight line. When you solve a one-variable linear equation, you get exactly one answer, no answer, or every number, and nothing in between.

How to solve linear equations step by step

Most textbooks teach the same general strategy. It handles any linear equation, however messy.

  1. Simplify each side: distribute to clear parentheses and combine like terms.
  2. Collect the variable terms on one side by adding or subtracting.
  3. Collect the constant terms on the other side.
  4. Divide both sides by the coefficient of the variable.
  5. Check by substituting into the original equation.

If the equation has fractions, you can multiply through by the common denominator before step 1. That's optional, and the solver keeps fractions as they are.

Not every equation needs all five steps. 3x − 7 = 11 has no parentheses and x on only one side, so you skip straight to steps 3 and 4. The list is a checklist, and you tick off whatever applies.

How do you solve 5x + 9 = 2x − 12?

Subtract 2x from both sides, subtract 9 from both sides, then divide by 3. The answer is x = −7.

Start
5x + 9 = 2x − 12
Subtract 2x from both sides
3x + 9 = −12
Subtract 9 from both sides
3x = −21
Divide both sides by 3
x = −7
Check
5(−7) + 9 = −26 and 2(−7) − 12 = −26

Moving the 2x to the left keeps the x coefficient positive (5 − 2 = 3). You could move 5x to the right instead and get −21 = −3x, which leads to the same x = −7 with one extra sign to watch.

What does a multi step equation calculator do differently?

Nothing different, just more of it. A multi-step equation is a linear equation that needs distributing or combining like terms before the usual two moves.

Try 3(2x − 1) = 4x + 9. Distribute to get 6x − 3 = 4x + 9. Subtract 4x for 2x − 3 = 9, add 3 for 2x = 12, and divide to get x = 6. The solver shows the distribution as its own line, which is where most errors start.

When does a linear equation have no solution or infinitely many?

If the x terms cancel and leave a false statement, there's no solution. If they cancel and leave a true statement, there are infinitely many solutions, meaning every real number works.

EquationAfter the x terms cancelResult
5x + 9 = 2x − 123x = −21One solution, x = −7
3(x + 2) = 3x + 10 = −5No solution
3(x + 2) = 3x + 60 = 0All real numbers

You can often spot these before solving. If both sides have the same x coefficient after simplifying, the answer is either none or all, depending on whether the constants match. In graph terms, no solution means two parallel lines and infinitely many means the same line twice.

Can the linear equation solver handle fractions and decimals?

Yes. Type fractions with a slash and decimals as usual. For x/2 + x/3 = 10 it combines the x terms into (5/6)x and returns x = 12. For 0.5x + 1.2 = 3.7 it returns x = 5.

Answers come back as exact fractions when they aren't whole numbers, so you won't see a rounded decimal where your teacher expects 7/3.

What are the most common mistakes?

Moving a term across the equals sign without changing its sign is the big one. "Move 2x to the left" means "subtract 2x from both sides", which is why 2x on the right becomes −2x on the left.

Another is distributing a negative to only the first term. In −2(x − 4), both terms flip: −2x + 8. Writing −2x − 8 changes the answer.

Finally, students often read 0 = 0 as "x = 0". It isn't. It means every value of x works.

How do you turn a word problem into a linear equation?

Pick a letter for the unknown, write each part of the sentence as an expression, and set the two sides equal. Then solve it like any other equation.

Say a phone plan costs $20 a month plus $0.10 per text, and this month's bill is $35. Let x be the number of texts. The cost is 20 + 0.1x, and it equals 35.

Equation
20 + 0.1x = 35
Subtract 20
0.1x = 15
Divide by 0.1
x = 150

So 150 texts were sent. Check it in the story, not only the equation: 150 texts at 10 cents is $15, and $20 plus $15 is $35. A fixed amount plus a rate times a quantity is the most common shape for these problems, so it's worth spotting quickly.

Frequently asked questions

Short answers to the questions people ask most about this topic.

What is a linear equation calculator?

It solves equations where the variable has power 1, such as 5x + 9 = 2x − 12. It shows each step from simplifying to dividing, and checks the answer by substitution.

How do you know if an equation has no solution?

Solve as usual. If the variable disappears and you're left with something false, like 0 = −5, the equation has no solution.

What does infinitely many solutions mean?

It means every real number makes the equation true. You'll see the variable cancel and leave something like 0 = 0 or 6 = 6.

Can a linear equation have two solutions?

No. A one-variable linear equation has exactly one solution, none, or infinitely many. Two answers means the equation has a squared term, so it's quadratic.

Does it matter which side I put the x terms on?

No, the answer is the same either way. Collecting them on the side with the larger coefficient keeps the numbers positive, which means fewer sign errors.

Can it solve two equations with x and y?

Not on this page. For two or more equations with two or more unknowns, use the system of equations calculator, which solves up to 4 equations at once.

How do I solve a linear equation with decimals?

Either work with the decimals directly or multiply every term by 10 or 100 to clear them first. For 0.5x + 1.2 = 3.7, multiplying by 10 gives 5x + 12 = 37, and both routes lead to x = 5.

What's the difference between a linear equation and a linear expression?

An equation has an equals sign and can be solved, like 5x + 9 = 2x − 12. An expression has no equals sign, like 3x + 9, so you can simplify it but not solve it.

Math keypad

Solve mode

Use the keypad below or tap the expression to use your phone keyboard.

Keyboard tips

Ctrl + Enter
Run the selected operation
a/b key
Select part of the problem first to wrap it in a fraction, root, power, or bars
sin(30)
Scientific functions work in Calculate mode; angles are in degrees unless you use π
^
Enter a power, such as x^2
sqrt(
Calculate an exact or simplified square root
a:b
Separate quantities in a ratio
12, 18
Separate integers in an LCM and GCD calculation
@ x =
Assign x when evaluating an expression
y =
Enter a polynomial function to graph
|
Wrap an absolute-value expression