Show $\sum_{n\le x}\frac1{\sqrt n}=2\sqrt x+c+O(x^{-1/2})$ I am trying to show the asymptotic expansion for $$\sum_{n\le x}\frac1{\sqrt n}=2\sqrt x+\zeta(1/2)+O(x^{-1/2}).$$

(The exact identity of the zeta term is not important, it need only be some $c$.) To that end, I am attempting to prove the following slightly stronger theorem, which is supported by numerical evidence:


  Let $F(x)=2\sqrt x-\sum_{n\le x}\frac1{\sqrt n}$. If $0&lt;a\le b$, then $|F(a)-F(b)|\le\frac1{\sqrt a}$.


So far, I have only been able to show the weaker statement $|F(a)-F(b)|\le\dfrac2{\sqrt{\lfloor a\rfloor}}$, which is good enough for the asymptotic statement but can clearly be improved to work for all positive reals. My method:

$$\sum_{a&lt;n\le b}\int_{n-1}^{n}(t^{-1/2}-n^{-1/2})\,dt=\sum_{a&lt;n\le b}\left[2\sqrt n-2\sqrt{n-1}-\frac1{\sqrt n}\right]=F(\lfloor b\rfloor)-F(\lfloor a\rfloor)$$

Since the integrand is less than $\frac1{\sqrt{n-1}}-\frac1{\sqrt{n}}$ on its domain, we have:

$$|F(\lfloor b\rfloor)-F(\lfloor a\rfloor)|\le\sum_{a&lt;n\le b}\frac1{\sqrt{n-1}}-\frac1{\sqrt{n}}=\frac1{\sqrt{\lfloor a\rfloor}}-\frac1{\sqrt{\lfloor b\rfloor}}$$

Finally, $F$ is differentiable on $(\lfloor x\rfloor,x)$ with $F'(y)=y^{-1/2}\le\lfloor x\rfloor^{-1/2}$, hence $|F(x)-F(\lfloor x\rfloor)|\le\frac1{\sqrt{\lfloor x\rfloor}}$. Putting it all together, we have

\begin{align}
|F(b)-F(a)|&amp;\le|F(a)-F(\lfloor a\rfloor)|+|F(b)-F(\lfloor b\rfloor)|+|F(\lfloor b\rfloor)-F(\lfloor a\rfloor)|\\
&amp;\le\frac1{\sqrt{\lfloor a\rfloor}}+\frac1{\sqrt{\lfloor b\rfloor}}+\frac1{\sqrt{\lfloor a\rfloor}}-\frac1{\sqrt{\lfloor b\rfloor}}=\frac2{\sqrt{\lfloor a\rfloor}}.
\end{align}



How can I avoid the use of $\frac1{\sqrt{\lfloor a\rfloor}}$, which is not even defined for $a&lt;1$?
Using Abel's summation formula we have $$\sum_{n\leq x}\frac{1}{\sqrt{n}}=\sum_{n\leq x}1\cdot\frac{1}{\sqrt{n}}=\sqrt{x}-\frac{\left\{ x\right\} }{\sqrt{x}}+\frac{1}{2}\int_{1}^{x}\frac{\left\lfloor t\right\rfloor }{t^{3/2}}dt=2\sqrt{x}-\frac{\left\{ x\right\} }{\sqrt{x}}-1-\frac{1}{2}\int_{1}^{x}\frac{\left\{ t\right\} }{t^{3/2}}dt
 $$ where $\left\lfloor t\right\rfloor 
 $ is the floor function and $\left\{ t\right\} 
 $ is the fractional part of $t$. So $$\left|F\left(b\right)-F\left(a\right)\right|=\left|\frac{\left\{ b\right\} }{\sqrt{b}}-\frac{\left\{ a\right\} }{\sqrt{a}}+\frac{1}{2}\int_{a}^{b}\frac{\left\{ t\right\} }{t^{3/2}}dt\right|
 \leq\left|\frac{\left\{ b\right\} }{\sqrt{b}}-\frac{\left\{ a\right\} }{\sqrt{a}}\right|+\frac{1}{\sqrt{a}}-\frac{1}{\sqrt{b}}\leq\frac{1}{\sqrt{a}}+\frac{\left\{ a\right\} }{\sqrt{a}}\leq\frac{2}{\sqrt{a}}
 $$ since $0\leq\left\{ t\right\} &lt;1
 $. It is not the bound that we want but we have eliminated $1/\left\lfloor a\right\rfloor 
 $.
This is a special case of the following theorem:


  If $a:\Bbb R^{&gt;0}\to\Bbb R^{\ge 0}$ is a decreasing function, and $A$ is an antiderivative of $a$, then letting $F(x)=A(x)-\sum_{n\le x}a(n)$, we have $$x\le y\implies |F(x)-F(y)|\le a(x).$$ Thus in particular, if $a\to 0$, then $F$ converges to some $c$, and $|F(x)-c|\le a(x)$.


The OP is the special case of this theorem for $a(x)=\frac1{\sqrt x}$ and $A(x)=2\sqrt x$.

Proof: Define the functions $$G_-(x)=F(x)-\{x\}a(x)=A(x)-\{x\}a(x)-\sum_{n\le x}a(n)$$ and $$G_+(x)=G_-(x)+a(x)=A(x)+(1-\{x\})a(x)-\sum_{n\le x}a(n).$$

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

We will show that $G_-$ is increasing and $G_+$ is decreasing, and $G_-(x)\le F(x)\le G_+(x)$. From this it follows that

$$F(y)-F(x)\le G_+(y)-G_-(x)\le G_+(x)-G_-(x)=a(x)$$
$$F(x)-F(y)\le G_+(x)-G_-(y)\le G_+(x)-G_-(x)=a(x)$$
so $|F(x)-F(y)|\le a(x)$.

Clearly $F(x)-G_-(x)=\{x\}a(x)\ge 0$, and $G_+(x)-F(x)=(1-\{x\})a(x)\ge 0$.

For fixed $k\in\Bbb N$, we note that $G_-(x)=A(x)-(x-k)a(x)-\sum_{n\le k}a(n)$ on $[k,k+1]$. On $[k,k+1)$ this is by definition, and at $k+1$ we have $$G_-(k+1)=A(k+1)-\sum_{n\le k+1}a(n)=A(k+1)-a(x)-\sum_{n\le k}a(n)$$. Thus given $k\le x\le y\le k+1$ we have
\begin{align}
G_-(y)-G_-(x)&amp;=A(y)-A(x)-(y-k)a(y)+(x-k)a(x)\\
&amp;\ge A(y)-A(x)-(y-x)a(y)\\
&amp;=\int_x^y[a(t)-a(y)]\,dt\ge 0.
\end{align}

Similarly,
\begin{align}
G_+(x)-G_+(y)&amp;=A(x)-A(y)+(k+1-x)a(x)-(k+1-y)a(y)\\
&amp;\ge A(x)-A(y)+(y-x)a(x)\\
&amp;=\int_x^y[a(x)-a(t)]\,dt\ge 0.
\end{align}

Thus $G_-$ is increasing and $G_+$ is decreasing on $[k,k+1]$, and by pasting together the intervals at the common points, we conclude that $G_-$ is increasing and $G_+$ is decreasing on $\Bbb R^+$.