Find this Limit (Fourier series) Find the following limit:
$$\large\lim_{n\to\infty} \int_{-\pi}^\pi \biggl(x + \frac{\pi}{2}\biggr)^2 \frac{\sin\bigl(\bigl(n+\frac{1}{2}\bigr)x\bigr) + x \cos nx}{\sin \frac{x}{2}}\,dx.$$
We tried to use what we know about the Dirichlet kernel and the real version of the Riemann-Lebesgue lemma but we're stuck.
Thanks
 A: The version of the Riemann-Lebesgue lemma we need here says that for an integrable function $f\colon [a,b] \to \mathbb{R}$, we have
$$\lim_{c\to \infty} \int_a^b f(x)\operatorname{trig}(cx)\,dx = 0,$$
where $\operatorname{trig}$ can be either of $\sin$ or $\cos$. It can be proved in many ways; we can extend the function trivially (setting $f(x) = 0$ for $x\notin [a,b]$) to $\mathbb{R}$ and appeal to the $L^1(\mathbb{R})$ version, or we can first show it for continuously differentiable $f$ by integration by parts, and then use that every integrable function can be approximated (in the integral sense) by continuously differentiable functions to obtain the result for all integrable functions on $[a,b]$.
Hence by the Riemann-Lebesgue lemma we have
$$\lim_{n\to\infty} \int_{-\pi}^\pi \biggl(x+\frac{\pi}{2}\biggr)^2 \frac{x}{\sin \frac{x}{2}}\cos nx\,dx = 0,$$
since $\bigl(x+\frac{\pi}{2}\bigr)^2\cdot\frac{x}{\sin (x/2)}$ is integrable on $[-\pi,\pi]$ - it is even continuously differentiable.
That leaves us to consider the part
$$\int_{-\pi}^\pi \biggl(x+\frac{\pi}{2}\biggr)^2\cdot \frac{\sin \bigl(\bigl(n+\frac{1}{2}\bigr)x\bigr)}{\sin \frac{x}{2}}\,dx.\tag{1}$$
The second factor in that is the Dirichlet kernel $D_n$. Now let us define
$$f(x) = \biggl(\frac{\pi}{2} - x\biggr)^2$$
for $x \in [-\pi,\pi)$, and extend that $2\pi$-periodically to $\mathbb{R}$. Then $f$ is a piecewise continuous and piecewise continuously differentiable function which is continuously differentiable on $\mathbb{R}\setminus (\pi + 2\pi\mathbb{Z})$. It has jump discontinuities at odd integer multiples of $\pi$. The general Fourier theory tells us that hence
$$f(t) = \lim_{n\to\infty} \frac{1}{2\pi} \int_{-\pi}^\pi f(t-x)D_n(x)\,dx\tag{2}$$
for all $t\in \mathbb{R}\setminus (\pi + 2\pi\mathbb{Z})$. But the integral in $(1)$ is just
$$\int_{-\pi}^\pi f(0-x)D_n(x)\,dx,$$
so by $(2)$ we have
$$\lim_{n\to\infty} \int_{-\pi}^\pi \biggl(x+\frac{\pi}{2}\biggr)^2\cdot \frac{\sin \bigl(\bigl(n+\frac{1}{2}\bigr)x\bigr)}{\sin \frac{x}{2}}\,dx = 2\pi\cdot f(0) = 2\pi\biggl(\frac{\pi}{2}-0\biggr)^2 = \frac{\pi^3}{2}.$$
