(a) Find $\int x \tan ^{-1} x d x$
[3]
(b) (i) Using the substitution $u=\frac{1}{x}$, or otherwise, find $\int \frac{\sin \left(\frac{1}{x}\right)}{x^2} \mathrm{~d} x$.
[2]
(ii) Given that $n$ is a positive integer, evaluate the integral $\pi \int_{\frac{1}{(n+1) \pi}}^{\frac{1}{n \pi}} \frac{\sin \left(\frac{1}{x}\right)}{x^2} \mathrm{~d} x$, giving your answer in the form $a \pi$, where the possible values of $a$ are to be determined.
[3]
(a)$\int x \tan ^{-1} x \mathrm{~d} x=\frac{x^2+1}{2} \tan ^{-1} x-\frac{x}{2}+c$
(b)(i) $\int \frac{\sin \left(\frac{1}{x}\right)}{x^2} d x=$$\cos \left(\frac{1}{x}\right)+c$
(b)(ii)$a=2(-1)^n$
(a)$ \quad \int x \tan ^{-1} x \mathrm{~d} x =\left(\frac{x^{2}}{2} \tan ^{-1} x\right)-\int $$\frac{x^{2}}{2}\left(\frac{1}{1+x^{2}}\right) \mathrm{d} x $
$=\frac{x^{2}}{2} \tan ^{-1} x-\frac{1}{2} \int 1-\frac{1}{1+x^{2}} \mathrm{~d} x $
$=\frac{x^{2}}{2} \tan ^{-1} x-\frac{1}{2}\left[x-\tan ^{-1} x\right]+c $
$=\frac{x^{2}+1}{2} \tan ^{-1} x-\frac{x}{2}+c$
(b)(i)
Given the substitution $u=\frac{1}{x}$, we have $\frac{\mathrm{d} u}{\mathrm{~d} x}=-\frac{1}{x^2}$
$\int \frac{\sin \left(\frac{1}{x}\right)}{x^2} \mathrm{~d} x =-\int \sin \left(\frac{1}{x}\right)\left(-\frac{1}{x^2}\right) \mathrm{d} x $
$=-\int \sin u \mathrm{~d} u $
$=\cos u+c $
$=\cos \left(\frac{1}{x}\right)+c$
OR
$\int \frac{\sin \left(\frac{1}{x}\right)}{x^2} \mathrm{~d} x =-\int\left(-\frac{1}{x^2}\right) \sin \left(\frac{1}{x}\right) \mathrm{d} x $
$=\cos \left(\frac{1}{x}\right)+c$
(b)(ii)
$ \pi \int_{\frac{1}{(n+1) \pi}}^{\frac{1}{n \pi}} \frac{\sin \left(\frac{1}{x}\right)}{x^2} \mathrm{~d} x$
$=\pi\left[\cos \left(\frac{1}{x}\right)\right]_{\frac{1}{(n+1) \pi}}^{\frac{1}{n \pi}} $
$=\pi[\cos (n \pi)-\cos ((n+1) \pi)] $
If $n$ is even, $\pi \int_{\frac{1}{(n+1) \pi}}^{\frac{1}{n \pi}} \frac{\sin \left(\frac{1}{x}\right)}{x^2} \mathrm{~d} x=\pi[1-(-1)]=2 \pi \quad a=2$
If $n$ is odd, $\pi \int_{\frac{1}{(n+1) \pi}}^{\frac{1}{n \pi}} \frac{\sin \left(\frac{1}{x}\right)}{x^2} \mathrm{~d} x=\pi[-1-1]=-2 \pi \quad a=-2$
OR $a=2(-1)^n$