Compute the fourier coefficients, and series for $\log(\sin(x))$

I posted a similar question with a bad response, so I am retrying with hopes of better knowledge. The fourier series is in the form:

$$f(x) = \frac{a_0}{2} + \sum_{n=1}^{\infty} a_n\cos(nx) + \sum_{n=1}^{\infty} b_n\sin(nx)$$

Where:

$$a_n = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x)\cos(nx) dx$$ $$b_n = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x)\sin(nx) dx$$

The problem is computing the coefficients. The goal of trying to derive the series is to solve:

$$\int_{0}^{\pi} \log(\sin(x)) dx$$

$\displaystyle a_n = \frac{1}{\pi} \int_{-\pi}^{\pi} \log(\sin(x))\cos(nx) dx$

Which is very difficult to compute.

What can be done?

The series representation is:

$$\log(\sin(x)) = -\log(2) - \sum_{n=1}^{\infty} \frac{\cos(2kx)}{k}$$


Solution 1:

Ok, here I am. The goal is to compute the Fourier series of $g(x)=\log\sin x$ over $[0,\pi]$, or the Fourier series of $h(x)=\log\sin\frac{x}{2}$ over $[0,2\pi]$, or the Fourier series of $f(x)=\log\cos\frac{x}{2}$ over $[-\pi,\pi]$. Since $f(x)$ is an even function, we have to compute: $$ a_n = \frac{1}{\pi}\int_{-\pi}^{+\pi}\cos(nx)\log\cos\frac{x}{2}\,dx = \frac{2}{\pi}\int_{0}^{\pi}\cos(nx)\log\cos\frac{x}{2}\,dx$$ for any $n\geq 1$ to be able to state: $$ f(x) = \frac{1}{2\pi}\int_{-\pi}^{\pi}f(x)\,dx + \sum_{n\geq 1}a_n\cos(nx)=\frac{a_0}{2}+\sum_{n\geq 1}a_n\cos(nx).$$ for any $x\in(-\pi,\pi)$. Integration by parts gives: $$ a_n = \frac{2}{\pi}\left(\frac{1}{n}\left.\sin(nx)\log\cos\frac{x}{2}\right|_{0}^{\pi}+\frac{1}{2n}\int_{0}^{\pi}\sin(nx)\tan\frac{x}{2}\,dx\right)$$ or just: $$ a_n = \frac{1}{\pi n}\int_{0}^{\pi}\frac{\sin(nx)\sin(x/2)}{\cos(x/2)}\,dx = \frac{2}{\pi n}\int_{0}^{\pi/2}\frac{\sin(2nx)\sin x}{\cos x}\,dx.$$ Since $\cos((2n+1)x)=2\cos x\cos(2nx)-\cos((2n-1)x)$, we have: $$ a_n = \frac{1}{\pi n}\int_{0}^{\pi/2}\sum_{k=1}^{n}\cos((2k-1)x)\,dx =\frac{(-1)^{n+1}}{n}.$$ This gives: $$\log\cos\frac{x}{2}=\frac{a_0}{2}+\sum_{n\geq 1}\frac{(-1)^{n+1}}{n}\cos(nx)$$ for any $x\in(-\pi,\pi)$. In order to find $a_0$, we can simply match $f(0)=0$ with the series on the right hand side. Since: $$\sum_{n\geq 1}\frac{(-1)^{n+1}}{n}=\int_{0}^{1}\frac{dx}{1+x}=\log 2,$$ we have: $$\log\cos\frac{x}{2}=-\log 2+\sum_{n\geq 1}\frac{(-1)^{n+1}}{n}\cos(nx)\qquad\forall x\in(-\pi,\pi),\tag{1}$$ and by translating the variable: $$\log\sin\frac{x}{2}=-\log 2-\sum_{n\geq 1}\frac{1}{n}\cos(nx)\qquad\forall x\in(0,2\pi),\tag{2}$$ $$\log\sin x = -\log 2-\sum_{n\geq 1}\frac{1}{n}\cos(2nx)\qquad\forall x\in(0,\pi),\tag{3}$$ as wanted.


A little addendum, since I think it is worth mentioning the following technique. Starting with a celebrated identity: $$\prod_{k=1}^{n-1}\sin\frac{\pi k}{n}=\frac{2n}{2^n}$$ and noticing that $\log\sin x$ is a Riemann integrable function over $(0,\pi)$, we have: $$\int_{0}^{\pi}\log\sin x\,dx = \lim_{n\to +\infty}\frac{\pi}{n}\sum_{k=1}^{n-1}\log\sin\frac{\pi k}{n}=\lim_{n\to +\infty}\frac{\pi}{n}\log\frac{2n}{2^n}=\color{red}{-\pi\log 2}.$$

Solution 2:

Use equation $\text{(1d)}$ below and the fact that $$ \int_0^\pi\cos(2kx)\,\mathrm{d}x=0 $$ to get $$ \int_0^\pi\log(\sin(x))\,\mathrm{d}x=-\pi\log(2) $$


$$ \begin{align} \log(\sin(x)) &=\log\left(\frac{e^{ix}-e^{-ix}}{2i}\right)\tag{1a}\\ &=+ix-\log(2)-i\pi/2+\log(1-e^{-2ix})\tag{1b}\\ &=-ix-\log(2)+i\pi/2+\log(1-e^{+2ix})\tag{1c}\\ &=-\log(2)-\sum_{k=1}^\infty\frac{\cos(2kx)}{k}\tag{1d} \end{align} $$ Explanation:
$\text{(1a)}$: $\sin(x)=\frac{e^{ix}-e^{-ix}}{2i}$
$\text{(1b)}$: bring $e^{+ix}$ and $+\frac1{2i}$ out of the log
$\text{(1c)}$: bring $e^{-ix}$ and $-\frac1{2i}$ out of the log
$\text{(1d)}$: use $\log(1-x)=-\sum\limits_{k=1}^\infty\frac{x^k}k$ while averaging $\text{(1b)}$ and $\text{(1c)}$


