Estimating $\sum n^{-1/2}$

Could someone please explain me how does one obtain the following estimate: $$\sum_{n \leq X} n^{-1/2} = \frac12 X^{1/2} + c + O(X^{-1/2}),$$ where $c$ is some constant.

Thank you very much!

PS As pointed out in the comments, $1/2$ in front of $X^{1/2}$ is a typo... I would like an answer with the correct coefficient here.

• Have you tried Stieltjes integration? – Clayton Sep 11 '15 at 21:57
• Hint Since the summand is a decreasing function of $n$, bound the sum by left and right endpoint Riemann sums. – Travis Willse Sep 11 '15 at 21:58
• I'm afraid there's something I don't understand: the sum is certainly larger than $X^{-1/2}\times X=X^{1/2}$. – Intelligenti pauca Sep 11 '15 at 21:58
• @Aretino You are right... it must be a typo in the book I am reading... – Johnny T. Sep 11 '15 at 22:02
• The full asymptotic expansion can be found in this answer. $$2\sqrt{n} + \zeta(1/2) + \frac{1}{2\sqrt{n}} -1/24\,{n}^{-3/2}+{\frac {1}{384}}\,{n}^{-7/2}-{\frac {1}{1024}}\,{n}^ {-11/2}+{\frac {143}{163840}}\,{n}^{-15/2}\\-{\frac {1105}{786432}}\,{n} ^{-19/2}+{\frac {223193}{62914560}}\,{n}^{-23/2}-{\frac {1300075}{ 100663296}}\,{n}^{-{\frac {27}{2}}}+{\frac {137514723}{2147483648}}\,{ n}^{-{\frac {31}{2}}} + \cdots$$ – achille hui Sep 12 '15 at 0:25

$$2 \sqrt{n} + K + \frac{1}{2\sqrt{n}} + \mathcal{O}(n^{-3/2})$$
It can be shown by other means that $K = \zeta(\frac{1}{2})$.
$$\sqrt{n+1}-\sqrt{n}=\frac{1}{\sqrt{n+1}+\sqrt{n}}=\frac{1}{2\sqrt{n}}-\frac{1}{2\sqrt{n}\left(\sqrt{n}+\sqrt{n+1}\right)^2}$$ hence the claim follows just by creative telescoping/ the Hermite-Hadamard inequality, but the first term of the asymptotics should be $\color{red}{2}\cdot\,X^{1/2}$. In such a case, $c=\zeta\left(\frac{1}{2}\right)$.
Denote $f(x)=x^{-1/2}, \ S_n=\sum_{k=1}^nf(k)$. Using the mean value theorem we obtain that $f(x)=f(k)+(x-k)f'(x_k)$, for $x\in[k,k+1]$ where $x_k\in(k,k+1)$, thus \begin{align*} \int_{1}^{n+1}f(x)dx-S_n=\sum_{k=1}^n\int_{k}^{k+1}(f(x)-f(k))dx=\sum_{k=1}^n\int_{k}^{k+1}(x-k)f'(x_k)dx=\frac{1}{2}\sum_{k=1}^nf'(x_k). \end{align*} Since \begin{align*} \int_{1}^{n+1}f(x)dx=2n^{1/2}-2 \end{align*} and \begin{align*} \Big|\sum_{k=n+1}^{\infty}f'(x_k)\Big|\leq\int_{n}^{\infty}|f'(x)|dx= f(n)=n^{-1/2} \end{align*} we obtain \begin{align*} S_n=2n^{1/2}-2-\frac{1}{2}\sum_{k=1}^{\infty}f'(x_k)+\sum_{k=n+1}^{\infty}f'(x_k)=2n^{1/2}+c+O(n^{-1/2}). \end{align*} Comment: to get better expression for c use Taylor formula of second order: $f(x)=f(k)+(x-k)f'(k)+(x-k)^2/2f''(k)$.