# Value of $\sum_{n=1}^{\infty} \frac{\cos (n)}{n}$

I was trying to calculate the value of the series $$\displaystyle \sum_{n=1}^{\infty} \dfrac{\cos (n)}{n}$$ and I got an answer which I think could be right, but I'm not sure about some of the steps I took to get there. I was wondering if someone could provide some more insight so I can clear my doubts, and also check if I actually got the correct value.

First of all, I used Dirichlet's test for the convergence of the series, since $$a_n = \dfrac{1}{n}$$ is monotonic and $$\displaystyle \lim_{n \to \infty} a_n = 0$$, and the cosine partial sums can be bounded by a constant not dependent on $$n$$ (I'm pretty sure this is right since I looked other ways to do it, so I won't list exactly what I did to get the bound).

With that out of the way, I tried taking the expression $$\dfrac{\cos(n)}{n}$$ and rewriting it as something I could attempt to sum, and got this:

$$\displaystyle \int_1^{\pi} \sin(nx) \, dx = \left. -\dfrac{\cos(nx)}{n} \right|_1^{\pi} = \dfrac{(-1)^{n+1}}{n} + \dfrac{\cos(n)}{n}$$

So

$$\displaystyle \int_1^{\pi} \sin(nx) \, dx + \dfrac{(-1)^{n}}{n} = \dfrac{\cos(n)}{n}$$

And then

$$\displaystyle \lim_{n \to \infty} \displaystyle \sum_{k=1}^{n}\left(\displaystyle \int_1^{\pi} \sin(kx) \, dx + \dfrac{(-1)^{k}}{k}\right) = \displaystyle \lim_{n \to \infty} \displaystyle \sum_{k=1}^{n} \dfrac{\cos(k)}{k}$$

Then I tried separating the left side member into two sums, since

$$\displaystyle \sum_{n=1}^{\infty} \dfrac{(-1)^n}{n} = \displaystyle -\sum_{n=1}^{\infty} \dfrac{(-1)^{n+1}}{n} = -\ln (2)$$

I believe the latter equality can be derived using the alternate series test for the convergence of the series, and the Taylor expansion around $$x = 0$$ of $$\ln {(1+x)}$$ along with Abel's theorem. As for the other sum, this is the step I'm not sure about. I did

$$\displaystyle \lim_{n \to \infty} \displaystyle \sum_{k=1}^{n}\left(\displaystyle \int_1^{\pi} \sin(kx) \, dx\right) = \displaystyle \lim_{n \to \infty} \displaystyle \int_1^{\pi} \left(\displaystyle \sum_{k=1}^{n} \sin(kx)\right) \, dx$$

I'm not sure that's valid, and if it is I'm not sure why: I thought it would be fine since the partial sums could be arranged that way before taking the limit, but I suspect this thinking isn't correct, and I can't just swap the sum and the integral anytime without affecting the result. But anyways, if we take it as valid, then we can get a value for the sum by doing

$$\cos {(nx+\dfrac{x}{2})} - \cos {(nx-\dfrac{x}{2})} = -2\sin {(nx)}\sin{\left(\dfrac{x}{2}\right)}$$

So

$$\sin{(nx)} = \dfrac{\cos {(nx-\frac{x}{2})} + \cos {(nx+\frac{x}{2})}}{2\sin{\left(\frac{x}{2}\right)}}$$

And then

$$\displaystyle \sum_{k=1}^{n} \sin{(kx)} = \displaystyle \sum_{k=1}^{n} \dfrac{\cos {(kx-\frac{x}{2})} + \cos {(kx+\frac{x}{2})}}{2\sin{\left(\frac{x}{2}\right)}}$$

Which telescopes to

$$\displaystyle \sum_{k=1}^{n} \sin{(kx)} = \dfrac{\cos {\left(\frac{x}{2}\right)}-\cos {\left(\frac{2n+1}{2} \cdot x\right)}}{2\sin{\left(\frac{x}{2}\right)}}$$

