# Fourier Series

##### Member
Find the Fourier cosine series of $$\displaystyle cos(x)$$ from $$\displaystyle x=0 ~to ~\pi$$

Here the Fourier series is given by
$$\displaystyle f(x)=\frac{1}{2}a_0+\sum_{n=1}^{\inf}a_n cos nx dx$$ where $$\displaystyle a_n=\frac{2}{\pi}\int_0^\pi f(x)cos nx dx$$

I am facing problem to solve it. I am getting $$\displaystyle a_0=0$$ and $$\displaystyle a_n=0$$ so the Fourier series becomes identically zero.

#### lfdahl

##### Well-known member
Are you sure, that $a_n=0$ for $n=1$?

##### Member
Are you sure, that $a_n=0$ for $n=1$?
Ohh sorry, $$\displaystyle a_n=1~ for ~n=1, a_n=0$$ otherwise

Then fourier cosine series for cosx is cosx?

#### lfdahl

##### Well-known member
Ohh sorry, $$\displaystyle a_n=1 for n=1, a_n=0$$ otherwise

Then fourier cosine series for cosx is cosx?
Yes #### Deveno

##### Well-known member
MHB Math Scholar
One thing often not touched upon in Fourier analysis is that the set of functions

$\{f: [-\pi,\pi] \to \Bbb R\}$ that are integrable form a vector space:

$(f+g)(x) = f(x) + g(x)$

And multiply them by a real number:

$(cf)(x) = c \cdot f(x)$

Furthermore, the definite integral:

$$\displaystyle \int_{-\pi}^{\pi}f(x)g(x)\ dx$$

satisfies all the requirements of an inner product.

Now, it is a difficult theorem to show that:

$\{1,\cos(x),\sin(x),\cos(2x),\sin(2x),\dots,\cos(nx),\sin(nx),\dots\}$

forms a basis for this vector space, but it is somewhat easier to show it is a basis for the subset of such functions that have a Fourier series, and it turns out that this basis (sometimes the scalar multiple of 1 is modified for cleaner formulas) is orthogonal with respect to this inner product. This means that the "coordinates" of these vectors (functions) are the projections of the functions onto their orthogonal basis vectors, and that is precisely what the Fourier coefficients ARE

(just like with "normal vectors" the $j$-th coordinate of:

$v = (v_1,\dots,v_n)$ is $v\cdot e_j = v_j$, where $e_j = (0,\dots,1,\dots,0)$ with all 0's except for a 1 in the $j$-th place).

As such, from the uniqueness of the linear combination of basis elements for any vector, we have that the Fourier series of $\cos(nx)$ is $\cos(nx)$ and similarly the Fourier series of $\sin(nx)$ is also $\sin(nx)$, with no actual need to compute the Fourier coefficients.

A neat trick:

Evaluate the Fourier series for $x^2$ on $[-\pi,\pi]$ at $x = \pi$ to conclude that:

$\zeta(2) = \dfrac{\pi^2}{6}$

(the zeta function is defined by: $$\displaystyle \zeta(s) = \sum_{n = 1}^{\infty} \frac{1}{n^s}$$ for any complex number $s$ with real part > 1).