Fourier series

A Fourier series is an expansion of periodic function into an infinite sum of sines or cosines. In general, any well behaved periodic function can be written as a Fourier series.

Consider a function f(x)f(x) with period LL. We can write it as an infinite sum

f(x)=m=1Amsin(mπxL).(1) f(x) = \sum_{m=1}^\infty A_m \sin\left(\frac{m\pi x}{L}\right). \tag{1}

We use the orthogonality of the sine and cosine functions, which states

0Lsin(mπxL)sin(nπxL)dx={L2if m=n0otherwise. \int_0^L \sin\left(\frac{m\pi x}{L}\right) \sin\left(\frac{n\pi x}{L}\right) dx = \begin{cases} \frac{L}{2} & \text{if } m=n \\ 0 & \text{otherwise}. \end{cases}

(the above holds for cos\cos as well).

We multiply both sides of (1) by sin(nπxL)\sin\left(\frac{n\pi x}{L}\right) for some arbitrary integer nn and integrate.

0Lsin(nπxL)f(x)dx=0LmAmsin(mπxL)sin(nπxL)dx. \begin{align*} \int_0^L \sin\left(\frac{n\pi x}{L}\right) f(x) dx &= \int_0^L \sum_m^\infty A_m \sin\left(\frac{m\pi x}{L}\right) \sin\left(\frac{n\pi x}{L}\right) dx. \end{align*}

We can change the order of the sum and integral on the right. We then notice that for all mnm \ne n, the integral is zero; so only the m=nm=n term of the sum remains. By orthogonality we know the value of the integral.

0Lsin(nπxL)f(x)dx=AnL22L0Lsin(nπxL)f(x)dx=An. \begin{align*} \int_0^L \sin\left(\frac{n\pi x}{L}\right) f(x) dx &= \frac{A_n L}{2} \\ \frac{2}{L} \int_0^L \sin\left(\frac{n\pi x}{L}\right) f(x) dx &= A_n. \end{align*}

We have found the amplitudes. Plugging in to (1) and setting n=mn=m we get our Fourier series.

f(x)=m=12Lsin(mπxL)x=0Lsin(mπxL)f(x)dx. f(x) = \sum_{m=1}^\infty \frac{2}{L} \sin\left(\frac{m\pi x}{L}\right) \int_{x'=0}^L \sin\left(\frac{m\pi x'}{L}\right) f(x') dx'.

Note we write the integration variable as xx' to distinguish it from the parameter f(x)f(x). The prime does not denote a derivative here.