<s>[INST] Fourier series of $f(x)=\pi-x$ $$f(x)=\pi-x \qquad x \in [0,2 \pi[$$

$$a_0=\frac{1}{\pi} \ \int_0^{2 \pi}f(x) \ dx=\frac{1}{\pi} \ \int_0^{2 \pi} (\pi-x) \ dx=0$$

$$a_n=\frac{1}{\pi} \ \int_0^{2 \pi} \cos(nx) \ dx=\frac{1}{\pi} \ \int_0^{2 \pi}(\pi \ \cos(nx)-x \ \cos(nx)) \ dx=$$
$$\frac{1}{\pi} \ \Big( \ \Big[\frac{\pi}{n} \ \sin(nx) \Big]_0^{2 \pi}-\Big[\frac{x}{n} \ \sin(nx)+\frac{1}{n^2} \ \cos(nx) \Big]_0^{2 \pi} \Big)=0 $$

$$b_n=\frac{1}{\pi} \ \Big( \ \Big[\ -\frac{\pi}{n} \ \cos(nx) \Big]_0^{2 \pi}-\Big[-\frac{x}{n} \ \cos(nx)+\frac{1}{n^2} \ \sin(nx) \Big]_0^{2 \pi} \Big)=\frac{2}{n}$$

$$f(x)=2 \sum_{n=1}^{+\infty} \frac{1}{n} \ \sin(nx)$$
Is it correct?
 [/INST] Slight errors: 
$$
\begin{align}
%
  a_{0} &= \frac{1}{\pi} \int_{-\pi }^{\pi } f(x) \, dx = 2\pi \\[5pt]
%
  b_{k} &= \frac{1}{\pi } \int_{-\pi }^{\pi } f(x) \sin (k x) \, dx = (-1)^k \frac{2}{k \pi}
%
\end{align}
$$
The decay of the amplitudes is linear:

The series expansion looks like
$$
 \pi - x = \pi - 2 \sin (x) + \sin (2x) - \frac{2}{3} \sin (3x) + \frac{1}{2} \sin \left( 4x \right) - \dots
$$
Convergence sequence:




</s>