Step-by-step explanation:
We need to use the binomial theorem/Pascal's triangle here.
(a+b)^5 = (5 choose 0)a^5 + (5 choose 1)a^4*b + (5 choose 2)a^3*b^2 + (5 choose 3)a^2*b^3 + (5 choose 4)a*b^4 + (5 choose 5)b^5.
5 choose 0 = 1
5 choose 1 = 5
5 choose 2 = 10
5 choose 3 = 10
5 choose 4 = 5
5 choose 5 = 1
And 1, 5, 10, 10, 5, 1, is the (5+1) = 6th row of pascal's triangle.
Therefore we get
g^5 + 5g^4*2 + 10g^3*2^2 + 10g^2*2^3 + 5g*2^4 + 2^5
which is
g^4 + 10g^4 + 40g^3 + 80g^2 + 80g + 32
Or, you could do the slow way, by just doing (g+2)(g+2)(g+2)(g+2)(g+2)