Proving the Fourier equation: $\frac{1}{2} L - x = \frac{L}{\pi}\sum^\infty_{n=1}\frac{1}{n} \sin\frac{2n\pi x}{L}$ The following question is about Fourier series, specifically about extension of the Fourier Series to arbitrary intervals:
"Show that:
$$\frac{1}{2} L - x = \frac{L}{\pi}\sum^\infty_{n=1}\frac{1}{n} \sin\frac{2n\pi x}{L},\quad 0<x<L$$"
The question also came with the following hint:
"Note that the series on the right-hand side has the period L. Therefore, it should be viewed as a Fourier series on an interval of length L; in this case, it is $[0, L]$. Think about how
to reduce this scenario into those we have discussed before (e.g. the classic case on $[-\pi, \pi])$ by a suitable change of variable"
I thought to use the change of variable: $t = \frac{2 \pi x}{L} - \pi$, so that as x runs from $0$ to $L$, $t$ runs from $-\pi$ to $\pi$.
After substituting in the variable, the right-hand side reduced to:
$$\frac{L}{\pi}\sum^\infty_{n=1}\frac{1}{n} \sin(nt + n\pi),\quad -\pi<t<\pi$$
Furthermore, since:
\begin{align*}
\sin(nt + n\pi) &= \sin(nt)\cos(n\pi) + \cos(nt)\sin(n\pi)\\
&= \sin(nt)(-1)^n + 0 \quad \text{since n is an integer}
\end{align*}
Hence, the above expression simplifies to:
$$\frac{L}{\pi}\sum^\infty_{n=1}\frac{(-1)^n}{n} \sin(nt),\quad -\pi<t<\pi$$
I got stuck here. I'm not sure if there is some identity that is just evading me so that this reduces to the desired expression $\frac{1}{2}L - x$, and if not, I'm not sure how to get from here to the required expression.
Any help would be appreciated, thank you!
 A: It comes to the expansion of $f(x)=L/2-x$ which is periodic with a period of $L$ in to a fourier series:
$$F(x)A_0/2+\sum_{1}^{n} [A_n\cos(2 n\pi x/L)+B_n \sin(2n\pi x/L)].~~~~(1)$$
Where $A_n=\frac{2}{L} \int_{0}^{L} f(x) \cos(2n\pi x/L) dx,~~ B_n=\frac{2}{L} \int_{0}^{L} f(x) \sin(2n\pi x/L) dx$
The integration by parts gives
$$A_n=\frac{2}{L} \int_{0}^{L} (L/2-x) \cos(2n\pi x/L) dx=\frac{L(1-\cos 2 n \pi)-n\pi \sin 2n \pi}{2 \pi^2 n^2}=0, n\in I ~~~~(2)$$
as $\cos 2n \pi=1, \sin 2n \pi =0.$
Next $$B_n=\frac{2}{L} \int_{0}^{L} (L/2-x) \sin(2n\pi x/L) dx=\frac{L \cos(n\pi)}{n^2\pi^2}[n\pi \cos (n \pi)-\sin(n\pi)]=\frac{L}{n\pi}~~~~(3),$$
as $\cos(n\pi)=(-1)^n$ and $\sin n \pi =0$.
So finally, putting (2,3) in (1), we have
$$\frac{L}{2}-x=\frac{L}{\pi}\sum_{n=1}^{\infty} \frac{\sin (2n \pi x/L)}{n}.$$
A: $$f(x)=\Im \frac{L}{\pi} \sum_{n=1}^{\infty} \frac{e^{2in\pi x/L}}{n}=-\Im\frac{L}{\pi}\ln[1-e^{2i \pi x/L}]=-\Im \left (\frac{L}{\pi} \ln [e^{-i\pi x/L}-e^{i  \pi x/L}]+\frac{L}{\pi} \ln e^{i\pi x/L}\right)$$
$$\implies f(x)=-\Im\frac{L}{\pi} \ln(-2i\sin \pi x L)+ix]=\frac{L}{2}-x.$$
Here, we have used $\sum_{n=1}^{\infty} \frac{z^n}{n}=-\ln(1-z), |z| \le 1$ and $e^{iz}-e^{-iz}=2i\sin z$
