Lesson illustration

Combining Like Terms in Algebraic Expressions

Hello again. In the previous lesson, you worked with powers and roots, paying particular attention to what an exponent applies to. That distinction now becomes useful in algebra: xx, x2x^2, and x3x^3 are different kinds of terms, even though they use the same letter.

This lesson introduces a central simplification skill: combining like terms. You will learn to identify the pieces of an algebraic expression, preserve signs correctly, group only genuinely matching terms, and verify that a simplified expression still gives the same result. This is the first step toward reading model formulas such as linear-regression equations clearly.


Expressions are collections of terms

An algebraic expression is a combination of numbers, variables, and operations. For example,

5x23x+85x^2 - 3x + 8

has three terms:

5x2,3x,85x^2,\qquad -3x,\qquad 8

A term is separated from neighboring terms by an addition or subtraction sign. It is useful to treat subtraction as “adding a negative,” so the minus sign belongs to the term after it:

5x2+(3x)+85x^2 + (-3x) + 8

Each variable term has two pieces:

  • the coefficient: the numerical multiplier;
  • the variable part: the variable or variables, including their exponents.

For 5x25x^2, the coefficient is 55 and the variable part is x2x^2. For 3x-3x, the coefficient is 3-3 and the variable part is xx.

When no coefficient is written, it is 11:

x=1xx = 1x

Likewise,

x=1x-x=-1x

The distinction between a coefficient and a variable part is the key to this lesson. You may combine the numerical coefficients only when the variable parts are identical.

Watch this concise visual introduction before moving into the detailed method.

{"type":"video","title":"An Intro to Combining Like Terms | Simplifying Expressions by Combining Like Terms | Math with Mr. J","learning_duration":489,"video_id":"eNv4fHb7OvU","par_intro":"In “An Intro to Combining Like Terms,” Math with Mr. J shows the visual process of spotting matching terms, grouping them, and handling signs. Watch it to establish a reliable first-pass routine.","par_directions":"Watch <span data-type=\"resource_video_timerange\" data-resource-subitem-id=\"220004eb\" data-range-start=\"36\" data-range-end=\"117\">the basic idea</span> for the definition of like terms, coefficients, and the role of constant terms. Then continue through <span data-type=\"resource_video_timerange\" data-resource-subitem-id=\"ff785bda\" data-range-start=\"189\" data-range-end=\"364\">powers and grouping</span>, paying attention to why \\(y\\) and \\(y^2\\) cannot be merged. Finish with <span data-type=\"resource_video_timerange\" data-resource-subitem-id=\"8be78e5c\" data-range-start=\"364\" data-range-end=\"597\">negative terms</span>, especially the advice to carry the sign with a term when rearranging an expression.","video_duration":619,"isV2":true,"blockId":"cba73462-ce12-4aaa-897c-170b6a7a9247","lessonId":"4f581306-e934-4ade-93c9-a35d46bad308"}




What “like” means

Two terms are like terms when they have the same variable part: the same variables, each raised to the same exponent. Their coefficients may differ.

For example, these are like terms:

4xand7x4x \quad \text{and} \quad -7x

because both have variable part xx. Therefore,

4x7x=(47)x=3x4x-7x=(4-7)x=-3x

Likewise,

6x2+2x2=8x26x^2+2x^2=8x^2

because both variable parts are x2x^2.

The general pattern is:

av+bv=(a+b)vav+bv=(a+b)v

Here, vv stands for an identical variable part. You add the coefficients and retain that shared part.

This should feel similar to counting objects: 44 copies of one thing plus 33 more copies of exactly the same thing gives 77 copies. Algebra uses xx as the name of the thing being counted.

