f(x) = x2+2x
g(x) = 3x + 1
g(x) = 3x + 1
For f(g(x)), simply replace to x in f(x) with g(x), as follows:
f(x) = x2+2x
f(g(x)) = g(x)2 + 2g(x)
Now replace the g(x) with 3x+1:
f(g(x)) = (3x+1)2 + 2(3x+1)
f(g(x)) = 9x2 + 6x + 1 + 6x + 2
f(g(x)) = 9x2 + 12x + 3