Find $\lim_{n \to \infty} \left(n - \sum_{k=1} ^{n} \cos \frac{\sqrt{k}}{n} \right)$

Using the estimate $\cos(x)=1-\frac12\,x^2+O(x^4)$, we get $$ \lim_{n\to\infty} \left(n-\sum_{k=1}^{n} \cos\frac{\sqrt{k}}{n} \right) = \lim_{n\to\infty} \sum_{k=1}^n \left( 1-\cos\frac{\sqrt k}n\right) = \lim_{n\to\infty} \sum_{k=1}^n \left( \frac k{2n^2} + O\Big(\frac{k^2}{n^4}\Big) \right). $$ The sum splits into $$ \sum_{k=1}^n \frac k{2n^2} = \frac1{2n^2} \frac{n(n+1)}2 $$ converging to $\frac14$, and the remainder term bounded by $$ \frac1{n^4}\frac{n(n+1)(2n+1)}6 , $$ which converges to $0$. Therefore, your original limit is $\frac14$.


You have $$u_n = n - \sum_{k=1} ^{n} \cos \frac{\sqrt{k}}{n} = \sum_{k=1} ^{n}\left(1-\cos \frac{\sqrt{k}}{n}\right)$$

And as $\sum_{k=1} ^{n} k = \frac{n(n+1)}{2}$:

$$u_n - \frac{n+1}{4n} = \sum_{k=1} ^{n}\left(1-\cos \frac{\sqrt{k}}{n}-\frac{k}{2n^2}\right )$$

And using Taylor's theorem, you get for all $x \in \mathbb R$

$$\left\vert 1-\cos(x)-x^2/2 \right\vert \leq x^4/24.$$

Therefore $$\left\vert u_n - \frac{n+1}{4n} \right\vert \le \sum_{k=1} ^{n}\left\vert1-\cos \frac{\sqrt{k}}{n}-\frac{k}{4n^2}\right\vert \le \frac{1}{24n^4}\sum_{k=1} ^{n} k^2 \tag{1}$$

As $$\sum_{k=1} ^{n} k^2 = \frac{n(n+1)(2n+1)}{6}$$ the RHS of inequality $(1)$ converges to $0$.

Finaly $(u_n)$ converges to $1/4$ as $\lim\limits_{n \to \infty} \frac{n+1}{4n} =1/4$.