Returning to the integral, we need to evaluate

$$\displaystyle \lim_{n \to \infty} \displaystyle \int_1^{\pi} \left(\displaystyle \sum_{k=1}^{n} \sin(kx)\right) \, dx = \displaystyle \lim_{n \to \infty} \displaystyle \int_1^{\pi} \frac{\cos {\left(\frac{x}{2}\right)}-\cos {\left(\frac{2n+1}{2} \cdot x\right)}}{2\sin{\left(\frac{x}{2}\right)}} \, dx$$

I again tried separating it in the sum of the integrals. The first one

$$\displaystyle \int_1^{\pi} \frac{\cos {\left(\frac{x}{2}\right)}}{2\sin{\left(\frac{x}{2}\right)}} \, dx = \displaystyle \int_{\sin {\frac{1}{2}}}^1 \dfrac{1}{u} \, du = -\ln({\sin{\frac {1}{2}}})$$

Via substitution $$u = \sin{\frac{x}{2}}$$

This won't change when $$n$$ goes to infinity. As for the second one

$$-\dfrac{1}{2} \displaystyle \int_1^{\pi} \dfrac{\cos{\left(nx+\frac{x}{2}\right)}}{\sin{\left(\frac{x}{2}\right)}} \, dx = -\dfrac{1}{2}\left(\displaystyle \int_1^{\pi} \dfrac{\cos{(nx)}\cos{\left(\frac{x}{2}\right)}}{\sin{\left(\frac{x}{2}\right)}} \, dx - \displaystyle \int_1^{\pi} \sin(nx) \, dx \right) =$$

$$= -\dfrac{1}{2}\left(\displaystyle \int_1^{\pi} \dfrac{\cos{(nx)}\cos{\left(\frac{x}{2}\right)}}{\sin{\left(\frac{x}{2}\right)}} \, dx + \displaystyle \left. \frac{\cos(nx)}{n} \right|_1^{\pi} \right)$$

Both of these integrals go to 0 as $$n$$ goes to infinity, applying the Riemann-Lebesgue lemma for the first one, since the function $$f(x) = \cot{\left(\frac{x}{2}\right)}$$ is continuous on $$[1,\pi]$$. Putting it all together gives

$$\displaystyle \displaystyle \sum_{n=1}^{\infty} \dfrac{\cos(n)}{n} = -\ln2-\ln{\left(\sin{\frac{1}{2}}\right)} = \boxed{-\ln{\left(2 \cdot \sin{\frac{1}{2}}\right)}} \approx 0.0420195$$

I used Octave to try and check the result: setting $$n = 10^6$$ gave me

$$S_{10^6} \approx 0.042020$$

Because of this, I'm inclined to think I got the correct answer, but I still doubt some of the steps I took (mainly the interchanging sum and integral one).

Thanks in advance. I'm sorry if I didn't make myself clear, english isn't my first tongue. I did some search as to find something related to this value, but couldn't find anything. Very sorry if its been answered before.

• Another way to proceed to verify your value could be to use $\cos(n) = \Re(e^{in})$ and the series of the principal branch of the complex logarithm to get $$-\Re(\ln(1-e^i))$$ – LL 3.14 Jul 29 at 15:34
• "I''m not sure that's valid" You are doing nothing but pulling out a finite sum from an integral. That is perfectly valid. You take the limit in the end, apposed to pulling the limit inside the integral (which is what is not always allowed), so its no problem. In formulas: $\lim_n \int \sum^n$ is not always $\int \lim_n \sum^n$, but $\lim_n \int \sum^n$ is always equal to $\lim_n \sum^n \int$. – Winther Jul 29 at 15:38
• Thanks to both of you! Complex logarithm would've been waaay faster, but I didn't even think about it. – Nicolás Rezzano Jul 29 at 15:49
• I believe I've no more doubts, but anyways, that post is about the convergence of the series, which I'm pretty sure I was able to prove using the test. My question was more about the value, specifically about what I did to get there. Thanks anyways! – Nicolás Rezzano Jul 29 at 16:50