{"type":"image","url":"https://cdn.kastatic.org/googleusercontent/VTr15zetlK01KWaaEfOgeL6wIBxyTVD9Nzj5J6jqClaaKhwqSR549sg3nEHteDUAtqN_ZcmmF_lVtlPfPzjP7L4T","caption":"The image groups \\(2x\\) with \\(3x\\), and \\(7y\\) with \\(2y\\), showing that the expression simplifies to \\(5x+9y\\). Terms can be brought together even when they were not adjacent originally.","isV2":true,"blockId":"a7ab351e-4664-4699-8ecf-4bd8f6355230","lessonId":"4f581306-e934-4ade-93c9-a35d46bad308"}



Terms that are not like terms

Do not combine terms merely because they contain a similar-looking variable.

TermsLike terms?Reason
3x3x and 8x8xYesBoth have variable part xx.
3x23x^2 and 8x28x^2YesBoth have variable part x2x^2.
3x3x and 8y8yNoThe variables differ.
3x3x and 8x28x^2NoThe exponents differ.
44 and 9-9YesBoth are constants; neither has a variable part.
5xy5xy and 2yx-2yxYesMultiplication order does not matter, so xy=yxxy=yx.
5x2y5x^2y and 5xy25xy^2NoThe exponent is attached to a different variable in each term.

The most common mistake is confusing addition with multiplication:

x+x=2xx+x=2x

but

xx=x2x\cdot x=x^2

Adding two copies of xx is not the same operation as multiplying xx by itself.

For a short written recap, use the following Khan Academy article. It reinforces the definition and includes examples with several variables and constants.

{"type":"reading","par_intro":"Read Khan Academy’s “Combining like terms review” to see the coefficient rule stated compactly and applied to expressions with multiple kinds of terms.","par_directions":"In the section “What is combining like terms?”, read <span data-type=\"resource_reading_textrange\" data-resource-subitem-id=\"c026535f\" data-range-start=\"We call terms &quot;like terms&quot; if they have the same variable part.\" data-range-end=\"The cool thing about like terms is that we can combine them into a single term by adding their coefficients. For example:\">the definition and rule</span>. Then continue through the “More examples” section. Notice how the author first collects the \\(r\\)-terms or \\(x\\)-terms, then handles ordinary constants separately. You can stop before “Check your understanding.”","learning_duration":"6 minutes","url":"https://www.khanacademy.org/math/algebra-home/alg-intro-to-algebra/alg-manipulating-expressions/a/combining-like-terms-reminder","title":"Combining like terms review (article)","isV2":true,"blockId":"b589e4fc-ad89-47d9-aedc-f370ea9987f2","lessonId":"4f581306-e934-4ade-93c9-a35d46bad308"}



{
  "type": "exercise",
  "id": "59040ace-79da-41cb-b184-da885aefccb9"
}

A dependable simplification routine

When an expression has several terms, use the same three-stage process each time:

  1. Identify the terms, including their signs.
  2. Sort terms into groups with identical variable parts.
  3. Add the coefficients within each group, then write each unmatched term once.

Reordering is allowed because addition can be performed in any order. You are not changing the expression’s value; you are only making its structure easier to see.

Consider:

7y+2x+3x+2y7y+2x+3x+2y

First identify the two groups:

  • xx-terms: 2x2x and 3x3x
  • yy-terms: 7y7y and 2y2y

Rewrite with like terms adjacent:

2x+3x+7y+2y2x+3x+7y+2y

Then combine each group:

(2+3)x+(7+2)y(2+3)x+(7+2)y 5x+9y5x+9y

There is no reason to combine 5x5x and 9y9y: their variable parts differ. Thus 5x+9y5x+9y is simplified.

The order of the final terms is usually not important:

5x+9y5x+9y

and

9y+5x9y+5x

are equivalent. Still, write answers in a consistent order, such as xx-terms before yy-terms, so that your work stays readable.


Worked examples: powers, constants, and negative signs

Example 1: terms with different powers

Simplify:

6y2+10y+2y2+3y+y6y^2+10y+2y^2+3y+y

The y2y^2-terms belong together, and the yy-terms belong together. Remember that the final yy has an implied coefficient of 11:

