# Fourier series expansion of a periodic function

I'm trying to sketch several periods of the periodic function $f(x)$ below and expand it in an apporpriate Fourier series. I know there's a formula for expanding fourier series, but when I try I always get an error

$$f(x) = x^2,\,\, 0 < x < 10$$

-

Working purely formally, so not worrying about convergence and justifying the interchange of the summation and integration, suppose we have

$$x^{2}=\sum_{n=-\infty}^{\infty}{c_{n}e^{inx}}.$$

Then, recalling that $\frac{1}{\pi}\int_{-\pi}^{\pi}{e^{i(n-m)x}\ dx}=0$ if $n\neq m$ and $2$ otherwise, we can multiply each side of the expression by $e^{imx}$ and integrate, getting

$$\int_{-\pi}^{\pi}{x^{2}e^{imx}\ dx}=\sum_{n=-\infty}^{\infty}{\int_{-\pi}^{\pi}c_{-n}e^{i(m-n)x}\ dx}=2\pi c_{-m},$$

and so

$$c_{n}=\frac{1}{2\pi}\int_{-\pi}^{\pi}{x^{2}e^{-inx}\ dx}.$$

You can calculate this using integration by parts, and you'll find that

$$c_{n}=\frac{2((\pi^{2}n^{2}-2)\sin(\pi n)+2\pi n\cos(\pi n))}{n^{3}}.$$

At this point, notice that, as $n$ is always an integer, $\sin(\pi n)=0$ for each $n$, and $\cos(\pi n)=1$ if $n$ is even, $-1$ if $n$ is odd, i.e. $\cos(\pi n)=(-1)^{n}$. Then we have

$$c_{n}=\frac{4\pi n(-1)^{n}}{n^{3}}=\frac{4\pi(-1)^{n}}{n^{2}},$$

and so the Fourier series is

$$x^{2}=\sum_{n=-\infty}^{\infty}{\frac{4\pi(-1)^{n}}{n^{2}}e^{inx}}.$$

The only thing left to worry about now is convergence, which I suspect you aren't too bothered about. But just for the sake of giving a complete answer, $x^{2}$ is square-integrable on $[-\pi,\pi]$, and so Carleson's Theorem tells us that the Fourier series converges pointwise to $x^{2}$ for almost all $x$.

(In fact, as $\sin$ is an odd function, you'll be able to see that the series is actually just a sum of cosines)

-
Also sorry for being difficult, but I just noticed that I hadn't really read your question properly, and overlooked the fact that you want to look at its Fourier series on $[0,10]$ rather than $[-\pi,\pi]$. The method is very similar, hopefully you'll be able to see how to easily modify what I did to get the appropriate series. Essentially, you can just carry it over by using a change of variables to make the orthogonality relation hold for $[0,10]$ and then changing a couple of lines of working in what I did. I guess it'll be a good exercise for you! – user123123 Nov 5 '12 at 7:09