Fourier series of $f(x)=\pi -x$ for $x \in [0,2\pi]$

fourier analysisfourier seriesfourier transform

Consider the function

$$f(x)=\begin{cases} \pi -x, \quad0<x<2\pi\\ 0, \quad x=0,x=2\pi\end{cases}$$

I need to find the Fourier Series of $$f(x)=\pi -x, \quad x \in [0,2\pi].$$
First, we can expand the function in a $2\pi$-periodic defined on $\mathbb{R}$

The theory in my textbook is:

For a Reimann-integrable function $f:[-\pi,\pi] \rightarrow \mathbb{R}$. The Fourier series of f is:
$$ S[f](x)=\frac{a_0}{2}+ \sum_{k=1}^{\infty}(a_kcos(kx)+b_ksin(kx))$$
where
$$ a_k=a_k(f)=\frac{1}{\pi}\int_{-\pi}^{\pi}f(x)cos(kx)dx, \quad k=0,1,2, \dots$$
and
$$ b_k=b_k(f)=\frac{1}{\pi}\int_{-\pi}^{\pi}f(x)sin(kx)dx, \quad k=1,2, \dots$$

Now for $f(x)=\pi -x, \quad x \in [0,2\pi].$

My understanding is that i have to "transform" the function to be defined on $[-\pi,\pi]$ for my theory to work. But i can't see how i can do that.

Hint of the exercise: Make the function odd (symmetric around $0$).
Solution:$$ S[f](x)=2\sum_{k=1}^{\infty}\frac{sin(kx)}{k}$$

Sf=\frac{a_0}{2}+ \sum_{k=1}^{\infty}(a_kcos(kx)+b_ksin(kx))

Edit after answers in comments

We transform the original function:

$$f(x)=\begin{cases} \pi -x, \quad0<x<\pi\\ -x-\pi, \quad -\pi<x<0\end{cases}$$

The new function is odd so:
$$a_k=0$$
and
$$ b_k=b_k(f)=\frac{1}{\pi}\int_{-\pi}^{\pi}f(x)sin(kx)dx = \frac{2}{\pi}\int_{-\pi}^{\pi}(\pi-x)sin(kx)dx= \dots = \frac{2}{k}$$

So we have the result we wanted.

But the original function does not have the same graph as transformed one.
Is this a problem?

Best Answer

Your function $f(x)$ for $-\pi < x <0$ should be $\pi - (x+2\pi) = -\pi-x$ is already correct. Because you want $y$ to be the same as $\pi -x$ on $(\pi, 2\pi)$, but shifted $2\pi$ to the left to be on $(-\pi, 0)$.

Using your textbook's version of Fourier series, then the Fourier series is $2\pi$ periodic. So plotting your series using your computed coefficients $a_{k}$ and $b_{k}$, but for $x \in (0, 2\pi)$ will give the same as the original one. But if you plot the Fourier series on $(-\pi, \pi)$, of course it will be different. To give better understanding, try plot it from $(-10\pi, 10\pi)$ you will see repeated patterns.

Example of Periodic Extension capability of Fourier series (*img from Wikipedia):

enter image description here

Related Question