We can remove parenthesis if we change the sign of all terms in the second parenthesis (because we're subtracting it).
So, we have
[tex] (2g^2+3g-8)-(5g+1) = 2g^2+3g-8-5g-1 [/tex]
And now we simply have to aggregate like terms:
[tex] 2g^2-2g-9 [/tex]