An expression is a recipe
Module 1 left you with single-variable expressions and the tree behind them. Module 2 takes the lid off: more variables, more structure, but no new kind of object.
An expression like is still just a recipe. Hand it values for its variables and it collapses to a single number. The variables are named boxes; the operators are the steps; the output is whatever falls out the bottom.
The new skill this lesson is about isn’t evaluating expressions. It’s rewriting them: turning one expression into a different-looking expression that computes the exact same thing.
Like terms: same box, same power
Two terms are like terms when their variable parts are identical: the same letters raised to the same powers. and are like terms. and are not. and are not.
Like terms collapse together by adding only their coefficients: . Unlike terms just sit side by side; there’s nothing to merge.
Why is this legal? Because means “three copies of plus five copies of ,” which is eight copies of , for every value could take. You’re not solving anything. You’re noticing that two ways of writing the count are the same count.
Collect the like terms
Simplify by combining like terms. Then evaluate your simplified expression at .
What is the value?
The distributive law, both directions
Here is the one structural rule that does most of the work in algebra:
Read left to right, it’s distributing: a product wrapped around a sum becomes a sum of products. Read right to left, it’s factoring: a sum with a shared piece becomes a single product.
It’s not a coincidence or a convention. Picture a rectangle that is tall and wide. Its area is . Now slice it down the middle into an piece and an piece. Same rectangle, same area, two names for it. That’s the whole proof.
Click a node in the tree and pick a rewrite. Distribute a product into a sum, combine like terms, factor a common piece back out. The tree changes shape with every move. Watch the value at x = 2 readout the entire time.
The thing that never moves
You just watched an expression’s tree get rearranged repeatedly, and the value at x = 2 readout did not flinch. That is the point of the whole lesson.
A rewrite is a value-preserving transformation. It changes the syntax (what the expression looks like, how its tree is shaped) and leaves the semantics (what it computes, for every input) untouched. Distributing, factoring, collecting like terms: all of them are this.
This is exactly what a compiler does when it optimizes your code, and what a computer algebra system does when it simplifies. The expression on the screen is allowed to change. The function it denotes is not.
The minus-sign trap
One rewrite causes more wrong answers than all the others combined: distributing a negative.
The expression is shorthand for . Distribute the into both terms:
Not . The hits the and the , and a negative times a negative is a positive. Miss the second term and every sign downstream is wrong. When you see a minus sign in front of a parenthesis, treat it as a that must touch everything inside.
Distribute, then collect
Simplify . Distribute both products first, mind the signs, then combine like terms. Evaluate the result at .
What is the value?
Substitution is the type check
How do you know a rewrite didn’t break anything? You substitute.
Pick a value, plug it into the original expression and into your rewritten one, and confirm they land on the same number. They have to, if the rewrite was legal, because a legal rewrite preserves value at every input.
In code you’d call this a test. You changed the implementation; you ran it on a known input; you asserted the output is unchanged. Same instinct, same safety. One substitution won’t prove two expressions are equal everywhere, but it catches almost every slip, and the slips it catches are the sign errors and the dropped terms that would otherwise haunt you for three more steps.
When distribution does not apply
A warning that will save you later. The distributive law connects multiplication and addition. It does not mean exponents distribute over addition.
Check it: , but . Not equal. The correct expansion is , and the extra is the two off-diagonal rectangles when you draw by as a square. The cross terms are real area; you can’t wish them away.
Square a sum
Evaluate at and . Add first, then square the result.
What is the value?
Where this goes next
You can now take an expression and reshape it: distribute, factor, collect like terms, and prove you didn’t break it by substituting. Every later lesson leans on this. Solving an equation will mean rewriting it into a shape you can read off; deriving the quadratic formula will be one long chain of legal rewrites.
g(f(x)) is one layer of a neural network wired into the next. log(∏) = ∑(log) is why a million tiny probabilities don’t sink training. Everything in this module is those two facts at scale, and rewriting expressions without changing their value is the ground they stand on.
Lesson complete