With functions of functions you work from the inside out, so you substitute the function f(x) for the x in g(x). We know that f(x)=x2+1 and g(x)=2x+4. In this question you therefore replace the x in 2x+4 with x2+1. This leads to g(f(x))=2(f(x))+4, or g(f(x))=2(x2+1)+4. The next step is to expand the brackets, giving 2x2+2+4, and then to collect like terms to give g(f(x))=2x2+6.