0
$\begingroup$

So I am just learning intro to fourier series and have a quick question regarding computation of the coefficients. Let our function be $ f(x) = \sin{\frac{\pi x}{L}} $

Recall that the fourier series coefficients are as follows $ a_0 = \frac{1}{2L} \int_{-L}^{L} f(x) dx $ $ a_n = \frac{1}{L} \int_{-L}^{L} f(x) \cos{\frac{n\pi x}{L}}dx $

$ b_n = \frac{1}{L} \int_{-L}^{L} f(x) \sin{\frac{n\pi x}{L}} dx $ The solution manual says that $b_n = 1 $ for $n = 1$ and $b_n = 0$ for all other $n$ by observation. Yes I see this is the case but when I manually do the integrals it doesn't make sense.

Lets believe me when I say that I have already simplified $a_0$ and $a_n$ and they are both zero. But when I integrate $b_n$ I get the following $\frac{\sin{(n-1)\pi}}{\pi (n-1)} $ which is undefined for $n = 1$. The denominator is zero. I also noticed that it is $0$ for any $n$. But isn't this a contradiction? Shouldn't I get $1$ if I plug $n=1$ in there?

Note: If I plug in $n=1$ before i evaluate the integral then I get the desired answer. Plugging in $n=1$ before evaluating gives me $1$ AND $0$ for other $n$. Generally how are you supposed to find these coefficients? Should I plug in values for $n$ before doing the integral or after?

edit: here is the wolfram integral:

integrate (1/L)* sin(Pi*x/L)*sin(Pi*x*n/L) from -L to L 
  • 0
    let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/1669/discussion-between-joriki-and-tyler-hilton)2011-10-27

2 Answers 2

2

My guess is that you are using a trig identity to get

$\displaystyle b_n= \frac{1}{L}\int_{-L}^L \sin\left(\frac{\pi x}{L}\right)\sin\left(\frac{\pi xn}{L}\right) dx = \frac{1}{2L}\int_{-L}^L \cos\left(\frac{(n-1)\pi x}{L}\right) - \cos\left(\frac{(n+1)\pi x}{L}\right) dx$

When you integrate this, you will get a different result when $n=1$ and $n\neq 1$ because you will have to divide by $n-1$. So the formula you got is only valid when $n\neq 1$. For $n=1$, you need to plug in $n=1$ before taking the antiderivative. Hope this helps.

0

For $n=1$, $b_1=\frac{2}{L}\int_0^L \sin^2\frac{\pi x}{L} dx=\frac{1}{L}\int_0^L(1-\cos\frac{2\pi x}{L})dx=1$

  • 0
    Sorry edited for @joriki's comment: For arbitrary $n$ (in one go), you may wish to write $\sin y. \sin ny=\cos(n-1)y-\sin(n+1)y$ and then integrate accordingly. So, basically your error arises (for $n=1$) when you integrating $\cos (n-1)y$ and write value as $-\frac{\sin (n-1)y}{n-1}$.2011-10-27