TExcelTAD
Home › Algebra › Equations with One Unknown

Equations with One Unknown

A linear equation in one unknown, such as 7x−4=3x+207x - 4 = 3x + 20, has at most one solution, and a fixed routine always finds it: simplify each side, gather the unknown on one side, then isolate it. This lesson turns that routine into a checklist, treats the special cases (no solution and every number), and writes a tiny solver for equations of the form ax+b=cx+dax + b = cx + d.

The routine

Step What to do Example: 3(2x−5)+4=2(x+7)−13(2x - 5) + 4 = 2(x + 7) - 1
1 Remove parentheses on both sides 6x−15+4=2x+14−16x - 15 + 4 = 2x + 14 - 1
2 Combine like terms on each side 6x−11=2x+136x - 11 = 2x + 13
3 Move the unknown terms to one side 4x−11=134x - 11 = 13 (subtract 2x2x)
4 Move the numbers to the other side 4x=244x = 24 (add 11)
5 Divide by the coefficient x=6x = 6
6 Check in the original equation 3(7)+4=253(7) + 4 = 25 and 2(13)−1=252(13) - 1 = 25 ✓

Every step is an equivalent transformation: it does the same thing to both sides, so the new equation has exactly the same solutions as the old one. This is why the method is safe. (Later lessons meet steps that are not equivalent, such as squaring both sides, and those need extra care.)

Tip: Move the xx terms toward the side with the bigger coefficient. In 2x+13=6x−112x + 13 = 6x - 11, subtracting 2x2x leaves a positive 4x4x on the right and avoids dividing by a negative.

Negative coefficients

If the unknown ends with a negative coefficient, divide by that negative number:

5−3x=17−3x=12subtract 5x=−4divide by −3check: 5−3(−4)=5+12=17 ✓\begin{aligned} 5 - 3x &= 17 \\ -3x &= 12 && \text{subtract 5} \\ x &= -4 && \text{divide by } -3 \\[1ex] &\text{check: } 5 - 3(-4) = 5 + 12 = 17\ \checkmark \end{aligned}

Three possible outcomes

After gathering terms, every linear equation looks like kx=mkx = m:

Case After simplifying Solutions Example
k≠0k \ne 0 x=m/kx = m/k exactly one 4x=244x = 24
k=0k = 0, m≠0m \ne 0 0=m0 = m (false) none 2x+3=2x+82x + 3 = 2x + 8
k=0k = 0, m=0m = 0 0=00 = 0 (true) every number 2(x+4)=2x+82(x + 4) = 2x + 8

SymPy distinguishes them: solve returns a single value, an empty list, or (for an identity) also an empty list, which is ambiguous. solveset makes the difference explicit:

python · try it yourself
from sympy import symbols, Eq, solve, solveset, S

x = symbols("x")
eq1 = Eq(3*(2*x - 5) + 4, 2*(x + 7) - 1)
eq2 = Eq(2*x + 3, 2*x + 8)
eq3 = Eq(2*(x + 4), 2*x + 8)
print(solve(eq1, x), solveset(eq1, x, S.Reals))
print(solve(eq2, x), solveset(eq2, x, S.Reals))
print(solve(eq3, x), solveset(eq3, x, S.Reals))
[6] {6}
[] EmptySet
[] Reals

A solver for ax+b=cx+dax + b = cx + d

Gathering terms turns ax+b=cx+dax + b = cx + d into (a−c)x=d−b(a - c)x = d - b. That single line is a complete solver, as long as it handles the k=0k = 0 cases. Using Fraction keeps answers exact:

python · try it yourself
from fractions import Fraction as F

def solve_linear(a, b, c, d):
    """Solve a*x + b = c*x + d."""
    k, m = F(a) - F(c), F(d) - F(b)
    if k != 0:
        return m / k
    return "every number" if m == 0 else "no solution"

print(solve_linear(6, -11, 2, 13))     # 6x - 11 = 2x + 13
print(solve_linear(-3, 5, 0, 17))      # -3x + 5 = 17
print(solve_linear(4, 1, 1, 3))        # 4x + 1 = x + 3
print(solve_linear(2, 3, 2, 8))
print(solve_linear(2, 8, 2, 8))
6
-4
2/3
no solution
every number