$$ \begin{align} \log(\cos(x)) &=\log\left(\frac{e^{ix}+e^{-ix}}2\right)\tag{2a}\\ &=+ix-\log(2)+\log(1+e^{-2ix})\tag{2b}\\ &=-ix-\log(2)+\log(1+e^{+2ix})\tag{2c}\\ &=-\log(2)+\sum_{k=1}^\infty(-1)^{k-1}\frac{\cos(2kx)}{k}\tag{2d} \end{align} $$ Explanation:
$\text{(2a)}$: $\cos(x)=\frac{e^{ix}+e^{-ix}}2$
$\text{(2b)}$: bring $e^{+ix}$ and $\frac12$ out of the log
$\text{(2c)}$: bring $e^{-ix}$ and $\frac12$ out of the log
$\text{(2d)}$: use $\log(1+x)=\sum\limits_{k=1}^\infty(-1)^{k-1}\frac{x^k}k$ while averaging $\text{(2b)}$ and $\text{(2c)}$

Solution 3:

$\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\dsc}[1]{\displaystyle{\color{red}{#1}}} \newcommand{\expo}[1]{\,{\rm e}^{#1}\,} \newcommand{\fermi}{\,{\rm f}} \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{{\rm i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\Li}[1]{\,{\rm Li}_{#1}} \newcommand{\norm}[1]{\left\vert\left\vert\, #1\,\right\vert\right\vert} \newcommand{\pars}[1]{\left(\, #1 \,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}} \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,} \newcommand{\sech}{\,{\rm sech}} \newcommand{\sgn}{\,{\rm sgn}} \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}} \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$ \begin{align}&\dsc{\sum_{k\ = 0}^{n}\exp\pars{2ky\ic}} =\sum_{k\ = 0}^{n}\bracks{\exp\pars{2y\ic}}^{k} ={1 - \exp\pars{\bracks{n + 1}\bracks{2y\ic}} \over 1 - \exp\pars{2y\ic}} \\[5mm]&={\exp\pars{-y\ic} - \exp\pars{\bracks{2n + 1}y\ic}\over \exp\pars{-y\ic} - \exp\pars{y\ic}} =\dsc{\half\,\ic\,{\exp\pars{-y\ic} - \exp\pars{\bracks{2n + 1}y\ic} \over \sin\pars{y}}} \end{align}

We'll take the imaginary part in both members: \begin{align}&\sum_{k\ = 1}^{n}\sin\pars{2ky} =\half\,\cot\pars{y} - {\cos\pars{\bracks{2n + 1}y} \over 2\sin\pars{y}} \end{align}

With $\ds{0 < x \leq {\pi \over 2}}$, integrate in both members over $\ds{\pars{x,{\pi \over 2}}}$: \begin{align}&\sum_{k\ = 1}^{n} {-\cos\pars{2k\bracks{\pi/2}} + \cos\pars{2kx} \over 2k} =\left.\half\,\ln\pars{\sin\pars{y}}\right\vert_{x}^{\pi/2} -\half\int_{x}^{\pi/2}{\cos\pars{\bracks{2n + 1}y} \over \sin\pars{y}}\,\dd y \end{align}

Then, \begin{align}-\ \overbrace{\sum_{k\ = 1}^{n}{\pars{-1}^{k}\over k}} ^{\dsc{-\ln\pars{2}}} +\sum_{k\ = 1}^{n}{\cos\pars{2kx} \over k} =-\ln\pars{\sin\pars{x}} -\int_{x}^{\pi/2}{\cos\pars{\bracks{2n + 1}y} \over \sin\pars{y}}\,\dd y \end{align}

We'll take the limit $\ds{n \to\ \infty}$: \begin{align}\ln\pars{\sin\pars{x}}&= -\ln\pars{2} - \sum_{k\ = 1}^{\infty}{\cos\pars{2kx} \over k}\ -\ \underbrace{\lim_{n\ \to\ \infty} \int_{x}^{\pi/2}{\cos\pars{\bracks{2n + 1}y} \over \sin\pars{y}}\,\dd y}_{\ds{=}\ \dsc{0}} \end{align}

$$ \color{#66f}{\large\ln\pars{\sin\pars{x}}}= \color{#66f}{\large-\ln\pars{2} - \sum_{k\ = 1}^{\infty}{\cos\pars{2kx} \over k}} \,,\qquad x \in \left(\, 0,{\pi \over 2}\,\right]\tag{1} $$ Indeed $\ds{\large\it\mbox{it's still valid}}$ in $\pars{0,\pi}$ $\ds{\pars{~\color{#00f}{\sf\mbox{see below}}~}}$

When $\ds{x \in \pars{{\pi \over 2},\pi}}$: \begin{align} \ln\pars{\sin\pars{x}}&=\ln\pars{\sin\pars{\pi - x}} =-\ln\pars{2} - \sum_{k\ = 1}^{\infty}{\cos\pars{2k\bracks{\pi - x}} \over k} \\[5mm]&=-\ln\pars{2} - \sum_{k\ = 1}^{\infty}{\cos\pars{2kx} \over k} \end{align} such that $\pars{1}$ is valid in $\pars{0,\pi}$.