How is the fourier series of $\frac{\pi-x}2$ derived? $$S = \sum_{n=1}^{\infty} \frac{\sin(n)}{n} $$
I seem to have found on the web:
$$\frac{\pi-x}{2}=\sum_{n\geq1}\frac{\sin\left(nx\right)}{n} \space, x \in(0, 2\pi)$$
Then:
$$x = \pi - 2\sum_{n=1}^{\infty} \frac{\sin(nx)}{n}$$
How is this fourier series derived? Only hints please, no complete answers.
 A: $\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{\dd}{{\rm d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\dsc}[1]{\displaystyle{\color{red}{#1}}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{{\rm i}}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\Li}[1]{\,{\rm Li}_{#1}}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$
Besides the Brian Fitzpatrick nice answer, you can use the Abel-Plana Formula:
\begin{align}\color{#66f}{\large\sum_{n=1}^{\infty}\frac{\sin\pars{nx}}{n}}
&=-x + \bracks{\int_{0}^{\infty}\frac{\sin\pars{tx}}{t}\,\dd t
+\half\,\lim_{t \to 0}\frac{\sin\pars{tx}}{t}}
=-x + {\rm sgn}\pars{x}\,\frac{\pi}{2} + \half\,x
\\[5mm]&=\color{#66f}{\large\,{\rm sgn}\pars{x}\,\frac{\pi}{2} - \half\,x}
\end{align}
In the present case $\ds{\pars{~x \in \pars{0,2\pi}~}}$:
\begin{align}\color{#66f}{\large\sum_{n=1}^{\infty}\frac{\sin\pars{nx}}{n}}
&=\color{#66f}{\large\frac{\pi - x}{2}}\,,\qquad\qquad x \in \pars{0,2\pi}
\end{align}
A: This was worked out by computing to fourier series of the periodic continuation of $\frac{\pi-x}2$ from $(0,2\pi)$ to $\mathbb T$. Note that this function is discontinuous at $0 \equiv 2\pi$.
$$a_k = \frac1{2\pi} \int_0^{2\pi} \frac{\pi-x}2 e^{-ikx} \ \mathrm dx$$
Then by the Fourier-inversion thm.
$$\frac{\pi-x}2 = \sum_{k\in\mathbb Z} a_k e^{ikx}$$
At all points of continuity of $x$, i.e. for all $x\in (0,2\pi)$. Finally note that $\sin(kx) = \frac1{2i} (e^{ikx} - e^{-ikx})$ to bring this into the aforementioned form. What is left for you is to see that
$$a_k = \frac{1}{2ik} \forall k > 0,\quad a_0 = 0$$
A: Let $f$ be a $2\,L$ periodic function. The Fourier series of $f$ is defined as
$$
F(t)=a_0+\sum_{k=1}^\infty\left\{
a_k\cos\left(\frac{k\,\pi}{L}t
\right)
+
b_k\sin\left(\frac{k\,\pi}{L}t\right)
\right\}
$$
where the constants $a_0$, $a_k$, and $b_k$ are defined by the equations
\begin{align*}
a_0&=\frac{1}{2\,L}\int_{-L}^Lf(t)\,dt
&
a_k&=\frac{1}{L}\int_{-L}^Lf(t)\cos\left(\frac{k\,\pi}{L}t\right)\,dt
&
b_k&=\frac{1}{L}\int_{-L}^Lf(t)\sin\left(\frac{k\,\pi}{L}t\right)\,dt
\end{align*}
In our case we have the function
$$
f(t)=\frac{\pi-t}{2}
$$
defined on the interval $[0,2\,\pi]$. Here $L=\pi$.
Can you compute the coefficients $a_0$, $a_k$, and $b_k$?