Decimals

Equations with decimal coefficients can be cleared by multiplying both sides by a power of 10:

0.4x+1.5=0.25x+340x+150=25x+300multiply by 10015x=150x=10\begin{aligned} 0.4x + 1.5 &= 0.25x + 3 \\ 40x + 150 &= 25x + 300 && \text{multiply by 100} \\ 15x &= 150 \\ x &= 10 \end{aligned}

In software

Linear equations hide inside many routine calculations: the price before tax from a total, the time an animation reaches a frame, the speed needed to arrive on time. A solver like solve_linear is the simplest example of solving equations in code; the important engineering detail is the k=0k = 0 branch, the algebraic version of guarding against division by zero.

Exercises

Exercise 1: The full routine

Solve 4(x−3)−2=5−3(x+1)4(x - 3) - 2 = 5 - 3(x + 1).

Answer

x=167x = \frac{16}{7}

Solution
4x−12−2=5−3x−34x−14=2−3x7x−14=2add 3x7x=16add 14x=167\begin{aligned} 4x - 12 - 2 &= 5 - 3x - 3 \\ 4x - 14 &= 2 - 3x \\ 7x - 14 &= 2 && \text{add } 3x \\ 7x &= 16 && \text{add 14} \\ x &= \frac{16}{7} \end{aligned}
python · try it yourself
from sympy import symbols, Eq, solve
x = symbols("x")
print(solve(Eq(4*(x - 3) - 2, 5 - 3*(x + 1)), x))
[16/7]

Exercise 2: Decimals

Solve 1.2x−0.5=0.7x+21.2x - 0.5 = 0.7x + 2.

Answer

x=5x = 5

Solution
12x−5=7x+20multiply by 105x=25x=5check: 6−0.5=5.5 and 3.5+2=5.5 ✓\begin{aligned} 12x - 5 &= 7x + 20 && \text{multiply by 10} \\ 5x &= 25 \\ x &= 5 \\[1ex] &\text{check: } 6 - 0.5 = 5.5 \text{ and } 3.5 + 2 = 5.5\ \checkmark \end{aligned}

Exercise 3: Which case?

Classify each without fully solving: (a) 3(x−2)=3x−63(x - 2) = 3x - 6, (b) 5x−1=5(x+1)5x - 1 = 5(x + 1), (c) 2x+9=92x + 9 = 9.

Answer

(a) every number, (b) no solution, (c) exactly one, x=0x = 0.

Solution

(a) Both sides are 3x−63x - 6, an identity. (b) 5x−1=5x+55x - 1 = 5x + 5 leads to −1=5-1 = 5, false. (c) 2x=02x = 0, so x=0x = 0. A solution of zero is still a solution.

Exercise 4: Price before tax

A total of €95.20 includes 19% sales tax. Set up the equation, solve it by hand, and check it with solve_linear (a=1.19a = 1.19, b=0b = 0, c=0c = 0, d=95.20d = 95.20, using strings so Fraction stays exact).

Answer

1.19p=95.201.19p = 95.20, p=€80p = \text{€}80.

Solution
p+0.19p=95.201.19p=95.20p=80\begin{aligned} p + 0.19p &= 95.20 \\ 1.19p &= 95.20 \\ p &= 80 \end{aligned}
python · try it yourself
from fractions import Fraction as F

def solve_linear(a, b, c, d):
    k, m = F(a) - F(c), F(d) - F(b)
    if k != 0:
        return m / k
    return "every number" if m == 0 else "no solution"

print(solve_linear("1.19", 0, 0, "95.20"))
80

Test yourself

Solve 9−2x=3x−69 - 2x = 3x - 6.

  1. x=3x = 3
  2. x=−3x = -3
  3. x=0.6x = 0.6
  4. x=15x = 15

After simplifying, an equation becomes 0=70 = 7. What does that mean?

  1. x=7x = 7
  2. x=0x = 0
  3. Every number is a solution
  4. There is no solution

Why should you check the answer in the original equation rather than in a later line?

  1. It is shorter
  2. A mistake in an early step would also be in later lines and go unnoticed
  3. SymPy requires it
  4. Later lines have no xx