# Math Help - Fourier series of step function

1. ## Fourier series of step function

Hiya,

I'm having a bit of trouble figuing out the fourier series for a function f(x) defined as 1 if 0 < x < pi, -1 if -pi < x < 0.

The problem I'm having is that $\int$ f(x) dx from -pi to pi equals 0, therefore all of the fourier coefficients are 0. Am I doing something wrong?

Thanks

2. Originally Posted by CorruptioN
Hiya,

I'm having a bit of trouble figuing out the fourier series for a function f(x) defined as 1 if 0 < x < pi, -1 if -pi < x < 0.

The problem I'm having is that $\int$ f(x) dx from -pi to pi equals 0, therefore all of the fourier coefficients are 0. Am I doing something wrong?

Thanks
The "therefore" is wrong the conclusion does not follow from your premiss. You have shown that $a_0$ is zero, and as the function is odd all of the $a$'s are zero, but the $b$'s are non-zero. Write out the integral for $b_1$ and see.

CB

3. Originally Posted by CorruptioN
Hiya,

I'm having a bit of trouble figuing out the fourier series for a function f(x) defined as 1 if 0 < x < pi, -1 if -pi < x < 0.

The problem I'm having is that $\int$ f(x) dx from -pi to pi equals 0, therefore all of the fourier coefficients are 0. Am I doing something wrong?

Thanks
$f(x) = \begin{cases}
-1, & \mbox{if}~~ -\pi < x < 0 \\
1, & \mbox{if}~~~~~~ 0 < x < \pi
\end{cases}$

You have an odd function, so you need to find only $b_n$.

$b_n = -\frac{1}{\pi}\int\limits_{-\pi}^0 \sin nx\,dx + \frac{1}{\pi}\int\limits_0^\pi \sin nx\,dx = \frac{2}{\pi}\int\limits_0^\pi \sin nx\,dx =$

$= \left. {-\frac{2}{\pi n}\cos nx} \right|_0^\pi = \frac{2}{\pi}\frac{1-(-1)^n}{n} = \begin{cases}
0, & \mbox{if} \quad n~~\text{is}~~\text{even} \\
$f(x) = \frac{4}{\pi}\sum\limits_{n=1}^\infty \frac{\sin\bigl[(2n-1) x\bigl]}{2n-1},~~ - \pi < x < \pi .$