Maybe a shorter approach

\begin{align} \sum_{n=1}^{\infty} \dfrac{\cos n}{n}&=\frac12 \sum_{n=1}^{\infty} \dfrac{e^{in}+e^{-in}}{n}\\ &=- \frac12 [\ln(1-e^i)+ \ln(1-e^{-i })]\\ &= -\frac12 \ln (2-2\cos1)=-\frac12\ln(4\sin^2\frac12)\\ &= -\ln(2\sin\frac12) \end{align}

• Yes! Someone pointed out I could've used that to also check my result. It certainly is way shorter! But it didn't come to me :p – Nicolás Rezzano Jul 29 at 15:51
• @NicolásRezzano -hopefully it is helpful – Quanto Jul 29 at 16:33
• One should pay special attention in this approach, as $e^i$ is exactly on the radius of convergence of $\ln$. Besides, since $\ln$ is multi-valued, one should also mention which branch is the series converging to, so as to justify $\ln(1 - e^i) + \ln(1 - e^{-i}) = \ln((1 - e^i)(1 - e^{-i}))$. – WhatsUp Jul 29 at 16:45

If $$\log$$ is the principal branch of logarithmic function, we have that $$-\log(1-z)=\sum^\infty_{n=1}\frac{z^n}{n}$$ for all $$|z|<1$$. If $$z=re^{i\theta}$$ with $$0, then the Abel sum of the sawtooth function $$f(\theta)=\frac{1}{2i}\sum_{|n|\geq1}\frac{e^{in\theta}}{n}=\sum^\infty_{n=1}\frac{\sin(n\theta)}{n}$$ is given by \begin{align} A_rf(\theta)&= \sum^\infty_{n=1}\frac{r^n\sin(n\theta)}{n}= \frac{1}{2i}\sum_{|n|\geq1}\frac{r^{|n|}e^{in\theta}}{n}=\frac{1}{2i}\sum^\infty_{n=1}\frac{r^n}{n}\Big(e^{in\theta}-e^{-in\theta}\Big)\\ &=-\frac{1}{2i}\big(\log(1-re^{i\theta})-\log(1-re^{-i\theta})\big)=\operatorname{Im}\big(-\log(1-re^{i\theta})\big)\\ &= -\operatorname{arg}(1-re^{i\theta}). \end{align} Thus, for $$0<\theta<2\pi$$, we have that $$\frac{1}{2}(\pi-\theta)=f(\theta)=\lim_{r\rightarrow1-}A_rf(\theta)=-\operatorname{arg}(1-e^{i\theta})$$. Now we consider \begin{align} -\log(1-re^{i\theta})&=\sum^\infty_{n=1}\frac{r^n\cos(n\theta)}{n} + i\sum^\infty_{n=1}\frac{r^n\sin(n\theta)}{n}\nonumber\\ &= -\log(|1-re^{i\theta}|) - i\arg(1-re^{i\theta})\tag{2}\label{sawtooth-log} \end{align} The second term the right hand side of $$\eqref{sawtooth-log}$$ converges to $$i\,f(\theta)$$ for $$0<\theta<2\pi$$, and the first term converges to the $$2\pi$$--periodic even function $$g(\theta):=-\log(|1-e^{i\theta}|)=-\log\big(2|\sin(\theta/2)|\big)$$ Notice that $$g$$ is unbounded and that $$\lim_{\theta\rightarrow0}g(\theta)=\infty=\lim_{\theta\rightarrow2\pi}g(\theta)$$. Since $$\sin(t)\cong t$$ as $$t\rightarrow0$$ and $$\lim_{t\rightarrow0+}t^\alpha\log(t)$$ for any $$\alpha>0$$, we have that $$g\in\mathcal{L}_p(\mathbb{S}^1)$$ for all $$p\geq1$$. Since $$\theta\mapsto\sum^\infty_{n=1}\frac{\cos(n\theta)}{n}$$ is square integrable over $$\mathbb{S}^1$$,
$$\log\big(2|\sin(\theta/2)|\big)=-\sum^\infty_{n=1}\frac{\cos(n\theta)}{n}$$ at $$\theta=1$$, one gets $$-\log\big(2|\sin(1/2)|\big)=\sum^\infty_{n=1}\frac{\cos(n)}{n}$$

