# Show $\lim_{N\to\infty}\int_0^\pi\left(\frac1{\sin\frac{x}2}-\frac2x\right)\sin\left((N+\frac12)x\right)dx=0$

Prove that the function $\csc(x/2)-2/x$ is integrable on $(0,\pi)$. In fact, prove that it is bounded. In fact, prove that it tends to zero as $x\to0$. Use this to show that $$\lim_{N\to\infty}\int_0^\pi\left(\frac1{\sin\frac{x}2}-\frac2x\right)\sin\left((N+\frac12)x\right)dx=0$$ Then prove that $$\lim_{N\to\infty}\int_0^\pi\frac{\sin(N+\frac12)x}xdx=\pi/2$$ Finally, prove that $$\int_0^\infty\frac{\sin x}xdx=\pi/2$$

One observation is $\sum_{n=-N}^Ne^{inx}=\frac{\sin(N+\frac12)x}{\sin\frac{x}2}$, and the integral of this from $0$ to $2\pi$ is $2\pi$, since the integral $\int_{0}^{2\pi}e^{inx}dx=0$ if $n\neq0$.

First note that as $x \to 0^{+}$ the function $$f(x) = \dfrac{1}{\sin\left(\dfrac{x}{2}\right)} - \frac{2}{x}$$ tends to a definite limit $0$ and hence can be assumed continuous in $[0, \pi]$. Therefore $f(x)$ is Riemann-integrable on interval $[0, \pi]$. It now follows by Riemann-Lebesgue Lemma (related to coefficients of Fourier series of $f(x)$, a proof is available in Tom M. Apostol's "Mathematical Analysis", 2nd Ed., Page 313) that $$\lim_{N \to \infty}\int_{0}^{\pi}f(x)\sin(Nx + b)\,dx = 0$$ This settles the hard part of the question. The limit of $f(x)$ as $x \to 0^{+}$ is calculated as follows:
\displaystyle \begin{aligned}\lim_{x \to 0^{+}}f(x) &= \lim_{x \to 0^{+}}\dfrac{1}{\sin\left(\dfrac{x}{2}\right)} - \frac{2}{x}\\ &= \lim_{x \to 0^{+}}\dfrac{x - 2\sin(x/2)}{x\sin(x/2)}\\ &= \lim_{x \to 0^{+}}\dfrac{x - 2\sin(x/2)}{x\dfrac{\sin(x/2)}{x/2}\cdot(x/2)}\\ &= 2\lim_{x \to 0^{+}}\dfrac{x - 2\sin(x/2)}{x^{2}}\\ &= 2\lim_{x \to 0^{+}}\dfrac{1 - \cos(x/2)}{2x}\text{ (by L'Hospital's Rule)}\\ &= \lim_{x \to 0^{+}}\dfrac{2\sin^{2}(x/4)}{x}\\ &= 2\lim_{x \to 0^{+}}\dfrac{\sin^{2}(x/4)}{(x/4)^{2}}\cdot\frac{(x/4)^{2}}{x} = 0\end{aligned}
The observation which you have made about representing $\sin(N + 1/2)x$ as a sum can help you out in showing that $$\int_{0}^{\pi}\dfrac{\sin\left(N + \dfrac{1}{2}\right)x}{\sin(x/2)} = \pi$$ Using this result together with the earlier established limit $$\lim_{N \to \infty}\int_{0}^{\pi}\left(\dfrac{1}{\sin(x/2)} - \frac{2}{x}\right)\sin\left(N + \frac{1}{2}\right)x\,dx = 0$$ gives us $$\lim_{N \to \infty}\int_{0}^{\pi}\dfrac{\sin\left(N + \dfrac{1}{2}\right)x}{x}\,dx = \frac{\pi}{2}$$The last part of the question can be easily deduced by putting $(N + 1/2)x = t$ in the above integral.