How to find the Fourier series of $f(x)=x$? I got a question which is too simple: Find the Fourier series of $f(x)=x$ in the interval $[-\pi,\pi]$ and show that this function doesn't converge to its Fourier series.
I found the series as 
$$\sum_{n=1}^{\infty}\frac{2\cdot(-1)^{n+1}}{n}\sin(nx)$$
How do we show the second part? Is it because
$$\lim_{x\to \pi}x = \pi \ne 0 = \sum_{n=1}^{\infty}\frac{2\cdot(-1)^{n+1}}{n}\sin(n\cdot0) \; \; ?
$$
 A: I think you mean that the Fourier series does not converge to the function on $[-\pi,\pi]$.
The Fourier series does converge (pointwise) to $f(x)=x$ on $(-\pi,\pi)$. The issue is at the endpoints. 
First, $f$ is an odd function on a symmetric interval about the origin. Hence, its (full) Fourier series will in fact be a Fourier sine series (think about why). And this Fourier sine series will converge to the periodic extension of $f$.
Second, since $f$ is piecewise smooth, the Fourier (sine) series of $f$ will converge at $x=a$ to the average of the left and right hand limits of $f$ at $x=a$, i.e. to
$$
{f(a^+)+f(a^-)\over 2}.
$$
Note that if $f$ is continuous at $x=a$, this is just $f(a)$.
Finally, putting these two facts together we see that at $f(\pi^+)=-\pi$, $f(\pi^-)=\pi$ so the Fourier (sine) series converges to $0$ at $x=\pi$. But $f(\pi)=\pi$. So the Fourier series does not converge pointwise to $f(x)$ at $x=\pi$.
The same goes for $x=-\pi$. Hence the Fourier sine series does not converge to $f(x)$ on $[-\pi,\pi]$ (but it does on $(\pi,\pi)$).
