Calculate the limit $$\lim_{n \to +\infty } \int_{0}^{\pi}\frac{x\cos x}{1+\sin^2(nx)}\,\mathrm dx$$
The idea was to get rid of the linear function in the numerator. I made the substitution $x=\pi -t$ and got the limit
$$\lim_{n \to +\infty} \int_{0}^{\pi }{\frac{\cos x}{1+{{\sin }^{2}}(nx)}}\,\mathrm dx$$
Then I made the substitution $t=nx$ and changed the integration limits. I find the integral separately
$$\frac{1}{n} \int_{0}^{n\pi} \frac{\cos\left(\frac{t}{n}\right)}{1+\sin^2 t} \,\mathrm dt$$
Standard trick: split the integral into $n$ elements of length $\pi$
$$\frac{1}{n} \sum_{k=0}^{n-1} \int_{k\pi}^{(k+1)\pi} \frac{\cos\left(\frac{t}{n}\right)}{1+\sin^2 t} \,\mathrm dt$$
In each term we make the replacement $u = t - k\pi$, then $t = u + k\pi$
$$\frac{1}{n} \sum_{k=0}^{n-1} \int_{0}^{\pi} \frac{\cos\left(\frac{u + k\pi}{n}\right)}{1+\sin^2 u} \,\mathrm du$$
If I’m not mistaken, the sum of cosines forms an arithmetic progression, but even after that, how can this integral be calculated? Maybe I started solving it incorrectly, can you show me the right way to solve it?