<s>[INST] Integral of $2x^2 \sec^2{x} \tan{x}$ I've been trying for a while to find $\int{( 2x^2 \sec^2{x} \tan{x} )} dx$, using integration by parts.
I always end up getting a more complicated integral in the second part of the equation.
For example:
$$ \int{( 2x^2 \sec^2{x} \tan{x} )} dx =
\\ 2x^2 \tan^2x - \int{\tan{x} \cdot \frac{d}{dx}(2x^2 \tan{x})}
\\ \frac{d}{dx}(2x^2 \tan{x})=4x\tan{x} + 2x\sec^2{x} \rightarrow
\\ 2x^2 \tan^2x - \int{4x \tan^2{x}+2x\tan{x}\sec^2{x}}
$$
I've tried integrating with different value for $u$ and $v$, such as:
$$ 1:( 2x^2 \sec^2{x} \tan{x} ),
\\ \tan{x} : 2x^2 \sec^2{x},
\\ 2x^2: \sec^2{x} \tan{x},
\\ \sin{x}: 2x^2 \sec^3{x} $$ etc, however, haven't succeeded.
 [/INST] Use integration by parts with $u=x^2$ and $v=\tan^2(x)$.  Then, we have
$$\int 2x^2 \tan(x)\sec^2(x)\,dx=x^2\tan^2(x)-2\int x\tan^2(x)\,dx$$
Continue with a subsequent integration by parts with $u=x$ and $v=\tan(x)-x$  to obtain
$$\begin{align}
\int 2x^2 \tan(x)\sec^2(x)\,dx&=x^2\tan^2(x)-2\left(x\tan(x)-x^2-\int(\tan(x)-x)\,dx\right)\\\\
&=x^2\tan^2(x)-2x\tan(x)+x^2-2\log(\cos(x))+C\\\\
&=x^2\sec^2(x)-2(x\tan(x)+\log(\cos(x)))+C
\end{align}$$
</s>