Rewrite as .

Rewrite as .

Since both terms are perfect cubes, factor using the sum of cubes formula, where and .

Apply the product rule to .

Raise to the power of .

Multiply the exponents in .

Apply the power rule and multiply exponents, .

Multiply by .

Multiply by .

Rewrite using the commutative property of multiplication.

Multiply by .

Apply the product rule to .

Raise to the power of .

Multiply the exponents in .

Apply the power rule and multiply exponents, .

Multiply by .

Factor 27a^6+8g^12