# Applying Fourier series for $|\sin x|$

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$."

-
Where did you see this? – J. M. Dec 6 '11 at 12:27
The title says "in", the body says "for" -- which do you mean? – joriki Dec 6 '11 at 12:27
Have you tried sketching $\sin x$ and $|\sin x|$ from $0$ to $2\pi$? – Dilip Sarwate Dec 6 '11 at 12:51
@J.M. I've edited the question for more clarification. Thanks. – Rafael Adel Dec 6 '11 at 13:01
Tsk. Your first formulation was sloppy in that you neglected to mention the "cosine series" part. You know that $|\sin\,x|$ isn't even within the restricted interval, so you make a reflection about the vertical axis. What now is the period of this new function? – J. M. Dec 6 '11 at 13:05

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$.

-

Your title for the question is somehow strange to me. People usually say "find" the Fourier series of a function instead of "apply". $2L=2\pi$ is just for notation convenience. If you don't know why people write $2L=2\pi$ instead of $2L = \pi$, the best way for understanding is to do a problem on your own.

Usually, on the symmetric interval $[-L,L]$, we would be interested in the Fourier series of a function $f$. On the interval $[0,L]$, we have the Fourier sine (resp. cosine) series of a function $f$ when we do the odd (resp. even) extension. (Of course, $f$ here is under some assumptions.)

For reference of this topic, try Stein and Shakarchi's Fourier Analysis, an Introduction.

-