Objective
Learning objectives
- Translate a plain-language statement into an algebraic equation
- Combine like terms to simplify an expression
- Solve for a variable by undoing operations in reverse order
- Verify a solved equation by substituting the answer back in
Hook
"Twice a number, plus 3, is 15." Read that sentence again slowly — it's a complete, precise statement, and it has exactly one right answer. But as a sentence, it's hard to work with. The first real move in solving anything isn't calculating — it's translating the sentence into something you can operate on: 2x + 3 = 15.
See it
Think of 2x + 3 as a recipe: start with a number, double it, then add 3. An equation just says the finished recipe equals a specific result — here, 15. Solving means running the recipe backward: undo the last step first, then the step before that, all the way back to the number you started with.
2x + 3 = 15 the recipe, run forward, equals 15
2x = 12 undo "add 3" — subtract 3 from both sides
x = 6 undo "double" — divide both sides by 2
The rule that makes this legal is simple and easy to forget precisely because it's simple: whatever you do to one side, you must do to the other. The equation is a balance — subtracting 3 from the left without subtracting 3 from the right would tip it.
Undo in reverse order, always
If building the expression was "double it, then add 3," undoing it is "undo the add, then undo the double" — last step first. Getting the order backward (dividing by 2 before subtracting 3) still eventually reaches an answer here, but it stops working the moment expressions get more complex, so it's worth building the reverse-order habit now while the equations are simple enough to check by eye.
Name it
Like terms are terms that have the exact same variable part — 3x and 2x are like terms and can be combined into 5x; 3x and 3 are not (one has a variable, one doesn't), and neither are 3x and 3x² (different powers of x).
Isolating a variable means using reverse operations to end up with the variable alone on one side of the equation — exactly what happened above, ending at x = 6.
Checking a solution by substitution means plugging your answer back into the original equation and confirming both sides genuinely come out equal — not re-doing the algebra, but independently testing whether the claimed answer actually satisfies the original statement.
x = 6
left_side = 2 * x + 3
right_side = 15
print(left_side, right_side, left_side == right_side)
15 15 True
This matters more than it looks like it should. Algebra is a sequence of manual steps, and manual steps have a real error rate — substitution doesn't care how you got your answer, it only checks whether the answer is actually correct. It's the same discipline as testing code: trust, but verify.
Here's a slightly bigger example, combining like terms before isolating: 3x + 2x - 4 = 2x + 11.
3x + 2x - 4 = 2x + 11 combine like terms on the left: 3x + 2x = 5x
5x - 4 = 2x + 11 undo having x on both sides — subtract 2x from both
3x - 4 = 11 undo "subtract 4" — add 4 to both sides
3x = 15
x = 5
Code it
def check_solution(x, left_fn, right_fn):
left = left_fn(x)
right = right_fn(x)
return left == right, left, right
is_correct, left, right = check_solution(
5,
lambda x: 3 * x + 2 * x - 4,
lambda x: 2 * x + 11,
)
print(is_correct, left, right)
True 21 21
check_solution takes the two sides of the original equation as functions, not pre-simplified — it evaluates the left side and the right side independently at your proposed answer and compares them. That's a deliberately more honest check than testing the simplified 3x = 15 form: it verifies against the equation you actually started with, catching mistakes made anywhere in the simplification, not just in the final division.
is_correct, left, right = check_solution(
7,
lambda x: 4 * x - 5,
lambda x: 2 * x + 9,
)
print(is_correct, left, right)
Solving by hand first: 4x - 5 = 2x + 9 → subtract 2x from both sides → 2x - 5 = 9 → add 5 to both sides → 2x = 14 → divide by 2 → x = 7. Substituting back: left side 4(7) - 5 = 23, right side 2(7) + 9 = 23. Both sides agree, so check_solution reports True — the same reverse-order undoing from See It, verified independently by code rather than trusted on faith.