TITLE: Is $\sum_{k=1}^n \cos \sqrt k= o(n)$ as $n\to \infty$?
QUESTION [7 upvotes]: In the solution   @Jack D'Aurizio: gave the estimate 
$$\sum_{k=1}^{n} \cos k^2 = \mathcal{O}(\sqrt{n}\log n)$$
and mentioned the Weyl's inequalities
$$\sum_{k=1}^n \cos( f(k) ) = \mathcal{O}(F(n))$$  if $f$ is polynomial function. 
I wonder if one can give some nontrivial estimates for other kind of functions, for instance
$$\sum_{k=1}^n \cos \sqrt{k} = \mathcal{O}(F(n))$$ for some $F(n) = \mathcal{o}(n)$.

REPLY [7 votes]: We have
$$\sum_{k = 1}^n \cos \sqrt{k} = \frac{\cos 1 + \cos \sqrt{n}}{2} + \int_1^n \cos \sqrt{t}\,dt - \int_1^n \bigl(\lbrace t\rbrace - \tfrac{1}{2}\bigr)\frac{\sin \sqrt{t}}{2\sqrt{t}}\,dt.$$
The first term is bounded, and the second integral is $O(\sqrt{n})$ as one sees from the boundedness of $\sin \sqrt{t}$ and $\lbrace t\rbrace - \frac{1}{2}$. It thus remains to estimate
\begin{align}
\int_1^n \cos \sqrt{t}\,dt &= 2\int_1^{\sqrt{n}} u\cos u\,du \\
&= 2u\sin u \biggr\rvert_1^{\sqrt{n}} - 2\int_1^{\sqrt{n}} \sin u\,du \\
&= 2\sqrt{n}\sin \sqrt{n} - 2\sin 1 + 2\cos \sqrt{n} - 2,
\end{align}
which clearly is in $O(\sqrt{n})$.
Generally, for $0 < \alpha < 1$, we obtain
$$\sum_{k = 1}^n \cos k^{\alpha} = \frac{\cos 1 + \cos n^{\alpha}}{2} + \int_1^n \cos t^{\alpha}\,dt - \alpha\int_1^n p_1(t)t^{\alpha-1}\sin t^{\alpha}\,dt,\tag{$\ast$}$$
where $p_1(t) = \lbrace t\rbrace - \frac{1}{2}$. We can estimate the first integral substituting $u = t^{\alpha}$ and integrating by parts:
\begin{align}
\int_1^n \cos t^{\alpha}\,dt &= \frac{1}{\alpha} \int_1^{n^{\alpha}} u^{\frac{1}{\alpha}-1}\cos u\,du \\
&= \frac{u^{1/\alpha-1}\sin u}{\alpha}\biggr\rvert_1^{n^{\alpha}} - \frac{1}{\alpha}\biggl(\frac{1}{\alpha}-1\biggr)\int_1^{n^{\alpha}} u^{\frac{1}{\alpha}-2}\sin u\,du.
\end{align}
The first term is $\frac{1}{\alpha}\bigl(n^{1-\alpha}\sin n^{\alpha} - \sin 1\bigr)$, and using $\lvert \sin u\rvert \leqslant 1$ we see that the remaining integral also belongs to $O(n^{1-\alpha})$.
For the integral
$$\alpha\int_1^n p_1(t)t^{\alpha-1}\sin t^{\alpha}\,dt,$$
we immediately obtain an $O(n^{\alpha})$ bound using the boundedness of $p_1$ and $\sin$. For $\alpha \leqslant \frac{1}{2}$, this is smaller than the bound on the other integral. For $\alpha > \frac{1}{2}$, we still have an $O(n^{\alpha})$ bound for the sum, which suffices to conclude that
$$\sum_{n = 1}^{\infty} \frac{\cos k^{\alpha}}{k}$$
converges. But we can lower the bound using integration by parts:
$$\int_1^n p_1(t) t^{\alpha-1} \sin t^{\alpha} = p_2(t)t^{\alpha-1}\sin t^{\alpha}\biggr\rvert_1^n - (\alpha-1)\int_1^n p_2(t)t^{\alpha-2}\sin t^{\alpha}\,dt - \alpha \int_1^n p_2(t)t^{2(\alpha-1)}\cos t^{\alpha}\,dt$$
where the first two terms on the right are bounded, and the last integral is elementarily bounded by $C\cdot n^{2\alpha - 1}$. Continuing integration by parts, we find that the last integral in $(\ast)$ belongs to $O(n^{1 - m(1-\alpha)})$ for every $0 < m \leqslant \frac{1}{1-\alpha}$, and then eventually we obtain
$$\int_1^n p_1(t)t^{\alpha-1}\sin t^{\alpha}\,dt \in O(1),$$
so the sum belongs to $O(n^{1-\alpha})$ for every $\alpha \in (0,1)$ [this is also true for $\alpha = 0$ and $\alpha = 1$].
Noting that $\cos k^{\alpha} \geqslant \frac{1}{2}$ for
$$\bigl(2m - \tfrac{1}{3}\bigr)\pi \leqslant k^{\alpha} \leqslant \bigl(2m + \tfrac{1}{3}\bigr)\pi,$$
we see that the bound above is sharp. For $n \approx \bigl((2m+\frac{1}{3})\pi\bigr)^{1/\alpha}$, we have $\Theta(n^{1-\alpha})$ successive terms that are $\geqslant \frac{1}{2}$, whence the partial sum must have had at least order $\ell^{1-\alpha}$ for some $\ell \leqslant n$.