Sub topic 10
Like terms with exponents and more than one variable
This chapter assumes you can combine simple like terms such as 3x + 5x, apply the distributive property, and read exponents such as x^3 as repeated multiplication. Here you extend the idea of "like" to terms that contain powers and several variables.
The rule for like terms, restated
Two terms are like terms when their variable parts are identical. The variable part is every variable in the term together with its exponent. The coefficient (the number multiplied in front) is allowed to differ.
So the test has two parts:
- The terms contain exactly the same variables.
- Each variable has exactly the same exponent in both terms.
Only the coefficients are added or subtracted. The variable part is copied unchanged.
| Terms | Like terms? | Reason |
|---|---|---|
| 3x² and 5x² | Yes | Same variable, same exponent |
| 3x² and 5x | No | Exponent 2 versus exponent 1 |
| 4xy and −7xy | Yes | Same variables x and y, each to the first power |
| 4xy and 4x | No | One term has y, the other does not |
| 2x²y and 6x²y | Yes | x² and y¹ in both |
| 2x²y and 6xy² | No | The exponents sit on different variables |
| 9 and −4 | Yes | Both are constants (no variable part) |
Why the exponent matters
An exponent tells you what the variable is. The symbol x² means x · x, a different quantity from x. Suppose x = 3. Then x² = 9 and x = 3, so x² + x cannot be written as one power of x. If you wrote x² + x = 2x², then at x = 3 the left side would be 12 and the right side would be 18. The two sides disagree, so the rewrite is wrong.
Combining like terms works because of the distributive property: 3x² + 5x² = (3 + 5)x² = 8x². The common factor x² can be pulled out only when it is the same in both terms. With x² and x there is no shared factor that makes the sum collapse into one term.
Combining terms with exponents
Treat each distinct variable part as its own "family." Group the terms by family, then add the coefficients within each family.
Example: simplify x² + x + 3x².
- The x² family: x² and 3x². Their coefficients are 1 and 3, giving 4x².
- The x family: x alone, coefficient 1.
The result is 4x² + x. The two families stay separate.
from sympy import symbols, expand
x = symbols('x')
print(expand(x**2 + x + 3*x**2)) # 4*x**2 + xNotice that a term with no visible coefficient, such as x², has a coefficient of 1. A term such as −x² has a coefficient of −1. Writing these coefficients explicitly before combining helps avoid slips.
Terms with more than one variable
A term like 4xy is a product: 4 · x · y. The order of multiplication does not change the value, so xy and yx are the same variable part. Both 3xy and 2yx are like terms, and their sum is 5xy. By convention, we write the variables in alphabetical order.
Example: simplify 4xy + 3x − 2xy + 7x + y.
- Identify the families: xy, x, and y.
- The xy family: 4xy − 2xy = 2xy.
- The x family: 3x + 7x = 10x.
- The y family: y alone.
The result is 2xy + 10x + y.
from sympy import symbols, expand
x, y = symbols('x y')
expr = 4*x*y + 3*x - 2*x*y + 7*x + y
print(expand(expr)) # 2*x*y + 10*x + yExponents spread across variables
When terms have several variables with exponents, compare each variable separately. Take 5x²y, −2xy², and 3x²y.
- 5x²y has x to the power 2 and y to the power 1.
- −2xy² has x to the power 1 and y to the power 2.
- 3x²y has x to the power 2 and y to the power 1.
Only 5x²y and 3x²y match, so they combine to 8x²y. The term −2xy² is in its own family. The full sum is 8x²y − 2xy².
from sympy import symbols, expand
x, y = symbols('x y')
print(expand(5*x**2*y - 2*x*y**2 + 3*x**2*y)) # 8*x**2*y - 2*x*y**2Putting it together with parentheses
Often you must distribute first and then combine. Distribute a number or a variable to every term inside the parentheses, including the sign of each term.
Example: simplify 2x(x + 3) + 3x² − 4x.
- Distribute 2x: 2x · x = 2x², and 2x · 3 = 6x. This gives 2x² + 6x.
- Rewrite the whole expression: 2x² + 6x + 3x² − 4x.
- The x² family: 2x² + 3x² = 5x².
- The x family: 6x − 4x = 2x.
The result is 5x² + 2x.
Multiplying x by x gives x², not 2x. When you multiply variable parts, you add the exponents of the same variable (x¹ · x¹ = x²). This is different from adding like terms, where the variable part stays unchanged.
from sympy import symbols, expand
x = symbols('x')
print(expand(2*x*(x + 3) + 3*x**2 - 4*x)) # 5*x**2 + 2*xMultiplication versus addition: a side-by-side view
Two operations are easy to confuse here, so compare them directly.
| Operation | Example | What happens to the exponent |
|---|---|---|
| Adding like terms | 3x² + 5x² = 8x² | Unchanged. Only the coefficients add. |
| Multiplying terms | 3x² · 5x² = 15x⁴ | Exponents add, coefficients multiply. |
| Multiplying different powers | x · x² = x³ | Exponents add (1 + 2 = 3). |
If you see a plus or minus sign between terms, you are adding families. If terms are multiplied, you are building a new variable part.
Checking your work
Substitute numbers for the variables into the original and the simplified expression. If the results differ, there is an error. Pick values that are not 0 or 1, because those values hide mistakes (for example, 1² = 1 makes x² and x look equal).
from sympy import symbols
x, y = symbols('x y')
original = 4*x*y + 3*x - 2*x*y + 7*x + y
simplified = 2*x*y + 10*x + y
values = {x: 2, y: 3}
print(original.subs(values), simplified.subs(values)) # 35 35Check by hand: the original at x = 2 and y = 3 is 24 + 6 − 12 + 14 + 3 = 35. The simplified form gives 12 + 20 + 3 = 35.
A single matching test does not prove equivalence, but a mismatch proves the two are different. Try two or three sets of values for more confidence.
Common errors in this chapter
- Combining different powers: writing x² + x = x³ or 2x². The terms are not like terms, so the sum stays as x² + x.
- Changing the exponent while adding: writing 3x² + 5x² = 8x⁴. Only coefficients add.
- Treating x²y and xy² as like terms because the total degree matches.
- Forgetting an implied coefficient of 1: x² + x² is 2x², not x⁴ or x².
- Dropping a negative sign: in 5xy − 8xy, the coefficients are 5 and −8, giving −3xy.
- Confusing xy with x + y. The first is a product; the second is a sum, and they are different.
Process summary
Exercise
Simplify 6a²b − 2ab² + 4a²b + 5ab² − a²b, and say which terms are like terms.
Show answer
The a²b family is 6a²b, 4a²b, and −a²b (coefficient −1). Their coefficients add to 6 + 4 − 1 = 9, giving 9a²b. The ab² family is −2ab² and 5ab², which add to 3ab². The result is 9a²b + 3ab². The two families are not like terms because the exponents are on different variables.
Exercise
A student simplifies 2x(x + 4) + x² as 3x² + 8x by writing 2x · x = 2x² and 2x · 4 = 8x, then adding 2x² + x² = 3x². Is this correct? Then check it using x = 2.
Show answer
Yes, it is correct. Distribution gives 2x² + 8x, and adding x² gives 3x² + 8x. Check at x = 2: the original is 2·2·(2 + 4) + 4 = 24 + 4 = 28. The simplified form is 3·4 + 16 = 28. The values match.
Exercise
Explain why x² + x² = 2x² and not x⁴, using the distributive property.
Show answer
x² + x² = 1·x² + 1·x² = (1 + 1)x² = 2x². The distributive property pulls out the shared factor x² and adds the coefficients. The exponent describes the shared factor and is not changed by addition. Exponents add only when terms are multiplied, as in x² · x² = x⁴.