I'm confused as to what you are trying to do. Are you trying to simply find the composition or the derivative of the composition? Your post seems inconsistent on this.. can you state the whole question?

Perhaps the problem wants you to find f(g(x)) first, then the derivative of this composition, and see that the answer is the same if you use the chain rule?