# Math Help - Fourier series

1. ## Fourier series

hello

I need to find the fourier sine series for the odd function:
defined on $[0,\pi].$

$f(x) = |x-\frac{\pi}{2}| - \frac{\pi}{2}.$

$f(x)$ is periodic of period $2\pi$

I tried to define the function different(to get rid of the absolute value)

$f(x) = -x$ if $0<=x<=\frac{\pi}{2}$
$x-\pi$ if $\frac{\pi}{2}$

I set up the integral for $b_{n}$.

in this case $L = \pi$ so:
$b_{n} = \frac{2}{L}\int_{0}^{\pi}f(x)sin(\frac{{\pi}nx}{L} )dx =
\frac{2}{\pi}\int_{0}^\frac{\pi}{2}-xsin(nx)}dx$

$+ \frac{2}{\pi}\int_{\frac{\pi}{2}}^{\pi}(x-\pi)sin(nx)dx$

and the result I got was incorrect.
I went over and over this problem but couldn't find the mistake.

help would be appreciated.

2. Originally Posted by parallel
hello

I need to find the fourier sine series for the odd function:
defined on $[0,\pi].$

$f(x) = |x-\frac{\pi}{2}| - \frac{\pi}{2}.$
Okay you have, (shown below)
$f(x)=|x-\pi/2|-\pi/2$ for $-\pi
This is a strictly monotonic function whose discountinuity points are not replacable, therefore it can be represented as a fourier series.
---
The constant term,
$\pi a_0=\int_{-\pi}^{\pi} f(x) dx=\int_{-\pi}^{\pi/2}f(x)dx+\int_{\pi /2}^{\pi}f(x)dx$
Now these intervals the function behaves like,
$\int_{-\pi}^{\pi/2} -x dx +\int_{\pi/2}^{\pi} x-\pi dx=-\frac{1}{2}x^2 \big|^{\pi/2}_{-\pi}+\frac{1}{2}x^2-\pi x \big|^{\pi}_0$
Thus,
$-\frac{1}{8}\pi^2+\frac{1}{2}\pi^2+\frac{1}{2}\pi^2-\pi^2=-\frac{1}{8}\pi^2$
Thus,
$a_0=-\frac{1}{8}\pi^2$.

The same idea of spliting the function on the interval is used to find the sine and cosine coefficients. I just do not want to do that because I know how long these fourier computations can take.

3. Originally Posted by ThePerfectHacker
Okay you have, (shown below)
$f(x)=|x-\pi/2|-\pi/2$ for $-\pi
This is a strictly monotonic function whose discountinuity points are not replacable, therefore it can be represented as a fourier series.
The problem is to find the Fourier sin series for the odd function defined by:

$
f(x) = \left\{{|x-\frac{\pi}{2}| - \frac{\pi}{2}\ \ \ \ x \in [0,\pi) \atop
f(x)=-f(-x)\ \ \ \ \ x \in (-\pi, 0]\right{}
$

RonL

4. Originally Posted by parallel
hello

I need to find the fourier sine series for the odd function:
defined on $[0,\pi].$

$f(x) = |x-\frac{\pi}{2}| - \frac{\pi}{2}.$

$f(x)$ is periodic of period $2\pi$

I tried to define the function different(to get rid of the absolute value)

$f(x) = -x$ if $0<=x<=\frac{\pi}{2}$
$x-\pi$ if $\frac{\pi}{2}$

I set up the integral for $b_{n}$.

in this case $L = \pi$ so:
$b_{n} = \frac{2}{L}\int_{0}^{\pi}f(x)sin(\frac{{\pi}nx}{L} )dx =
\frac{2}{\pi}\int_{0}^\frac{\pi}{2}-xsin(nx)}dx$

$+ \frac{2}{\pi}\int_{\frac{\pi}{2}}^{\pi}(x-\pi)sin(nx)dx$

and the result I got was incorrect.
I went over and over this problem but couldn't find the mistake.

help would be appreciated.
What do you get for $b_n$?

Simply evaluating what you have here (which looks OK to me) I get:

$
b_n=-\ \frac{4 \sin(\pi\ n/2)}{\pi\ n^2}
$

That this is correct is illustrated by the attachment showing the partial
sums of the Fourier sin series with these coefficients for 2, 8, and 50
terms (together with the function itself).

RonL

5. thanks alot CaptainBlack,I had the most stupid mistake ever(those are hard to find),I integrated cosine as cosine.

after correcting this mistake I got the same as you.

ThePerfectHacker:

6. Originally Posted by parallel
thanks alot CaptainBlack,I had the most stupid mistake ever(those are hard to find),I integrated cosine as cosine.

after correcting this mistake I got the same as you.

ThePerfectHacker: