# Does the series $\sum_{n=1}^\infty (-1)^n \frac{\cos(\ln(n))}{\sqrt{n}}$ converge?

Numerical results for $m=1$ to $2000$ showed that the series

$$Q(m)=\sum_{n=1}^m (-1)^n \frac{\cos(\ln(n))}{\sqrt{n}}$$

converged to $-0.63986...$

Does the series

$$\sum_{n=1}^{\infty} (-1)^n \frac{\cos(\ln(n))}{\sqrt{n}}$$

converge?

here is plot of $Q(m)$ vs. $m$

• $\large\tt -0.639861913937\ldots$. – Felix Marin Sep 19 '14 at 6:19
• I did't with Mathematica $$\verbNSum[(-1)^n Cos[Log[n]]/Sqrt[n], {n, 1, Infinity}, WorkingPrecision -> 25]$$ – Felix Marin Sep 19 '14 at 7:09
• The body of the question has square roots but the title does not. Which is intended? Without square roots, a variation of the AST for slowly rotating complex numbers can be applied. In fact if the denominator is $n^{a}$ with $a>1/2$, convergence is relatively easy to show. – alex.jordan Sep 19 '14 at 7:16
• A clean proof will probably use the fact that this is the real part of $\sum(-1)^n\frac{\cos(\ln(n))+i\sin(\ln(n))}{\sqrt{n}}=\sum(-1)^n\frac{\exp(i\ln(n))}{\sqrt{n}}$ – alex.jordan Sep 19 '14 at 7:20
• @FelixMarin: I used the Euler-Maclaurin Sum Formula to compute this sum. I think Mathematica uses this formula, too. – robjohn Sep 19 '14 at 11:52

Convergence

The Euler Maclaurin Sum Formula says that, for some constants $C$ and $S$, $$\sum_{k=1}^n\frac{\cos(\log(k))}{\sqrt{k}} =\sqrt{n}\left[\frac25\cos(\log(n))+\frac45\sin(\log(n))\right]+C+O\left(n^{-1/2}\right)\tag{1}$$ and $$\sum_{k=1}^n\frac{\sin(\log(k))}{\sqrt{k}} =\sqrt{n}\left[\frac25\sin(\log(n))-\frac45\cos(\log(n))\right]+S+O\left(n^{-1/2}\right)\tag{2}$$ Writing the alternating sum as the difference of twice the even terms minus all the terms, we get \begin{align} &\sum_{k=1}^{2n}(-1)^k\frac{\cos(\log(k))}{\sqrt{k}}\\ &=2\sum_{k=1}^n\frac{\cos(\log(2k))}{\sqrt{2k}} -\sum_{k=1}^{2n}\frac{\cos(\log(k))}{\sqrt{k}}\\ &=\sqrt2\sum_{k=1}^n\frac{\cos(\log(2)+\log(k))}{\sqrt{k}} -\sum_{k=1}^{2n}\frac{\cos(\log(k))}{\sqrt{k}}\\ &=\sqrt2\cos(\log(2))\sum_{k=1}^n\frac{\cos(\log(k))}{\sqrt{k}}\\ &-\sqrt2\sin(\log(2))\sum_{k=1}^n\frac{\sin(\log(k))}{\sqrt{k}} -\sum_{k=1}^{2n}\frac{\cos(\log(k))}{\sqrt{k}}\\ &=\sqrt2\cos(\log(2))\sqrt{n}\left[\frac25\cos(\log(n))+\frac45\sin(\log(n))\right]\\ &-\sqrt2\sin(\log(2))\sqrt{n}\left[\frac25\sin(\log(n))-\frac45\cos(\log(n))\right]\\ &-\sqrt{2n}\left[\frac25\cos(\log(2n))+\frac45\sin(\log(2n))\right]\\ &+\left[\vphantom{\frac25}\sqrt2\cos(\log(2))-1\right]C-\sqrt2\sin(\log(2))\,S+O\left(n^{-1/2}\right)\\[6pt] &=\left[\vphantom{\frac25}\sqrt2\cos(\log(2))-1\right]C-\sqrt2\sin(\log(2))\,S+O\left(n^{-1/2}\right)\tag{3} \end{align} Thus, the series converges to $$\left[\vphantom{\frac25}\sqrt2\cos(\log(2))-1\right]C-\sqrt2\sin(\log(2))\,S\tag{4}$$

Computing the Sum

Using the Euler-Maclaurin Sum Formula to compute $C$ and $S$, we get $$C=0.1439364270771890603243896664837216\tag{5}$$ and $$S=0.7220997435316730891261751345803249\tag{6}$$ Therefore, using $(4)$, we get $$\sum_{k=1}^\infty(-1)^k\frac{\cos(\log(k))}{\sqrt{k}}=-0.6398619139367474311364313137759324\tag{7}$$

The Asymptotic Expansions

