Proof of $\lim_{n \to\infty}\int_0^{\pi/2} \sin nx ( \frac{1}{x} - \frac{\cos x}{\sin x} ) dx =0$ 
(i) Let $I_p=\displaystyle\int_0^{\pi/2} \dfrac{\sin px}{\sin x} dx$, $J_p=\displaystyle\int_0^{\pi/2} \dfrac{\sin qx}{\sin x} \cos x dx$. By considering $\sin (2n+1)x$ and $\sin (2n-1)x$, show that $\dfrac{\pi}{2} = I_1 = J_2 = I_3 = J_4 = \cdots$ (This question is successfully attempted)


(ii) Show (using integration by parts) that for each positive integer $n$, $\displaystyle\lim_{n \rightarrow \infty} \displaystyle\int_0^{\pi/2} \sin nx \left( \dfrac{1}{x} - \dfrac{\cos x}{\sin x} \right) dx =0$ (This is the question that I am struggling with)

Source: Limit - A New Approach to Real Analysis - Alan F. Beardon Ch 11.5
My original thought is that split the integral into $\int_0^{\pi/2} \dfrac{\sin nx}{x} dx- \int_0^{\pi/2}\dfrac{\sin nx \cos x}{\sin x}dx$ and transform $\int_0^{\pi/2}\dfrac{\sin nx \cos x}{\sin x}dx$ into $\int_0^{\pi/2} \dfrac{\sin nx}{x} dx$, with some terms of $n$ that can be vanished via $n\rightarrow \infty$, but I failed. Any hint? Thanks.

Edit 1:
$\begin{split} \lim \displaystyle\int_0^{\pi/2} g(x) \sin nx dx& =- \displaystyle\lim \dfrac{1}{n} \displaystyle\int_0^{\pi/2} g(x) d \cos nx \\ & = - \lim \left[ \left[ \dfrac{1}{n} g(x) \cos nx \right]_0^{\pi/2} - \dfrac{1}{n} \int_0^{\pi/2} \cos nx g'(x) dx \right] \end{split}$
$\because$ $g'(x)$ is bounded in $[0, \dfrac{\pi}{2}]$, $\therefore \int_0^{\pi/2} \cos nx g'(x) dx \not\rightarrow \infty$
$\therefore \lim \displaystyle\int_0^{\pi/2} \sin nx g(x) dx = 0 - 0 =0 $
 A: There is no problem splitting up the integral as each converge separately.
$$\int_0^{\pi/2}\frac{\sin(nt)}{t}\mathrm dt-\int_0^{\pi/2}\frac{\sin(n\theta)}{\sin(\theta)}\cos(\theta)\mathrm d\theta$$
The first integral can be stated in terms of the Sine Integral.
$$\int_0^{\pi/2}\frac{\sin(nt)}{t}\mathrm dt=\operatorname{Si}(\pi n/2) \\ \to \frac{\pi}{2}~\text{as}~n\to\infty$$
As for the second, we can use the defining property of the Chebyshev polynomial of the second kind:
$$U_{n-1}\big(\cos(\theta)\big)=\frac{\sin(n\theta)}{\sin\theta}$$
Using the variable transformation $x=\cos \theta$ the second integral becomes
$$\int_0^{\pi/2}\frac{\sin(n\theta)}{\sin(\theta)}\cos(\theta)\mathrm d\theta=\int_0^1U_{n-1}(x)\frac{x}{\sqrt{1-x^2}}\mathrm dx$$
Numerical experimentation seems to suggest the second integral approaches $\pi/2$ as $n\to\infty$ as well, but I haven't (yet) proved this.
So altogether your integral should approach zero.
A: We have
$$\displaylines{f(x):={1\over x}-{\cos x\over \sin x}={1\over x}-{1\over \sin x}+{1\over \sin x}-{\cos x \over \sin x}\\ =
{\sin x-x \over x^2}{x\over \sin x}+{\sin x\over 1+\cos x}}$$
Therefore $f(x)$ can be extended on $[0,\pi/2]$ to a continuous function, by taking $f(0)=0.$ Then the Riemann-Lebesgue lemma can be applied as suggested by @Gary .
A: You can prove that $g(x)=\left(\frac{1}{x}- \frac{\cos x}{\sin x}\right)$ can be extended by continuity to a continuously differentiable map on $[0,\frac{\pi}{2}]$. A way to do this is to consider Taylor expansion of $g$ around $0$.
Then you can apply the integration by parts hint you’re given by integrating $x \mapsto \sin nx$, differentiating $g$ and using the fact that $g^\prime$ is bounded on the interval of integration.
