<s>[INST] Integrate $2\int x^2\, \sec^2x \,\tan x\, dx$ $$
2\int x^2\, \sec^2x \,\tan x\, \mathrm{d}x
$$
How to solve this using integration by parts? WolframAlpha can solve it, but is unable to give a step-by-step solution, and has a different answer to the one in the back of my textbook. There is also a question/answer on yahoo answers, but yet again, that gives a different answer to the one given to me.
 [/INST] Integrate by parts, differentiating $x^2$ and integrating $\sec ^{2}x\tan x$ by substitution$^1$:
$$\begin{eqnarray*}
I &=&\int x^{2}\sec ^{2}x\tan x\, dx=\frac{1}{2}x^{2}\sec ^{2}x-\int x\sec
^{2}x\,dx \\
&=&\frac{1}{2}x^{2}\sec ^{2}x-\left( x\tan x-\int \frac{\sin x
}{\cos x}\,dx\right)\qquad \text{by parts; note }^2  \\
&=&\frac{1}{2}x^{2}\sec ^{2}x-x\tan x-\ln |\cos
x|+C.
\end{eqnarray*}$$
So
$$
\begin{equation*}
2I=2\int  x^{2}\sec ^{2}x\tan x dx=x^{2}\sec ^{2}x-2x\tan
x-2\ln | \cos x|+C. 
\end{equation*}
$$
--
$^1$ Let $u=\sec x$. Then $du=\sec x\, \tan x$ and
$$\int \sec ^{2}x\tan xdx=\int u\,du=\frac{1}{2}u^{2}=\frac{1}{2}\sec ^{2}x.$$
$^2$ Differentiate $x$ and integrate $\sec^2 x$. Since $\dfrac{d}{dx}\tan x=1+\tan ^{2}x=\sec ^{2}x$, $\displaystyle\int \sec ^{2}xdx=\tan x
$.
</s>