I'm currently using Strauss's partial differential equations book and there is something that confuses me. The Fourier series of $f(x)=x$ on $(0,l)$ is not the same on $[0,l]$.
For $(0,l)$ the Fourier series is $$x=\frac{2l}{\pi} \sum_{n=1}^{\infty} \frac{(-1)^{n+1}}{n}\text{sin}\left(\frac{n\pi x}{l}\right)$$ For $[0,l]$ the Fourier series is $$x=\frac{l}{2}-\frac{4l}{\pi^{2}}\sum_{n=1,3,5,...}\text{cos}\left(\frac{n\pi x}{l}\right)\frac{1}{n^{2}}$$
Why $(0,l)$ has sine series but $[0,l]$ has cosine series?