# Confusion about Fourier sine/cosine series

So I'm practicing some Fourier series problems and I've stumbled upon this:

For a function: $$f(x)=x\cdot sgn(\sin(2x)) \quad \quad \text{where } x \in(0, \pi)$$

(a) Write a function as a Fourier sine series on the interval $$(-\pi, \pi)$$

(b) Write a function as a Fourier cosine series on the inverval $$(-\pi, \pi)$$

At the time I had no idea what Fourier sine/cosine series was (just knew what a Fourier series was in general). Then I googled it and and found a couple of definitions which state the following:

1. If a function is odd then $$a_n=0$$ and the Fourier series collapses to $$f(x)=\sum_{n=1}^{\infty}b_n\sin(nx)$$
2. If a function is even then $$b_n=0$$ and the Fourier series collapses to $$f(x) = \frac{a_0}{2}+\sum_{n=0}^{\infty}a_n\cos(nx)$$

I guess it's obvious what my confusion is here. How does the problem expect me to write both for the same function, since the function is either even or odd? What I've managed to do so far is to convert the function to a piecewise form:

$$f(x)=\begin{cases} 0 ,& x = \frac{\pi}{2} \\ x, & x \in(0, \frac{\pi}{2})\\ -x & x \in(\frac{\pi}{2},\pi) \end{cases}$$

And from here I'd have no problem finding the Fourier series in general, but that's not what's asked here.

So any ideas on what is meant here?

Thanks.

How does the problem expect me to write both for the same function, since the function is either even or odd?

You basically make an even or odd extension of the function from where it is defined on a given interval, corresponding to the cosine or sine series respectively. This inherently makes the function in consideration even or odd (on the interval given at least).

Let $$f$$ be our function on an interval $$[0,L]$$. Then we extend $$f$$ to $$[-L,L]$$ by letting $$f(x) = f(-x)$$ (for the even extension) or $$f(x) = -f(-x)$$ (for the odd extension). For clarity's sake, $$x \in [-L,0]$$ for these, and thus $$-x \in [0,L]$$ (thus borrowing from the function's definition on the original interval).

We sometimes also just "periodically extend" the function without regard to even/odd-ness. So we don't bother with this interval $$[-L,0]$$ really and just start extending from there.

And then we just let this be extended periodically to the whole real line, sort of a "copy and paste" of it from $$[-L,L]$$ or $$[0,L]$$ to each period of length $$2L$$ or $$L$$. On $$[-L,L]$$ the function will be odd or even depending on how the function is constructed, thus why it is called an even or odd extension (since you extend that bite to the rest of the number line).

These essentially correspond to certain reflections of the function. An example of how these extensions look for $$f(x) = x$$ with $$x \in (0,2)$$. • I understand what you're saying in theory, but I'm still having trouble applying it to an actual function (for instance the one I've used in the question). Would you be able to provide an example to how an even/odd extension would affect the piecewise form of a function (any example, doesn't have to be the one I provided), as long as the function is indeed piecewise? Thanks. – Koy Jan 21 at 11:19
• What do you mean by "form"? Simply how it looks, e.g. its graph? – Eevee Trainer Jan 21 at 11:20
• No, not the graph. I am able to graph the function. The actual piecewise expression, like the one I've written. What confuses me is whether I'd have more intervals (for example -pi to -pi/2 and then -pi/2 to zero and then 0 to pi/2 etc..) or can it be simplified in some way. – Koy Jan 21 at 11:22