Sub topic 2
Solving Two-Step Equations
You should already be comfortable with integer and fraction arithmetic, order of operations, and the idea that a variable is a letter standing for an unknown number.
Solving two-step equations
A two-step equation applies two operations to the variable, as in 2x + 3 = 11. Undo the operations in reverse order: first remove the addition or subtraction, then remove the multiplication or division. Apply each step to both sides so the equation stays equivalent.
from fractions import Fraction
def solve_two_step(a, b, c):
"""Solve a*x + b = c for x."""
a, b, c = Fraction(a), Fraction(b), Fraction(c)
return (c - b) / a
print(solve_two_step(2, 3, 11)) # 4
print(solve_two_step(3, -5, 2)) # 7/3Distributing and combining like terms first
Simplify each side before you undo operations. Multiply any parentheses by the factor outside them, then combine like terms.
3(x - 2) + 4 = 2x + 5 3x - 6 + 4 = 2x + 5 3x - 2 = 2x + 5
Collecting variables when they appear on both sides
When x appears on both sides, subtract the smaller variable term from both sides. Then solve the two-step equation that remains.
5x - 4 = 2x + 8 3x - 4 = 8 3x = 12 x = 4
Checking your answer by substitution
Substitute the answer into the original equation. For 3(x - 2) + 4 = 2x + 5 with x = 7, the left side is 3(5) + 4 = 19 and the right side is 2(7) + 5 = 19. Both sides match, so x = 7 is correct.
Exercise
Solve 4x - 7 = 2x + 9 and check your answer.
Show answer
Subtract 2x from both sides to get 2x - 7 = 9. Add 7 to get 2x = 16. Divide by 2 to get x = 8. Check: 4(8) - 7 = 25 and 2(8) + 9 = 25.