Question:
Evaluate the following integrals:
$\int x \tan ^{2} x d x$
Solution:
Let $I=\int x \tan ^{2} x d x$
$=\int x\left(\sec ^{2} x-1\right) d x$
$=\int x \sec ^{2} x d x-\int x d x$
Using integration by parts,
$=x \int \sec ^{2} x d x-\int \frac{d}{d x} x \int \sec ^{2} x d x-\frac{x^{2}}{2}$
We know that, $\int \sec ^{2} x d x=\tan x$
$=x \tan x-\int \tan x d x-\frac{x^{2}}{2}$
$=x \tan x-\log |\sec x|-\frac{x^{2}}{2}+c$