Sub topic 6
Recognizing Like Terms
Combining terms only works when the terms are alike. This chapter covers how to decide whether two terms are like terms. It covers coefficients, signs, constants, products of variables, and exponents. Combining them is the next chapter's job.
This chapter assumes you can do arithmetic with integers and fractions (including negatives) and know what an exponent such as 3^2 means. It also assumes you know that an expression is split into terms, and that each term has a sign, a coefficient, and possibly variables.
The definition
Two terms are like terms if they have exactly the same variable part. The variable part is everything left after you remove the numerical coefficient. It includes each variable and the exponent on each variable.
Coefficients can be different. Signs can be different. Only the variable part has to match.
| Term | Coefficient | Variable part |
|---|---|---|
| 5x | 5 | x |
| -y | -1 | y |
| x | 1 | x |
| 4 | 4 | none |
| 3x² | 3 | x² |
| -2xy | -2 | xy |
| x/2 | 1/2 | x |
A term with no variable is a constant. Its variable part is empty. Any two constants are like terms.
A three-question test
To compare two terms, strip off the sign and coefficient of each, then ask three questions about what is left:
- Do both terms use exactly the same set of variables?
- Does each variable have the same exponent in both terms?
- If both questions are answered yes, the terms are like terms.
If either answer is no, the terms are unlike.
Worked comparisons
Pairs that are like terms
- 3x and -5x. The variable part is x in both. The coefficients (3 and -5) and signs differ, which is allowed.
- x and 9x. A bare x has coefficient 1, so the variable parts match.
- 7 and -2. Both are constants.
- 4xy and -xy. The variable part is xy in both.
- 2xy and 5yx. Multiplication is commutative, so the order of the letters does not matter. Both have variable part xy.
- 6x² and x². Both have the variable part x².
- x/2 and 3x. Dividing by 2 is the same as multiplying by 1/2, so x/2 has coefficient 1/2 and variable part x.
Pairs that are unlike terms
- 3x and 3y. The variables differ. Equal coefficients do not help.
- x and x². The exponents differ (1 and 2).
- x and xy. The second term has an extra variable.
- 5x and 5. One term has a variable part and the other has none.
- x²y and xy². Both use x and y, but the exponents are attached to different letters.
- x and 1/x. Since 1/x is x⁻¹, the exponents are 1 and -1.
The pair x²y and xy² is a frequent mistake. Both terms contain the same letters and the same total degree (3), but the variable parts are not identical. You need an exact match of each variable with its own exponent.
Signs belong to the term
In 4x - 3y + 2x, the subtraction sign attaches to the term that follows it. The terms are 4x, -3y, and +2x. Only 4x and +2x are like terms. The sign only becomes part of the coefficient. So in 6x - 2x, the terms 6x and -2x are like terms with coefficients 6 and -2.
When you are marking like terms, a useful habit is to put the sign in front of each term and keep it there. Reordering terms is allowed, but each sign must travel with its term.
Constants
Every number without a variable is a constant term. In 3x + 4 - 7 + 2x, the terms 4 and -7 are like terms. So are 3x and 2x. The constants do not combine with the x terms.
One way to see why constants form their own group is to write them with a variable part of x⁰. Since x⁰ = 1 for any nonzero x, 4 is the same as 4x⁰. The exponent 0 differs from the exponent 1 on 3x, so they are unlike. This is a thinking aid, not a rule you need to write out.
Several variables and exponents
The same two checks apply no matter how many variables a term has. Compare each variable and its exponent separately.
| Pair | Like? | Reason |
|---|---|---|
| 3ab and -ab | Yes | Variable part ab in both |
| 3ab and 3a | No | Second term has no b |
| a²b and 4ba² | Yes | Same letters with same exponents, in a different order |
| a²b and ab² | No | Exponents are on different letters |
| 2x³ and x³ | Yes | Same exponent |
| 2x³ and 2x² | No | Exponents 3 and 2 |
| (x)² and x² | Yes | Same value; (x)² is x² |
Exponents come up again, with more detail on combining such terms, in a later chapter. For now, you only need to compare them.
Checking like terms with code
A program can do the same test: split each term into a coefficient and a variable part, then compare the variable parts. In SymPy, as_coeff_Mul() returns exactly that pair.
from sympy import symbols
x, y = symbols('x y')
def are_like(a, b):
"""Two terms are like if their variable parts match."""
return a.as_coeff_Mul()[1] == b.as_coeff_Mul()[1]
pairs = [
(3*x, -5*x),
(x*y, 4*y*x),
(x**2, x),
(7, -2),
(3*x, 3*y),
]
for a, b in pairs:
# Python ints need to become SymPy numbers for as_coeff_Mul
from sympy import sympify
a, b = sympify(a), sympify(b)
print(a, "and", b, "->", are_like(a, b))Running this prints:
3*x and -5*x -> True
x*y and 4*x*y -> True
x**2 and x -> False
7 and -2 -> True
3*x and 3*y -> FalseSymPy writes 4*y*x as 4*x*y because it keeps products in a standard order. That matches the fact that the order of letters does not matter.
The next example groups a whole list of terms by variable part. Each group is a set of like terms.
from sympy import symbols
x, y = symbols('x y')
terms = [3*x, 2*y, 5*x, -y, 4, -7, x**2, 3*x**2]
groups = {}
for t in terms:
coeff, rest = t.as_coeff_Mul()
groups.setdefault(rest, []).append(coeff)
for variable_part, coeffs in groups.items():
print(variable_part, coeffs)The output is:
x [3, 5]
y [2, -1]
1 [4, -7]
x**2 [1, 3]Each line is one family of like terms. The key 1 stands for the constants. The coefficient -1 in the y group comes from the term -y, which has an invisible coefficient of -1. Seeing the groups laid out like this is the first half of combining. The second half, adding the coefficients in each list, is covered in the chapter on combining like terms.
Strategies for spotting like terms by hand
For a long expression, a consistent marking method prevents missed terms.
- Rewrite the expression so that every term has an explicit sign and coefficient. For example, write x - y + 4 as +1x - 1y + 4.
- Pick one variable part, such as x. Mark every term with exactly that variable part using one symbol, such as an underline.
- Use a different mark for the next variable part, such as a circle for y, and a box for constants.
- Keep going until every term carries a mark. A term left unmarked belongs to a variable part you have not handled yet. A term that is the only one in its group stands alone.
For 4x² - 3x + 2 - x² + 5x - 6, the groups are:
- x² terms: 4x² and -x²
- x terms: -3x and 5x
- constants: 2 and -6
Every term is placed in one group, and no group mixes variable parts.
Common errors when recognizing like terms
- Matching on the coefficient. 3x and 3y look similar because both start with 3, but the variables differ.
- Matching on the letters only. x and x² use the same letter but differ in exponent.
- Matching on total degree. x²y and xy² both have degree 3, but are unlike.
- Forgetting the invisible 1. x and -x are like terms with coefficients 1 and -1.
- Ignoring the sign of a term. In 5 - 2x + 3x, the term after the minus is -2x, not 2x.
- Treating a constant as a variable term. 5 and 5x are unlike.
Practice
Exercise
Which of these pairs are like terms? (a) 6x and -x, (b) 2xy and 2x, (c) 3a²b and -4ba², (d) 9 and -9x, (e) 5m² and 5m.
Show answer
(a) Yes, both have variable part x. (b) No, the first has y and the second does not. (c) Yes, both have variable part a²b, since the order of the letters does not matter. (d) No, one is a constant and the other has x. (e) No, the exponents on m are 2 and 1.
Exercise
Group the terms of 7x - 2y + 3 + x² - 4x + y - 8 + 5x² into families of like terms. List each family. Do not combine them.
Show answer
x² terms: x² and 5x². x terms: 7x and -4x. y terms: -2y and y. Constants: 3 and -8.
Exercise
The terms x²y and xy² have the same letters and the same total degree. Explain why they are not like terms, and give one term that is like x²y.
Show answer
In x²y, x has exponent 2 and y has exponent 1. In xy², x has exponent 1 and y has exponent 2. The variable parts are different, so the terms are unlike. A term like x²y is -6yx², for example.
Exercise
In the expression 10 - 3a + 2b - a - 5, what are the coefficients of the terms in the a family, and which terms are constants?
Show answer
The a family is -3a and -a, with coefficients -3 and -1. The constants are 10 and -5.