6y2+2y2+10y+3y+1y6y^2+2y^2+10y+3y+1y

Now add the coefficients within each group:

(6+2)y2+(10+3+1)y(6+2)y^2+(10+3+1)y 8y2+14y8y^2+14y

The terms 8y28y^2 and 14y14y remain separate. Their exponents differ, so they do not represent the same variable part.

Example 2: preserve every sign

Simplify:

7x+2y4x+2y7x+2y-4x+2y

Treat the subtraction as part of the term 4x-4x. Group matching terms without losing that negative sign:

7x4x+2y+2y7x-4x+2y+2y

Then combine:

(74)x+(2+2)y(7-4)x+(2+2)y 3x+4y3x+4y

A common error would be to move 4x4x but accidentally turn 4x-4x into +4x+4x. Keeping the sign attached prevents this.

Example 3: constants are a group too

Simplify:

3a+125a+43a+12-5a+4

The variable terms are 3a3a and 5a-5a. The constants are 1212 and 44:

3a5a+12+43a-5a+12+4 (35)a+(12+4)(3-5)a+(12+4) 2a+16-2a+16

Constants are like terms because they all have the same “no variable” part.

Example 4: two variables in one term

In data science, a formula may eventually contain several input variables. The same matching rule applies.

Simplify:

3xy2yx+4x2y3xy-2yx+4x^2y

Because multiplication can be reordered,

yx=xyyx=xy

so the first two terms match:

3xy2xy+4x2y3xy-2xy+4x^2y (32)xy+4x2y(3-2)xy+4x^2y xy+4x2yxy+4x^2y

Do not merge the remaining terms. The first has variable part xyxy; the second has x2yx^2y.

{
  "type": "exercise",
  "id": "b84bb4a3-d526-4360-b4cd-7d9832d2fa24"
}

Simplification preserves value

A simplified expression must have exactly the same value as the original expression for every permitted choice of its variables.

For instance, these expressions are equivalent:

7y+2x+3x+2y7y+2x+3x+2y 5x+9y5x+9y

If x=2x=2 and y=1y=-1, the original gives:

7(1)+2(2)+3(2)+2(1)7(-1)+2(2)+3(2)+2(-1) =7+4+62=-7+4+6-2 =1=1

The simplified expression gives:

5(2)+9(1)5(2)+9(-1) =109=10-9 =1=1

Checking one input does not prove equivalence for every possible input, but it is an excellent way to catch a sign error.

Since you are already comfortable in Python, you can verify several input pairs quickly:

def original(x, y):
    return 7*y + 2*x + 3*x + 2*y

def simplified(x, y):
    return 5*x + 9*y

for x, y in [(0, 0), (2, -1), (-3, 4)]:
    print(x, y, original(x, y), simplified(x, y))

The final two numbers on each line should match. Notice that Python requires * for multiplication, while handwritten algebra usually writes 5x5x instead of 5x5*x. A later lesson will focus directly on translating algebraic notation into Python.

{
  "type": "exercise",
  "id": "c0314f57-4536-417b-8153-bb10b74d327d"
}

Key takeaways

Combining like terms is a way to make an expression shorter without changing its value.

  • A term includes its sign; for example, 4x-4x is one negative term.
  • A coefficient is the numerical multiplier, such as 4-4 in 4x-4x.
  • Like terms have exactly the same variable part, including exponents.
  • Combine like terms by adding their coefficients and keeping the shared variable part.
  • Constants can be combined with constants.
  • xx and x2x^2, or xx and yy, are not like terms.
  • x+x=2xx+x=2x, while xx=x2x\cdot x=x^2; addition and multiplication must not be confused.
  • Rewriting subtraction as addition of a negative term is a dependable way to preserve signs.

Next, you will use these simplification skills to solve one-variable linear equations. There, instead of merely rewriting an expression, you will find the value of a variable that makes an equation true.

Can't find a good explanation? Sign up and we'll make it for you