The Fourier series $\sum_{n=1}^\infty (1/n)\cos nx$

The series $$\sum_{n=1}^\infty \frac{\sin nx}{n}$$ is the Fourier series of the odd $2\pi$-periodic extension of $(\pi-x)/2, 0<x<\pi$.

My question is : $$\sum_{n=1}^\infty \frac{\cos nx}{n}$$ is the Fourier series of the even $2\pi$-periodic extension of what function?


Solution 1:

The function $-\frac{1}{2}\ln(2-2\cos x)$ simplifies to $f(x)=-\ln(2\sin(x/2))$. We will show that the Fourier cosine series of $f(x), 0<x<\pi,$ is $$\sum_{n=1}^\infty \frac{\cos nx}{n}.$$ Firstly, $$\frac{1}{\pi}\int_0^\pi f(x)\,dx=\frac{1}{\pi}\int_0^\pi \ln 2+\ln(\sin(x/2))\,dx=0$$ because $$\int_0^\pi \ln(\sin(x/2)\,dx=2\int_0^{\pi/2}\ln(\sin(u))\,du=\int_0^\pi \ln(\sin(u))\,du=-\pi\ln 2$$ where the last equality can be found in Ahlfors' Complex Analysis p. 159. Let $n\ge 1$ be an integer. Using integration by parts with $u=\ln(\sin(x/2)$ and $dv=\cos(nx)\,dx$, and the fact that $\lim_{x\to 0^+}\sin(nx)\ln(\sin(x/2)=0$, we get (note that $\int_0^\pi \ln2\cos(nx)\,dx=0$) $$\int_0^\pi f(x)\cos nx\,dx=\frac{1}{2n}\int_0^\pi \cot(x/2)\sin nx\,dx=\frac{\pi}{2n}$$ where the last equality is from here. This proves that $$\frac{2}{\pi}\int_0^\pi f(x)\cos nx\,dx=\frac{1}{n}.$$

Note that the even $2\pi$-periodic extension of $-\ln(2\sin(x/2)), 0<x<\pi$ is the $2\pi$-periodic function $$-\ln\left|2\sin\left(\frac{x}{2}\right)\right|=\ln\left| \frac{1}{2}\csc\left(\frac{x}{2}\right)\right|,$$ $-\infty<x<\infty$.

Solution 2:

The series can also be summed by more elementary methods, in addition to the ones already presented.

Write $$\sum_{n=1}^{\infty} \frac{e^{inx}}{n}$$ and note that this converges for all $x\neq 2k\pi, k\in\mathbb{Z}$. This is in fact the Taylor series of the principle branch of the complex logarithm albeit in disguise: $$\sum_{n=1}^{\infty} \frac{e^{inx}}{n}=-\log(1-e^{ix})=-\log|1-e^{ix}|-i \arg(1-e^{ix})$$

Now observe that $$|1-e^{ix}|=|e^{ix/2}|\cdot|\frac{e^{-ix/2}-e^{ix/2}}{2i}|\cdot|2i|=|-2\sin\frac{x}{2}|$$ and take the real part of the sum to get the answer.

With the aid of elementary geometry, the imaginary part yields the value the asker mentioned. Notice that $\{1-e^{ix}| x\in[0,2\pi]\}$ is a circle centered at 1. For a fixed $x\neq 0,\pi$, consider the triangle formed by $0$,$1$, and $1-e^{ix}$ and the answer follows after some care about the orientations of the angles.

Solution 3:

It seems to have escaped attention that this sum may be evaluated using harmonic summation techniques which can be an instructive exercise and usually succeeds on Fourier series. Here is an opportunity to contribute to an interesting, diverse and visually appealing series of posts.

Introduce $S(x)%$ given by $$S(x) = \sum_{n\ge 1} \frac{1}{n}\cos(nx).$$

The sum term is harmonic and may be evaluated by inverting its Mellin transform.

Recall the harmonic sum identity $$\mathfrak{M}\left(\sum_{k\ge 1} \lambda_k g(\mu_k x);s\right) = \left(\sum_{k\ge 1} \frac{\lambda_k}{\mu_k^s} \right) g^*(s)$$ where $g^*(s)$ is the Mellin transform of $g(x).$

In the present case we have $$\lambda_k = \frac{1}{k}, \quad \mu_k = k \quad \text{and} \quad g(x) = \cos(x).$$ We need the Mellin transform $g^*(s)$ of $g(x)$.

Now the Mellin transform of $\cos(x)$ was computed at this MSE link and found to be $$\Gamma(s) \cos(\pi s/2)$$

It follows that the Mellin transform $Q(s)$ of the harmonic sum $S(x)$ is given by

$$Q(s) = \Gamma(s)\cos(\pi s/2) \zeta(s+1) \quad\text{because}\quad \sum_{k\ge 1} \frac{\lambda_k}{\mu_k^s} = \sum_{k\ge 1} \frac{1}{k} \frac{1}{k^s} = \zeta(s+1)$$ for $\Re(s) > 0.$

The Mellin inversion integral here is $$\frac{1}{2\pi i} \int_{1/2-i\infty}^{1/2+i\infty} Q(s)/x^s ds$$ which we evaluate by shifting it to the left for an expansion about zero.

The zeros of the cosine term at the negative odd integers cancel the poles of the gamma function at those values. No additional cancelation is gained from the trivial zeros of the zeta function term $\zeta(s+1)$ as these are (also) at the odd negative integers to the left of $-1.$ This leaves the pole from the zeta term at $s=0$ and the poles of the gamma function at negative even integers to the left of zero.

Note that in a neighborhood of zero, we have $$\frac{1}{x^s} = 1 - \log(x) s + \frac{1}{2} \log^2(x) s^2 + \sum_{q\ge 3} \frac{(-1)^q}{q!} \log^q(x) s^q$$ and $$\zeta(s+1) = \frac{1}{s} + \gamma - \gamma_1 s + \sum_{q\ge 2} \frac{(-1)^q}{q!} \gamma_q s^q$$ and $$\Gamma(s) = \frac{1}{s} - \gamma + \left(\frac{\gamma^2}{2}+\frac{\pi^2}{12}\right) s + \cdots$$ and finally $$\cos(\pi s/2) = 1 - \frac{\pi^2}{8} s^2 + \frac{\pi^4}{384} s^4 + \sum_{q\ge 3} (-1)^q \frac{\pi^{2q}}{2^{2q}\times (2q)!} s^{2q}.$$

Collecting the contributions to $1/s$ we get $$-\log(x)s \times \frac{1}{s} \times \frac{1}{s} \times 1 + 1\times \frac{1}{s} \times -\gamma + 1\times \gamma \times \frac{1}{s}$$ and hence $$\mathrm{Res}\left(Q(s)/x^s; s=0\right) = -\log x.$$

Fortunately the residues from the remaining poles are simple to compute and summing all contributions we get $$\sum_{q\ge 1} \mathrm{Res}\left(Q(s)/x^s; s=-2q\right) = \sum_{q\ge 1} \frac{1}{(2q)!} (-1)^q \times x^{2q} \times -\frac{B_{2q}}{2q}.$$ This sum is in fact $$-\sum_{q\ge 1} \frac{(ix)^q}{q!} \frac{B_q}{q} + ix \times -\frac{1}{2}.$$ Recall that $$\sum_{q\ge 1} B_q \frac{t^q}{q!} = -1 + \frac{t}{e^t-1}$$ so that $$\sum_{q\ge 1} B_q \frac{t^{q-1}}{q!} = -\frac{1}{t} + \frac{1}{e^t-1}$$ and hence $$\sum_{q\ge 1} B_q \frac{t^q}{q\times q!} = -\log(t) + \log(e^t-1)- t.$$

This is $\sim -1/2 \times t$ in a neighborhood of zero so we can be sure no spurious constant has appeared during the integration.

We return to our collection of residues and finally obtain (setting $t=ix$) $$\log(ix) - \log(e^{ix}-1)+ ix - \frac{1}{2} ix -\log x = -\log(e^{ix}-1) + \log i + \frac{1}{2} ix \\= -\log e^{ix/2} -\log(e^{ix/2}-e^{-ix/2}) + \log i + \frac{1}{2} ix \\= -\log(2i\sin(x/2)) + \log i = -\log(2\sin(x/2)).$$

This holds for $x$ in $(0,2\pi).$ Observing that $S(x)$ is periodic with period $2\pi$ and even we get the end result $$-\log|2\sin(x/2)|.$$

Solution 4:

We can ask Mathematica to sum the series and see what comes out.

Simplify[ComplexExpand[Re@Sum[Cos[n*x]/n, {n, 1, Infinity}]]]

$$-\log(2-2\cos(x))/2$$

Note that I've grabbed just the real part because numerical experiments show that the imaginary part is zero. Of course, we should always check these kinds of computations. Note for example, that this function has a logarithmic singularity at $x=0$, exactly as we'd expect, since the series boils down to the Harmonic series at $x=0$. We can also try to use the computer to compute the Fourier coefficients of the result. I can't quite seem to get the result fully symbolically, but here's a partial result:

(2/Pi) Table[
  Integrate[- Log[2 - 2 Cos[x]]*Cos[n*x]/2, {x, 0, Pi}],
{n, 1, 10}]
(* Out: {1, 1/2, 1/3, 1/4, 1/5, 1/6, 1/7, 1/8, 1/9, 1/10} *)

Well, that looks good! I guess we could also look at a plot:

Plot[{
   -Log[2 - 2 Cos[x]]/2,
   Sum[Cos[n*x]/n, {n, 1, 15}]
 }, {x, -8, 8}]

enter image description here

Solution 5:

The result can also be obtained by a much simpler derivation than given above.

Put $C(x) = \sum \frac{\cos(nx)}{n}$ then we first see that $C(\pi) = -(1-1/2+1/3-...) = -\log(2)$ and

$C(x) = C(\pi) + \int_\pi^x \frac{dC(x)}{dx}dx \\ = -\log(2) -\mathcal{Im}\left(\int_\pi^x\sum e^{inx}dx\right)\\ = -\log(2) -\int_\pi^x\frac{\sin(x)}{2-2\cos(x)}dx \\ = - \frac{\log|2-2\cos(x)|}{2}$