# How did they simplify this function

I'm currently practicing differentiation. The exercise I currently have is the following

Find the derivative of:

$(x + 6)^3 (9 x^3 - 2)^5$

Okay, well I can do that now. When I do this I uses the chain/product rule to get the following result:

$3(x+6)^2 (9x^3 -2)^5 + 45(x+6)^3 (3x^2) (9x^3 - 2)^4$

However, when I put this in wolfram alpha I get the following result (and it matches the answer from my exercise):

$6(x+6)^2 (2-9 x^3)^4 (27 x^3+135 x^2-1)$

I'm staring at this for an hour now, but I don't get how they get rid of the addition, and how they'd get rid of (for example) $(9x^3-2)^5$

-

$3(x+6)^2(9x^3-2)^5+45(x+6)^3(3x^2)(9x^3-2)^4$
$=3(x+6)^2(9x^3-2)^4(9x^3-2)+3(x+6)^2(9x^3-2)^4(45x^2)(x+6)$
$=3(x+6)^2(9x^3-2)^4((9x^3-2)+45x^2(x+6))$
$=3(x+6)^2(9x^3-2)^4(9x^3-2+45x^3+270x^2)$
$=3(x+6)^2(9x^3-2)^4(54x^3+270x^2-2)$
$=6(x+6)^2(9x^3-2)^4(27x^3+135x^2-1)$
@Timo It doesn't come out of thin air. It is the same process as factoring $3x^2 y^5+45x^3 y^4$. Look for factors that are the same in each thing added together and then pull them out front. If you are confused by the powers being different try writing them out like $(x+6)(x+6)...$. –  Brian Jan 24 '11 at 13:32