Fourier series of $[x]-x+\frac{1}{2}$: Rigorous justification. 
We have the Fourier series 
  $$ [x]-x+\frac{1}{2} = \sum_{n=1}^\infty \frac{\sin 2 \pi n x }{n \pi }. $$ 
  where $x$ is not an integer. 

How is this rigorously justified? Are there any references?

My thoughts:


*

*We suppose $f(x)$ can be written in the form  $\sum_{k=1}^\infty c_k \sin 2 \pi k x$  and the series is locally uniformly convergent, as $f$ is $1$-periodic, we have


$$ \int_0^1 f(x) \sin 2 \pi n x =  c_n \int_0^1 (\sin 2  \pi n x )^2 \, dx = \frac{c_n}{2} \Rightarrow c_n = \frac{1}{n \pi }$$  
 A: $f(x)=\lfloor x\rfloor -x-\frac{1}{2}$ is a $1$-periodic function with a Fourier sine series given by
$$\lfloor x\rfloor -x-\frac{1}{2} \stackrel{L^2}{=} \sum_{n\geq 1}\frac{\sin(2\pi nx)}{n\pi}\tag{1} $$
since $2\int_{0}^{1}f(x)\sin(2\pi n x)\,dx = \frac{1}{n\pi}$. On the other hand the RHS of $(1)$ is pointwise convergent for any $x\not\in\mathbb{Z}$ by summation by parts, since
$$ \left|\sum_{n=1}^{N}\sin(2\pi n x)\right|=\left|\frac{\sin(\pi N x)\sin(\pi(N+1)x)}{\sin(\pi x)}\right|\leq\left|\cot\frac{\pi x}{2}\right|\tag{2}$$
hence the RHS of $(1)$ is pointwise convergent for any $x\not\in\mathbb{Z}$.
The convergence on $\mathbb{R}\setminus\mathbb{Z}$ is not uniform due to Gibbs phenomenon.
However $(2)$ gives that $\sum_{n\geq 1}\frac{\sin(2\pi nx)}{\pi n}$ is uniformly convergent over any interval of the form $I_a=[a+\varepsilon,a+1-\varepsilon]$ for $a\in\mathbb{Z}$. A uniformly convergent series of continuous functions gives a continuous function, hence over $I_a$ we have
$$ \sum_{n\geq 1}\frac{\sin(2\pi nx)}{\pi n} \stackrel{\text{unif.}}{=} g(x) \in C^0(I_a) \tag{3}$$
and by $(1)$ it follows that $\int_{I_a}(f(x)-g(x))^2\,dx = 0$. Since $f(x)\in C^0(I_a)$ it follows that $g(x)\equiv f(x)$, hence the convergence given by $(1)$ is also a pointwise convergence over $\mathbb{R}\setminus\mathbb{Z}$.
This is just the Fourier series of a Bernoulli polynomial.
A: It's probably easier to recall that:
$$\ln(re^{i\theta})=\ln(r)+i\theta$$
$$-\ln(1-e^{i\theta})=\sum_{n=1}^\infty\frac{e^{in\theta}}n=\sum_{n=1}^\infty\frac{\cos(n\theta)+i\sin(n\theta)}n$$
Now take imaginary parts:
$$\sum_{n=1}^\infty\frac{\sin(n\theta)}n=\Im(-\ln(1-e^{i\theta}))=\dots$$
Assuming $\theta\in(0,2\pi)$.  For $\theta\notin(0,2\pi)$, it results in a periodic like function...
