Evaluating trig integral $\int \tan^3x \sec^2x dx$ I am trying to evaluate this integral, and I was coming up short so I am looking at the solution from a website here.
I get lost on the u-substitution part. Where does $ \sec^2(\tan^{-1}(u)) $ come from in the denominator? Since we are using $u = \tan x, du = \sec^2x$, why isn't the denominator just $\sec^2x$?

 A: $$\int \tan^3x\sec^2x\ dx$$
Take $u=\tan x$, then $du=\sec^2x\ dx$ and we get 
$$\int u^3\ du=\dfrac{u^4}{4}+C$$ Now substitute back $u=\tan x$ and we finally get $$\dfrac14\tan^4x+C$$
A: Kevy Flex already provided a correct solution. However, I think it is interesting to see what goes on in the steps that you provided us. So, first of all we have
$$ \frac{\mathrm{d} u}{\mathrm{d} x} = \sec^2(x). $$
Thus,
$$ \mathrm{d} x =\frac{\mathrm{d} u}{\sec^2(x)}. $$
The integral, thus would be
$$ \int u^3(1+u^2)\cdot \frac{\mathrm{d} u}{\sec^2(x(u))} $$
and $x(u)=\arctan(u)$. So, what you had was correct (although maybe not the most clever).
Then, you might ask, but the solution by Kevy Flex was so simple and this looks unnecessarily complicated. Well, you can actually work out that
$$ \sec(\arctan(x)) = \sqrt{x^2+1} $$
and thus, this sort of cancels out and you end up with $u^3$ in your integral.
Now, why is the above formula correct? To that end, look at the triangle $ABC$ with $\angle ABC = 90^{\mathrm{o}}$, then $BC/AB=\tan(\angle CAB)$. So, $\arctan(BC/AB) = \angle CAB$ and it follows that
$$\cos(\arctan(BC/AB)) = \cos(\angle CAB) = AB/AC.$$
If we let $x$ equal $BC/AB$ and we write $AC=\sqrt{AB^2+BC^2}$, then we find that
$$\cos(\arctan(x)) = \cos(\angle CAB) = \frac{AB}{\sqrt{AB^2+BC^2}} = \frac{1}{\sqrt{1 + BC^2/AB^2}} = \frac{1}{\sqrt{x^2+1}}.$$
We conclude
$$ \sec(\arctan(x)) = \sqrt{x^2+1}.$$
I hope this is helpful!
A: For future reference, whenever considering integrals of the form 
\begin{equation}
 I = \int \frac{f(\cos(x), \sin(x))}{g(\cos(x), \sin(x))}\:dx
\end{equation}
If $f(\cdot, \cdot), g(\cdot, \cdot)$ are polynomials, then the Weierstrass substitution $u = \tan\left(x/2\right)$ will convert the integrand into a function of polynomials of the following form:
\begin{equation}
 I = \int \frac{f\left(\frac{1 - t^2}{1 + t^2} , \frac{2t}{1 + t^2}\right)}{g\left(\frac{1 - t^2}{1 + t^2}, \frac{2t}{1 + t^2} \right)} \frac{2}{1 + t^2}\:dt\nonumber
\end{equation}
Which very often is much easier to evaluate. This of course applies when simpler substitutions are unknown and/or do not exist. 
