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
  • $\begingroup$ 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$. $\endgroup$ – joriki Oct 27 '11 at 18:12
  • $\begingroup$ 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. $\endgroup$ – Tyler Hilton Oct 27 '11 at 18:14
  • $\begingroup$ How does the limit help me? I've never seen limits being introduced to find coefficients. $\endgroup$ – Tyler Hilton Oct 27 '11 at 18:17
  • $\begingroup$ what is the correct result of the integration? I seem to be getting the answer I have up there. $\endgroup$ – Tyler Hilton Oct 27 '11 at 18:26
  • $\begingroup$ Hmm -- I get a different (correct) result when I enter your code at Wolfram|Alpha. 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. $\endgroup$ – joriki Oct 27 '11 at 18:27

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.


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$

  • $\begingroup$ That doesn't answer the question. The OP pointed out that he's able to get the correct result after substituting $n=1$. $\endgroup$ – joriki Oct 27 '11 at 18:26
  • $\begingroup$ 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}$. $\endgroup$ – Tapu Oct 27 '11 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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