<s>[INST] limit of trigonometric series Given
$$a_n = \frac 1{n^2}\sum_{k=1}^n {(2k+1)\sin\left(\frac{k^2 \pi}{n^2} \right)}$$
find $\lim_{n \to \infty} a_n$.
My try: Because $k = 1,2,\dots, n$, $$0\le\frac {k^2}{n^2} \le 1$$
hence
$$0\le\frac {k^2}{n^2} \pi \le \pi$$
so
$$0 \le \sin \left( \frac {k^2}{n^2} \pi\right) \le 1.$$
That means $a_n$ is a non-negative sequence.
$$0 \le \frac 1{n^2}\sum_{k=1}^n {(2k+1)\sin\left (\frac{k^2 \pi}{n^2} \right)} \le
\frac 1{n^2}\sum_{k=1}^n {(2k+1)} $$
$$
\frac 1{n^2} n(2n+1) = 2 + \frac 1n \to 2
$$
so, by the comparison rule, the given series converges. The problem is the "sandwich" is not sufficient. 
 [/INST] Consider that:
$$a_n = \frac{1}{n^2}\sum_{k=1}^{n}\sin\left(\frac{k^2\pi}{n^2}\right)+\frac{2}{n}\sum_{k=1}^{n}\frac{k}{n}\sin\left(\frac{k^2\pi}{n^2}\right),\tag{1}$$
where the first term on the right is $O(1/n)$ while the second one is a Riemann sum converging to the integral:
$$\int_{0}^{1}2x\sin(\pi x^2)\,dx=\int_{0}^{1}\sin(\pi y)\,dy=\frac{2}{\pi}.$$
Due to the error term of the trapezoidal rule, the difference between the last integral and the rightmost term in $(1)$ is just $O(1/n^2)$, hence:

$$\lim_{n\to+\infty}a_n=\frac{2}{\pi}.$$

</s>