Where is the form $f(g(x))g'(x)$? I was trying to do the exercises in Apostol's Calculus. I tried to answer an exercise to find the indefinite integral of $\int x\sqrt{1+3x} dx$ via substitution. I've been able to do it via integration by parts, but with substitution, I have no clue on how to do it. 
I've google for something and found this (here):



My problem is that according to the book, integration by substitution is based on the chain rule and hence:
$$\int f(g(x))g'(x)dx =F(g(x))+C\tag{1}$$
If I understood correctly, Apostol instructs to rewrite the function to be integrated on the form $f(g(x))g'(x)$ and then use $(1)$. My problem is that I don't see the form $f(g(x))g'(x)$ in the answer given by the link/image I provided, so I'm starting to think that the form $f(g(x))g'(x)$ may be something a little more complicated than I previously thought.
I have also tried to obtain a step-by-step solution with Mathematica/Wolfram Alpha. This elucidated a little more of what I was thinking:



Here, after making the appropriate substitutions, I also fail to see the form $f(g(x))g'(x)$ but there is an important point: It seems that the substitutions must be made in a way that if you substitute back, that is, if you put the $3x+1$ in the place of $u$ and $3$ in place of $du$, then after the expansion, it should become the expression you started with. This seems to be quite broader and vaguer than finding the form $f(g(x))g'(x)$, but it seems more honest (considering what I know at the moment). So, perhaps It's my stupidness, but where is the form $f(g(x))g'(x)$ in both these integration processes?
As an example of an integral where it's easy to see the form $f(g(x))g'(x)$, let's take:
$$\int x\sqrt{1+3x^2}dx$$
Then we can write:
$$\int \overbrace{6x}^{g'(x)}\overbrace{\sqrt{\overbrace{1+3x^2}^{g(x)}}}^{f(x)} dx$$
And from here, it would be easy to proceed. But in the two solutions I provided, I'm unable to see this form.
 A: You use $x=g(t)=\frac13(t^2-1)$ with $g'(t)=\frac23 t$.
The point is that $f(x)=x\sqrt{3x+1}$ does not have a readily visible anti-derivative. Thus one has to look at the whole expression $f(g(t))g'(t)$ as a whole to find a different path towards the anti-derivative. Which in a round-about way leads back to the anti-derivative of $f$.
A: One thing about integration, which is either fun or incredibly frustrating
(depending on how you look at it),
is that there are a lot of techniques to do it,
but a lack of clear guidance on when (and sometimes how)
to apply each technique.
This is one reason why there were entire books published consisting
mainly of page after page of solved integrals,
possibly preceded by a few pages of derivatives.
Sometimes you get a problem like $\int x\sqrt{1+3x^2}dx$
where there is a relatively obvious $g'(x)$ factor in the integrand.
Another example would be an integrand that contains some expression
containing only $\cos x$ and constants, multiplied by $\sin x$.
In other cases, $g'(x)$ shows up in a much more subtle way.
If you set $g(x) = 3x + 1$, you get $g'(x) = 3$, which is fine
because it's a constant and you can always compensate for a constant
factor $r$ by multiplying the integral by $1/r$.
If you set $g(x) = \sqrt{3x + 1}$, it's a little more complicated.
The answer you read 
here
cleverly dodged the more painful steps of finding $g'(x)$ the obvious way
(via the chain rule)
by instead differentiating $(g(x))^2 = 3x + 1$,
which is a clever trick that may be worth remembering.
One thing not to worry about too much is how to "see" $f(g(x))$.
This will usually work itself out when you do the substitution.
In the case of substituting $g(x) = \sqrt{3x + 1}$
in $\int x\sqrt{1+3x^2}dx$,
we have $g'(x) = \tfrac32 (3x + 1)^{-1/2}$;
we must also have
$$ f(g(x))g'(x) = x\sqrt{3x + 1}$$
and therefore (since $x = ((g(x))^2 - 1)$)
$$ f(g(x)) = \frac{x\sqrt{3x + 1}}{g'(x)}
 = \frac{x\sqrt{3x + 1}}{\tfrac32 (3x + 1)^{-1/2}}
 = \tfrac23 x (1 + 3x) = \tfrac23((g(x))^2 - 1) (g(x))^2.$$
Fortunately, you never have to work out this mess in order to do
integration by substitution; it all happens implicitly when you
make the correct substitutions.
In other words, the formula
$ \int f(g(x))g'(x)dx =F(g(x))+C $
explains why substitution works, but it doesn't say much about
how to go about finding a good substitution.
