Consider the polynomial
\(x^3+5x^2-2x-10\text{.}\) First, group the terms into the first 2 and last 2. Notice that first two terms
\(x^3 + 5x^2\) have a common factor
\(x^2\text{,}\) and the last two terms
\(-2x - 10\) have a common factor
\(-2\text{.}\) Factoring out these common factors from both pairs,
\begin{gather*}
x^3 + 5x^2 - 2x - 10\\
= x^2(x + 5) - 2(x + 5)
\end{gather*}
Then, both terms have a common factor of
\(x+5\text{,}\)
\begin{gather*}
= x^2\underbrace{(x + 5)} - 2\underbrace{(x + 5)}
\end{gather*}
Then, we can factor it out, leaving
\(x^2\) and
\(-2\) left,
\begin{gather*}
= (x+5)(x^2-2)
\end{gather*}
This might seem a bit strange. However, factoring out
\((x+5)\) works exactly the same as factoring out a single variable like
\(y\text{.}\)
| \(x^2 y - 2y\) |
\(x^2(x+5) - 2(x+5)\) |
| \(= y(x^2 - 2)\) |
\(= (x+5)(x^2 - 2)\) |
What is common to both terms gets pulled out, and whatever is left behind stays inside the other bracket. If it helps, you can mentally substitute
\(y = x + 5\) and it becomes the same problem.