Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to find the Fourier sine series of the following function:

$$ f\left(x\right)= \begin{cases} 1&x<L/2,\\ 0&x>L/2.\tag{1} \end{cases} $$

Let $L=1$. Then, this is what $\left(1\right)$ looks like:

                                enter image description here

I know that to find the Fourier sine series of $\left(1\right)$, I first need to find its odd extension $f_o$:

$$ f_o\left(x\right)= \begin{cases} 1&0<x<L/2,\\ 0&L/2<x<L\text{ & }-L<x<L/2,\\ -1&-L/2<x<0.\tag{2} \end{cases} $$

Again, letting $L=1$, this is what $\left(2\right)$ looks like:

                                enter image description here

Finally, the Fourier sines series of a piecewise smooth, odd function $f\left(x\right)$ is given by

$$ f\left(x\right)\sim\sum_{n=1}^{\infty}B_n\sin\frac{n\pi x}{L}, $$


$$ B_n=\frac{2}{L}\int_{0}^{L}f\left(x\right)\sin\frac{n\pi x}{L}.\tag{3} $$

Now, I am having a really hard time trying to find $\left(3\right)$ because, for the case where $0<x<L/2$, I get

$$ \frac{2}{n\pi}\left(1-\cos\left(n\pi\right)\right), $$

and for the case where $-L/2<x<0$, I get

$$ \frac{2}{n\pi}\left(\cos\left(n\pi\right)-1\right). $$

So, it is piecewise defined, but my book only gives one solution, that is,

$$ \frac{2}{n\pi}\left(1-\cos\frac{n\pi}{2}\right). $$

What am I missing!?

share|cite|improve this question
up vote 1 down vote accepted

$$B_n=\frac 2L \int_0^{L/2}\sin(\frac{n\pi}L x) dx$$ $$B_n=-\frac 2L \cos(\frac{n\pi}Lx)\frac{L}{n\pi}\bigg]_0^{L/2}$$ $$B_n=\frac{2}{n\pi}\left(1-\cos(\frac{n\pi}2)\right)$$

I have no idea what you did. Do you see where your derivation looks different from this one? Keep in mind that the first integral you gave is the whole solution. You don't have to do it on both sides.

share|cite|improve this answer
Why did you integrate from $0$ to $L/2$ and not from $0$ to $L$? – EsX_Raptor Oct 23 '12 at 4:10
I essentially did integrate from $0$ to $L$, but the function is zero from $L/2$ to $L$ so we can just ignore that part, since it will integrate to $0$ anyway. – Robert Mastragostino Oct 23 '12 at 4:13
Thank you. Aside from that question, I now know where I went wrong; I tried integrating from $-L$ to $L$! – EsX_Raptor Oct 23 '12 at 4:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.