I have done this with a binomial expansion which you may not have done yet.
I have taken more steps than necessary to make it easier to follow.
A pop up has shown me that AziaHusain has done it by a normal expansion.
Hopefully our answers are the same.
$$(a^2+3b)^3\\\\
=^3C_0(a^2)^3(3b)^0+^3C_1(a^2)^2(3b)^1+^3C_2(a^2)^1(3b)^2+^3C_3(a^2)^0(3b)^3\\\\
=(a^2)^3+3(a^2)^2(3b)^1+3(a^2)^1(3b)^2+(3b)^3\\\\
=a^6+3a^4*3b+3a^2(3b)^2+(3b)^3\\\\
=a^6+9a^4b+3a^2(9b^2)+27b^3\\\\
=a^6+9a^4b+27a^2b^2+27b^3\\\\$$
(a^2 + 3b)(a^2 + 3b)(a^2 + 3b)...let's FOIL (first, outside, inside, and last) (a^2 + 3b)(a^2 + 3b) first and leave the last (a^2 + 3b) for later.
To perform FOIL, you take the first values (a^2 & a^2) and multiply them to get a^4.
Next, take the outside values (a^2 & 3b) and multiply them to get 3ba^2.
Inside - (3b and a^2) and multiply them to get (3ba^2).
Last - (3b & 3b) and multiply them to get 9b^2.
Therefore, we have a^4 + 3ba^2 + 3ba^2 + 9b^2. We can collect like terms to get 2(3ba^2) = 6ba^2.
So, we have (a^4 + 6ba^2 + 9b^2)(a^2 + 3b) left to do. Basically, just distribute each term like this:
a^2(a^4 + 6ba^2 + 9b^2) + 3b(a^4 + 6ba^2 + 9b^2) = a^6 + 6ba^4 + 9b^2a^2 + 3ba^4 + 18b^2a^2 + 27b^3. Collect like terms to obtain: a^6 + 9ba^4 + 27b^2a^2 + 27b^3.
ANOTHER way of doing this problem is by binomial expansion!
We can do binomial expansion because we have (a^2 + 3b)^3 with two terms, a^2 and 3b.
Let's set c = a^2 and d = 3b.
Since we have ^3, we need to take a value of k = 0, 1, 2, 3 and use the following: c^(n-k)d^k where n = 3 (the exponent).
For a value of k = 0, we have c^(3-0)d^0 = c^3 = a^2(^3) = a^2*a^2*a^2 = a^6 for our first term.
For k = 1, we have c^(3-1)d^1 = c^2d^1 = c^2d = a^2(^2)*(3b) = 3ba^4 for our second term...we must multiply it by 3 to obtain 9ba^4.
For k = 2, we have c^(3-2)d^2 = c^1d^2 = cd^2 = a^2*(3b)^2 = 9b^2a^2 for our third term...we must multiply it by 3 to obtain 27b^2a^2.
For our final term, k = 3, we have c^(3-3)d^3 = c^0d^3 = d^3 = (3b)^3 = 3b*3b*3b = 27b^3 for our fourth and final term.
We add all the terms!
Putting it all together, we have a^6 + 9ba^4 + 27b^2a^2 + 27b^3 as our final answer which matches our FOIL method answer!
*Note: This binomial method involves the "pascal triangle."*
The reason we multiply the middle 2 terms by 3 is because of pascal's triangle which creates a pattern.
For (c + d)^2: we would have c^2 + 2cd + d^2. Note that the multiplier is 2 for the middle term.
For (c + d)^3: we would have (c^2 + 2cd + d^2)(c + d). Multiplying it out, we get c^3 + 2c^2d + cd^2 + c^2d + 2cd^2 + d^3 which can be further modified to obtain c^3 + 3cd^2 + 3c^2d + d^3. Notice that the middle two terms are multiplied by 3 just like for this example!
I have done this with a binomial expansion which you may not have done yet.
I have taken more steps than necessary to make it easier to follow.
A pop up has shown me that AziaHusain has done it by a normal expansion.
Hopefully our answers are the same.
$$(a^2+3b)^3\\\\
=^3C_0(a^2)^3(3b)^0+^3C_1(a^2)^2(3b)^1+^3C_2(a^2)^1(3b)^2+^3C_3(a^2)^0(3b)^3\\\\
=(a^2)^3+3(a^2)^2(3b)^1+3(a^2)^1(3b)^2+(3b)^3\\\\
=a^6+3a^4*3b+3a^2(3b)^2+(3b)^3\\\\
=a^6+9a^4b+3a^2(9b^2)+27b^3\\\\
=a^6+9a^4b+27a^2b^2+27b^3\\\\$$