Including more terms of the Euler-Maclaurin Sum Formula, we have $$\sum_{k=1}^n\frac{\cos(\log(k))}{\sqrt{k}} =\sqrt{n}\left[a_s(n)\cos(\log(n))+a_c(n)\sin(\log(n))\vphantom{\tfrac25}\right]+C\tag{8}$$ and $$\sum_{k=1}^n\frac{\sin(\log(k))}{\sqrt{k}} =\sqrt{n}\left[a_s(n)\sin(\log(n))-a_c(n)\cos(\log(n))\vphantom{\tfrac25}\right]+S\tag{9}$$ where \begin{align} \hspace{-1cm}\small a_s(n)\,&\small=\frac25+\frac1{2n}-\frac1{24n^2}-\frac7{1920n^4}+\frac{491}{193536n^6}-\frac{11903}{4423680n^8}+\frac{822169}{181665792n^{10}}+O\left(\frac1{n^{12}}\right)\tag{10}\\[4pt] \hspace{-1cm}\small a_c(n)\,&\small=\frac45-\frac1{12n^2}+\frac{19}{2880n^4}-\frac{157}{96768n^6}+\frac{10039}{15482880n^8}+\frac{146483}{2452488192n^{10}}+O\left(\frac1{n^{12}}\right)\tag{11} \end{align} $(8)-(11)$ were used with $n=1000$ to compute $(5)$ and $(6)$ to over $34$ places of precision.

Note that $(1)$ and $(2)$ are just truncated versions of $(8)-(11)$.

Zeta Function

As achille hui has noted in a comment, we have \begin{align} \sum_{k=1}^\infty(-1)^k\frac{\cos(\log(k))}{\sqrt{k}} &=\mathrm{Re}\left[\sum_{k=1}^\infty(-1)^ke^{i\log(k)}k^{-1/2}\right]\\ &=\mathrm{Re}\left[\sum_{k=1}^\infty(-1)^kk^{-1/2+i}\right]\\ &=-\mathrm{Re}\left[\eta\left(1/2-i\right)\vphantom{\tfrac12}\right]\\[6pt] &=\mathrm{Re}\left[\left(2^{1/2+i}-1\right)\zeta\left(1/2-i\right)\right] \end{align} This is probably why appears in the tags for this question.

In this answer, it is shown that the series for $\eta(s)$ converges for $\mathrm{Re}(s)\gt0$. So that answer offers another method to show that the sum in this question converges.

• Very nice! This reminds me I need to have a look at this formula, I know it's useful to compute sums in extended precision, but I have never taken the time to dig further into it. – StayHomeSaveLives Sep 19 '14 at 11:31
• @robjohn wonderful result!. Thanks! – mike Sep 19 '14 at 12:51
• @Jean-ClaudeArbaut: I have added more of the detail of what I did with the Euler-Maclaurin Sum Formula. – robjohn Sep 19 '14 at 15:46
• Numerically, it is the same as $$-\Re\left[\left(1-2^{1/2+i}\right)\zeta\left(\frac12-i\right)\right]\\ \approx -0.63986191393674743113643131377593235163275874915340904848016...$$ (number from WA) – achille hui Sep 19 '14 at 15:56
• @achillehui: as well it should, since they are the same. I noticed this, but didn't include it. Perhaps I should. – robjohn Sep 19 '14 at 16:01

We multiply the original series by $(-1)$ and obtain

$$-Q(m)=\sum_{n=1}^{\infty} (-1)^{n+1} \frac{\cos(\ln(n))}{\sqrt{n}}=\sum_{k=0}^{\infty} a_k\tag{0}$$ with$$a_k=\frac{\cos(\ln(2k+1))}{\sqrt{2k+1}}-\frac{\cos(\ln(2k+2))}{\sqrt{2k+2}}\tag{1}$$

Set $2k+1=m$. Then, when $m\to\infty$,

$$\ln(m+1)=\ln m +m^{-1}+O(m^{-2}). \tag{2}$$

Substituting (2) into (1) and expanding the result as a series in $m^{-1/2}$ leads to

$$a_k=m^{-3/2}\left(\frac{1}{2}\cos(\ln m)+\sin(\ln m)\right)+O(m^{-5/2}).\qquad m\to\infty \tag{3}$$

So $$|a_k|\le m^{-3/2}\left(\frac{1}{2}|\cos(\ln m)|+|\sin(\ln m)|\right)+O(m^{-5/2})=O(m^{-3/2})=O(k^{-3/2})\tag{4}$$

Therefore the original series in (0) is convergent.

• The idea is good but the inequality signs at the end are too strong (there are $O(m^{-5/2})$ error terms). – Did Sep 19 '14 at 5:56
• @Did Thanks a lot for the guidance! – mike Sep 19 '14 at 6:48
• There was still an incorrect inequality, I took on me to add the relevant error terms. – Did Sep 19 '14 at 8:43
• @Did. Thanks for the editing. Please feel free to do it because I am not familiar with this kind of things. – mike Sep 19 '14 at 8:50
• You are welcome. The answer looks fine now and, as I said, your idea to solve this was a good one. +1. – Did Sep 19 '14 at 8:51