For 1st.
you can solve it by general law or ,
since the coefficient of r^2 = 1
so u should think of 2 number which if u multiple them gives you 27 and sum of them is 12 and those numbers are 9 , 3
so the answer (x+9)*(x+3)
2nd problem :
g^2 - 9 = (g-3)*(g+3)
3rd problem:
2p^3 + 6p^2 + 3p +9
1st divide it into two parts
(2p^3 +6p^2)+ (3p+9)
from the 1st part
take 2p^2 as a common factor and from part 2 take 3 as a common factor and the equation be like
2p^2(p+3) + 3(p+3)
then take (p+3) as a common factor
so (p+3)* ( 2p^2 +3 )