A Fourier series exercise Can anyone give me a hand with this exercise about Fourier series?
Let $f(x)=-\log|2\sin(\frac{x}{2})|\,\,\,$ $0\lt|x|\leq\pi$
1) Prove that f is integrable in $[-\pi,\pi]$.
2) Calculate the Fourier coefficients of $f$.
3)The Fourier series converge to $f$?
$------------------$
What I know:
About part 2, as f is even, then it would be enough to calculate the "$a_n$" coefficients of the series. That is, the $\int_{-\pi}^{\pi}f(x)cos(nx)$. This integrals can be done integrating by parts, I think. (am I right?)
My problems are part 1 and 3, I don't see how to prove them. Thanks for any help.
EDIT: Also, i met a problem at part 2. Calculating $a_n$, i arrive at a point where i need to find the value of $\int_{0}^{\pi}cotag(\frac{x}{2})sin(nx)$. I know (checked it numerically) that the value of this integral is $\pi$ for any natural $n$. But I can't find a way to prove this "by hand", as integration by parts doesn't seem to work here... Any ideas?
 A: Rather large hint:
$$
\begin{align}
-\int_{-\pi}^\pi\log|2\sin(x/2)|\cos(nx)\,\mathrm{d}x
&=-\int_{-\pi}^\pi\log|\sin(x/2)|\cos(nx)\,\mathrm{d}x\\
&=-\frac1n\int_{-\pi}^\pi\log|\sin(x/2)|\,\mathrm{d}\sin(nx)\\
&=-\frac1n\int_{-\pi/2}^{\pi/2}\log|\sin(x)|\,\mathrm{d}\sin(2nx)\\
&=\frac1n\int_{-\pi/2}^{\pi/2}\sin(2nx)\,\mathrm{d}\log|\sin(x)|\\
&=\frac1n\int_{-\pi/2}^{\pi/2}\frac{\sin(2nx)}{\sin(x)}\,\mathrm{d}\sin(x)\\
&=\frac1n\int_{-\pi/2}^{\pi/2}\sum_{k=1}^n2\cos((2k-1)x)\cos(x)\,\mathrm{d}x\\
&=\frac1n\int_{-\pi/2}^{\pi/2}\sum_{k=1}^n\big(\cos((2k-2)x)+\cos(2kx)\big)\,\mathrm{d}x\\
&=\frac\pi n
\end{align}
$$
The case $\boldsymbol{n=0}$:
In this answer, I show that
$$
\int_0^\pi\log(\sin(x))\,\mathrm{d}x=-\pi\log(2)
$$
thus,
$$
\begin{align}
-\int_{-\pi}^\pi\log|2\sin(x/2)|\,\mathrm{d}x
&=-2\int_{-\pi/2}^{\pi/2}\log|2\sin(x)|\,\mathrm{d}x\\
&=-2\pi\log(2)-2\int_0^\pi\log(\sin(x))\,\mathrm{d}x\\[6pt]
&=0
\end{align}
$$
A: Now that I've filled in the detail (as requested), this answer ought to completely resolve parts 2. and 3. (calculating the Fourier coefficients and demonstrating convergence of the Fourier series where the function is finite); part 1., integrability, seems to have been dealt with in the comments.

Another idea: 
$$
\begin{align}
-\log{|2\sin{(x/2)}|} &= -\log{|e^{ix/2} - e^{-ix/2}|} \\
& = -\log{|1 - e^{-ix}|} \\
& = \text{Re}\left\{-\log{(1 - e^{-ix})}\right\} \\
& = \text{Re}\left(\sum_{n = 1}^\infty \frac{e^{-inx}}{n}\right) \\
& = \sum_{n = 1}^\infty \frac{\cos{(nx)}}{n}.
\end{align}
$$
Since you put the homework tag, I'll let you justify these computations and analyze convergence. Just let me know if you would like more detail.

Here is a bit more detail, as requested in the comments—as I mentioned in my own comment, the above expansion follows at once from a standard result known as Abel's theorem, which is essentially what I'll prove here. I wish to justify the fact that the expansion
$$
-\log{(1-z)} = \sum_{n= 1}^\infty \frac{z^n}{n}
$$
is valid when $|z| = 1$, provided that $z\not = 1$. I'm going to take as given that the representation is valid for $|z|<1$ (this is easily derived when $z$ is real from the integral representation of the logarithm, and then follows for all $|z| < 1$ by the usual uniqueness theorems for analytic functions, of which, at least on the domain in question, $-\log{(1-z)}$ is one). I also note that
$$
\begin{align}
\sum_{n = 1}^N \frac{z^n}{n} & = \sum_{n = 1}^N \frac{1}{n}\left({z^n - z^{n+1}\over1-z}\right) \\
& = {z\over1-z} + {1\over1-z}\sum_{n = 2}^N\left({1\over n}-{1\over n-1}\right)z^n
\end{align}
$$
converges to a finite limit as $N \to +\infty$, provided that $|z|\leq1$ and $z\not = 1$. Now—and this part is essentially the proof of Abel's theorem—fix $x \not = 0$ and put $$s_n = \sum_{k = n}^\infty {e^{ikx}\over k},$$ so that $s_n - s_{n+1} = e^{inx}/n$ and $s_n \to 0$ as $n\to +\infty$. Then for $0<r<1$,
$$
\begin{align}
\sum_{n=1}^\infty {e^{inx}\over n} + \log{(1+ re^{ix})} & = \sum_{n= 1}^\infty {e^{inx}\over n} - \sum_{n = 1}^\infty {r^n e^{inx}}{n} \\
& = \sum_{n = 1}^\infty (1-r^n){e^{inx}\over n} \\
& = \sum_{n = 1}^\infty (1-r^n) (s_n - s_{n+1}) \\
& = \sum_{n = 1}^\infty (1-r^n)s_n - \sum_{n = 1}^\infty (1-r^n) s_{n+1} \\
& = (1-r)\sum_{n = 1}^\infty r^{n-1} s_n.
\end{align}
$$
But, if we put $S_N = \sup\{|s_n|:n > N\}$, then $S_0$ is finite and $S_N \to 0$ as $N\to +\infty$, and
$$
\begin{align}
\left|(1-r)\sum_{n = 1}^\infty r^{n-1} s_n\right| & \leq (1-r)\sum_{n = 1}^\infty r^{n-1}|s_n| \\
& \leq (1-r)S_0\sum_{n = 1}^N r^{n-1} + (1-r)S_N\sum_{n = N+1}^\infty r^{n-1} \\
& = (1-r)S_0 \sum_{n = 1}^N r^{n-1} + (1-r) S_N{r^N\over1-r}
\end{align}
$$
and the last expression plainly tends to $S_N$ in the limit $r\to 1^-$. Since $N$ was arbitrary, we get
$$
\begin{align}
\left|\sum_{n=1}^\infty {e^{inx}\over n} + \log{(1+ e^{ix})}\right| & = \lim_{r\to 1^-}\left|\sum_{n=1}^\infty {e^{inx}\over n} + \log{(1+ re^{ix})}\right| \leq \inf_{N\geq 0} S_N = 0.
\end{align}
$$
This proves that the expansion is valid.
