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
    You wrote down quite a lot of your work (which is good), but you left out the part that would have been most relevant for helping you: how did you arrive at $$\frac{\sin{(n-1)\pi}}{\pi (n-1)}\;?$$ Note that $$\lim_{n\to1}\frac{\sin{(n-1)\pi}}{\pi (n-1)}=1$$ by l'Hôpital, but that doesn't explain how you were able to derive a formula for general $n$ that isn't valid for $n=1$.2011-10-27
  • 0
    Well I have a paper of work if you'd like me to scan it. But my asnwer was confirmed by wolfram alpha and also my graphing calculator. My graphing calculator gave this answer though: $\( \frac{1}{(n+1)\pi} - \frac{1}{(n-1)\pi} \) \cdot \sin{n\pi}$ but this is still undefined for n = 1 and 0 for all other n.2011-10-27
  • 0
    How does the limit help me? I've never seen limits being introduced to find coefficients.2011-10-27
  • 0
    what is the correct result of the integration? I seem to be getting the answer I have up there.2011-10-27
  • 0
    Hmm -- I get a different (correct) result when I [enter your code at Wolfram|Alpha](http://www.wolframalpha.com/input/?i=integrate+%281%2FL%29+sin%28Pi+x%2FL%29sin%28Pi+x+n%2FL%29+from+-L+to+L). Are you really getting the result you wrote down? Note that Wolfram|Alpha doesn't always output all restrictions on parameters; in this case the restriction $n=1$ is missing. If you calculated this by hand, you must have divided by $n-1$ at some point; that step was invalid for $n=1$. Regarding the limit: no, it's not directly helpful, but reassuring that it's consistent with the correct result.2011-10-27
  • 0
    Even maple is giving me the same result.2011-10-27
  • 0
    Sorry, the link was broken because of the asterisks. You should be able to see the result now when you follow the link. Could you also provide a link that shows the other result? By the way, this is also the result your graphing calculator is giving you, as you can see if you bring the fractions onto a common denominator.2011-10-27
  • 0
    thankyou, however isnt that the same result as me. If I put n = 1, the the denominator is still $\pi - \pi =0$2011-10-27
  • 0
    That's rather a fundamental misconception. You can't write down a result for general $n$, make changes to it assuming $n=1$, and then still present it as a result for general $n$. These are two different results; both are undefined at $n=1$, and their numerators and denominators coincide at $n=1$.2011-10-27
  • 0
    so I don't get it. I mean how do I get a formula for cofficients if I can't get a general formula for n?2011-10-27
  • 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
    That doesn't answer the question. The OP pointed out that he's able to get the correct result after substituting $n=1$.2011-10-27
  • 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