• Thank you! There are some things over there I've never seen and don't quite understand, but its nice to see another approach. – Nicolás Rezzano Jul 29 at 18:38
• Let me know what you don't understand. I'll be happy to answer your question to the best of my ability. – Oliver Diaz Jul 29 at 19:58
• Don't worry, it's mostly the last part. It involves notation I'm not familiar with, like the Lp(S^1) thing (sorry I didn't render it, I'm from the phone which doesn't work very well) – Nicolás Rezzano Jul 29 at 20:51

Approach using $$\mathcal Fourier$$ $$Analysis$$ :
Define $$f(x):=-\log_e(2\sin(\frac{x}{2}))$$ We can show that the $$\mathcal Fourier$$ $$cosine$$ $$series$$ of $$𝑓(𝑥)$$ ,$$0<𝑥<𝜋$$, is: $$\sum_{n\in\mathbb N}\frac{\cos(nx)}{n}\ .$$
$$\int_0^πf(x)dx=0$$ (check it)
$$\int_0^πf(x)\cos(nx)dx=\frac{1}{2n}\int_0^π\cos(\frac{x}{2})\sin(nx)dx=\frac{π}{2n}$$ (check it)
hence $$\frac{2}{π}\int_0^πf(x)\cos(nx)dx=\frac{1}{n}$$
Choose x=1 and that implies:
$$-\log(2\sin(\frac{1}{2}))=\sum_{n\in\mathbb N}\frac{\cos(n)}{n}$$.

• Thank you! Since that's what I knew was used for the sin series, I tried to find a function that would let me get the value I was going for using Fourier, but my creativity sucks so I went with a different approach. Very nice! – Nicolás Rezzano Jul 29 at 17:17

$$\sum_{n\geq1}{}\frac{\cos(n)}{n}=\sum_{n=0}^{\infty}\frac{\cos(n)x^n}{n}|_{x=1}$$
\begin{align*} s(x)=\sum_{n=1}^{\infty}\frac{\cos(n)x^n}{n}\implies s^{'}(x)=\sum_{n=1}^{\infty}\cos(n)x^{n-1}\\ =\frac{1}{x}(\sum_{n=0}^{\infty}\cos(n)x^{n}-1)=\frac{1}{x}(\Re(\sum_{n=0}^{\infty}(e^ix)^n)-1)\\ =\frac{1}{x}(\frac{1-\cos(1)x}{x^2-2x\cos(1)+1}-1)\\ =\frac{1}{x}(\frac{x\cos(1)-x^2}{x^2-2x\cos(1)+1})\\ \end{align*}

So $$S(x)=\int\frac{\cos(1)-x}{x^2-2x\cos(1)+1}dx=-\frac{1}{2}\log(x^2-2x\cos(1)+1)+C$$ We have $$S(0)=0=C$$
So $$S(x)=-\frac{1}{2}\log(x^2-2x\cos(1)+1)$$
We find $$\sum_{n=1}^{\infty}\frac{\cos(n)}{n}=S(1)=-\frac{1}{2}\log(2(1-\cos(1))$$

• Nice - it's the same value, I think. I'd never seen that result for the real part of $(e^{i}x)^n$ series. Thanks! – Nicolás Rezzano Jul 29 at 16:56