Show $$\lim_{N\to\infty}g_N(\theta_N)=2\int^\pi_0\frac{\sin x}{x}dx-\pi,$$ where $$g_N(\theta_N)=\int_0^{\theta_N}\frac{\sin[(N+1/2)x]}{\sin(x/2)}dx-\pi,$$ $$\theta_N=\frac{\pi}{N+1/2},$$ and $$g_N(x)=2\sum_{n=1}^\infty\frac{\sin nx}{n}-(\pi-x).$$
So far I have: $$\lim_{N\to\infty}g_N(\theta_N)=\lim_{N\to\infty}\int_0^{\theta_N}\frac{\sin[(N+1/2)x]}{2\sin(x/2)}dx-\pi$$ Let $u=(N+1/2)x$, and $du=N+1/2$. $$\lim_{N\to\infty}\int^\pi_0\frac{\sin(u)\cdot(N+1/2)}{2\sin(\frac{u}{N+1/2})}du$$ But the integral is no simpler than when I started. How would I go about showing this?
(This question is part of a series of questions demonstrating Gibbs phenomenon)
Let $g_N(\theta_N)$ be given by
$$g_N(\theta_N)=\int_0^{\theta_N}\frac{\sin\left((N+1/2)x\right)}{\sin(x/2)}\,dx-\pi$$
where $\theta_N=\pi/(N+1/2)$. Now, enforcing the substitution $x\to x/(N+1/2)$ yields
$$\begin{align} g_N(\theta_N)&=\int_0^{\pi}\frac{\sin(x)}{\sin\left(\frac{x}{2N+1}\right)}\frac{1}{N+1/2}\,dx-\pi\\\\ &=2\int_0^\pi\frac{\sin(x)}{(2N+1)\sin\left(\frac{x}{2N+1}\right)}\,dx-\pi \end{align}$$
Note that for $N\ge1$, we have
$$\frac{\sin(x)}{(2N+1)\sin\left(\frac{x}{2N+1}\right)}\le \frac{\sin(x)}{x\cos\left(\frac{x}{2N+1}\right)}<\frac{2\sin(x)}{x}$$
Since $\int_0^\pi \frac{\sin(x)}{x}\,dx<\infty$ is integrable, the Dominated Convergence Theorem guarantees that
$$\begin{align} \lim_{N\to \infty}g_N(\theta_N)&=2\int_0^\pi \lim_{N\to \infty}\left(\frac{\sin(x)}{(2N+1)\sin\left(\frac{x}{2N+1}\right)}\right)\,dx-\pi\\\\ &=2\int_0^\infty \frac{\sin(x)}{x}\,dx-\pi \end{align}$$
as was to be shown!