[Math] Applying Fourier series for $|\sin x|$

fourier series

Why when we apply Fourier series for $|\sin x|$ from $0 < x < \pi$ , we set $2L = 2\pi$?

Shouldn't it be $2L = \pi$?

In Schaum's Outline of Advanced Calculus book, there's a question that says:

"Expand $f(x) = \sin x, 0 < x < \pi$, in a Fourier cosine series.

A Fourier series consisting of cosine terms alone is obtained only for an even function. Hence, we extend the definition of $f(x)$ so that it becomes even. With this extension, $f(x)$ is then defined in an interval of length $2\pi$. Taking the period as $2 \pi$, we have $2L = 2\pi$ so that $L = \pi$."

Best Answer

Given a function $f\!: x\mapsto f(x)$ on some interval $I$ of length $L>0$ one obtains its Fourier expansion by extending $f$ to all of ${\mathbb R}$ periodically using the given $L$ as period length. The coefficients of the Fourier series should then be computed using the standard formulae for period length $L$ and integrating over the interval $I$ where the function $f$ was given in the first place.

In the case at hand we have $I=[0,\pi]$ and $L=\pi$, and the standard formulae give

$$a_k={2\over\pi}\int_0^\pi \sin x \cos(2 k x)\ dx,\qquad b_k={2\over\pi}\int_0^\pi \sin x \sin(2 k x)\ dx.$$

Now there is the extra condition that we want only $\cos$-terms. In order to enforce this we must make sure that the periodically extended function is even. But here we are lucky: As $\sin(\pi -x)\equiv \sin x$ the extended function is even automatically. This means that in the above formulae the $b_k$ are all zero, and there remains nothing to be done apart from calculating the integrals for $a_k$.

It would be another matter if the given function would not have this symmetry with respect to $x\mapsto \pi -x$, as in the case of $g(x):=\sin{x\over 2}$ $(0 < x <\pi)$. In this case it would be necessary to extend $g$ first to an even function on the interval $[-\pi,\pi]$, whereupon the standard formulae for period length $2\pi$ can be applied to compute the $a_k$.