Like terms

In mathematics, like terms are summands in a sum that differ only by a numerical factor. Like terms can be regrouped by adding their coefficients. Typically, in a polynomial expression, like terms are those that contain the same variables to the same powers, possibly with different coefficients.

More generally, when some variable are considered as parameters, like terms are defined similarly, but "numerical factors" must be replaced by "factors depending only on the parameters".

For example, when considering a quadratic equation, one considers often the expression
 * $$(x-r)(x-s),$$

where $$r$$ and $$s$$ are the roots of the equation and may be considered as parameters. Then, expanding the above product and regrouping the like terms gives
 * $$x^2-(r+s)x+rs.$$

Generalization
In this discussion, a "term" will refer to a string of numbers being multiplied or divided (that division is simply multiplication by a reciprocal) together. Terms are within the same expression and are combined by either addition or subtraction. For example, take the expression:

$$ax+bx$$

There are two terms in this expression. Notice that the two terms have a common factor, that is, both terms have an $$x$$. This means that the common factor variable can be factored out, resulting in

$$(a+b)x$$

If the expression in parentheses may be calculated, that is, if the variables in the expression in the parentheses are known numbers, then it is simpler to write the calculation $$a+b$$. and juxtapose that new number with the remaining unknown number. Terms combined in an expression with a common, unknown factor (or multiple unknown factors) are called like terms.

Example
To provide an example for above, let $$a$$ and $$b$$ have numerical values, so that their sum may be calculated. For ease of calculation, let $$a=5$$ and $$b=3$$. The original expression becomes

$$5x+3x$$

which may be factored into

$$(5+3)x$$

or, equally,

$$8x$$.

This demonstrates that

$$5x+3x=8x$$

The known values assigned to the unlike part of two or more terms are called coefficients. As this example shows, when like terms exist in an expression, they may be combined by adding or subtracting (whatever the expression indicates) the coefficients, and maintaining the common factor of both terms. Such combination is called combining like terms, and it is an important tool used for solving equations.

Simplifying an expression
Take the expression, which is to be simplified:

$$3(4x^2y-6y)+7x^2y-3y^2+2(8y-4y^2-4x^2y)$$

The first step to grouping like terms in this expression is to get rid of the parentheses. Do this by distributing (multiplying) each number in front of a set of parentheses to each term in that set of parentheses:

$$12x^2y-18y+7x^2y-3y^2+16y-8y^2-8x^2y$$

The like terms in this expression are the terms that can be grouped together by having exactly the same set of unknown factors. Here, the sets of unknown factors are $$x^2y,$$ $$y^2,$$ and $$y.$$. By the rule in the first example, all terms with the same set of unknown factors, that is, all like terms, may be combined by adding or subtracting their coefficients, while maintaining the unknown factors. Thus, the expression becomes

$$11x^2y-2y-11y^2$$

The expression is considered simplified when all like terms have been combined, and all terms present are unlike. In this case, all terms now have different unknown factors, and are thus unlike, and so the expression is completely simplified.