Factoring by grouping works when separate groups each contain the same remaining expression. First factor that common expression out, then continue factoring it.
Problem
Factor x3+3x2y+x2+2xy2+3xy+2y2.
Answer
(x+1)(x+y)(x+2y).
The middle quadratic is x²+3xy+2y².
Step-by-step solution
1. Rearrange into two matching groups
Write the polynomial as
(x3+3x2y+2xy2)+(x2+3xy+2y2).
The first group is x(x2+3xy+2y2) and the second is 1(x2+3xy+2y2).
2. Take out the common quadratic
The expression becomes (x+1)(x2+3xy+2y2).
3. Factor the quadratic
The two terms y and 2y add to 3y and multiply to 2y2. Therefore x2+3xy+2y2=(x+y)(x+2y), giving the result (x+1)(x+y)(x+2y).