Respuesta :

Assuming you want the cosine series expansion over an arbitrary symmetric interval [tex][-L,L][/tex], [tex]L\neq0[/tex], the cosine series is given by

[tex]f_C(x)=\dfrac{a_0}2+\displaystyle\sum_{n\ge1}a_n\cos nx[/tex]

You have

[tex]a_0=\displaystyle\frac1L\int_{-L}^Lf(x)\,\mathrm dx[/tex]
[tex]a_0=\dfrac1L\left(\dfrac{x^2}2-\dfrac{x^3}3\right)\bigg|_{x=-L}^{x=L}[/tex]
[tex]a_0=\dfrac1L\left(\left(\dfrac{L^2}2-\dfrac{L^3}3\right)-\left(\dfrac{(-L)^2}2-\dfrac{(-L)^3}3\right)\right)[/tex]
[tex]a_0=-\dfrac{2L^2}3[/tex]

[tex]a_n=\displaystyle\frac1L\int_{-L}^Lf(x)\cos nx\,\mathrm dx[/tex]

Two successive rounds of integration by parts (I leave the details to you) gives an antiderivative of

[tex]\displaystyle\int(x-x^2)\cos nx\,\mathrm dx=\frac{(1-2x)\cos nx}{n^2}-\dfrac{(2+n^2x-n^2x^2)\sin nx}{n^3}[/tex]

and so

[tex]a_n=-\dfrac{4L\cos nL}{n^2}+\dfrac{(4-2n^2L^2)\sin nL}{n^3}[/tex]

So the cosine series for [tex]f(x)[/tex] periodic over an interval [tex][-L,L][/tex] is

[tex]f_C(x)=-\dfrac{L^2}3+\displaystyle\sum_{n\ge1}\left(-\dfrac{4L\cos nL}{n^2L}+\dfrac{(4-2n^2L^2)\sin nL}{n^3L}\right)\cos nx[/tex]