$\ln|\sin(\frac{x}{2})| = -\ln2 + \sum_{n=1}^{\infty} \frac{\cos{nx}}{n}$ where $x\neq2k\pi$ for any integer k.
I'd like to find $a_n$ and here is my stuck.
\begin{align*} \frac{1}{\pi}\int_{-\pi}^{\pi}\ln|\sin\frac{x}{2}|\cos(nx)dx &= \frac{2}{\pi}\int_{0}^{\pi}\ln(\sin\frac{x}{2})\cos(nx)dx\\ &= \frac{2}{\pi}\Big[2\int_0^\frac{\pi}{2}\ln(\sin(x))\cos(2nx)dx\Big]\\ &= \frac{4}{\pi}[\frac{1}{2n}\sin(2nx)\ln(\sin(x))\Big|_0^\pi - \frac{1}{2n}\int_{0}^{\pi}\sin(2nx)\cot(x)dx]\\ &= \frac{4}{\pi}(-\frac{1}{2n}\Big[\sin(2nx)\ln(\sin(x))\Big|_0^\pi - 2n\int_0^\pi \ln(\sin(x))\cos(2nx)dx\Big])\\ &= \frac{4}{\pi}\int_0^\pi \ln(\sin(x))\cos(2nx)dx \end{align*}
And it seems I'm back to square one. Plese give me a hint.
Recall the Riesz-Fischer theorem (and of course your function is measurable) lets us find the $n$-th Fourier coefficient under the assumption that the Fourier series converges in $L^2$. We can find the $n$-th coefficient, call it $F_n$ by: \begin{equation*} F_n = \frac{1}{2\pi} \int_{-\pi}^{\pi}f(x)e^{-inx}dx \end{equation*}
I understand this integral may be disgusting (and perhaps impossible) to calculate but there may be some simplifications to be had. But something to think about regardless.