# Finding Fourier series constant and integral

I have been studying Griffith's Intro to Electrodynamics. I am studying differential equations and Fourier series. I am studying the problem discussed here: Why is this allowed? ("Fourier's Trick"; finding the coefficients in a Fourier Series).

I have tried to compute the integral with the two sine functions a number of times using different methods (integration by parts, Euler's method, trig identities) but I always get $0$ instead of:

• $0$ if $n$ not equal to $n'$

• $\frac{a}{2}$ for $n = n'$

Can someone please show me how to evaluate this integral correctly. It's driving me crazy.

• As far as I remember, this calculation is shown in the book, no? If so, perhaps you could point out which step you didn't understand. Sorry if I remember incorrectly. – Bobson Dugnutt Feb 11 '16 at 22:11
• The actual integral is left for the reader to do; he just shows the answer. I'm having issues when I actually compute ∫sin(npiy/a)sin(n'piy/a)dy. No matter what I do all the terms end up vanishing and the integral ends up being zero. – user2216571 Feb 11 '16 at 22:19
• The integral can be performed most easily by using Euler's formula: $sin(x) = [exp(ix)-exp(-ix)]/(2i)$. – M. Wind Feb 11 '16 at 23:33
• I tried using Euler's formula and got 0 at all times. Do you think you could show the computation here so I can see if I got anything wrong? – user2216571 Feb 12 '16 at 0:23

Edited massively to provide a full answer:

The integration in question is $$S=\int_0^a \sin (n \pi x/a) \sin(n' \pi x/a) dx$$ (taken from p. 134 the Int. 4th ed. of Griffiths' EM)

First use the trigonometric identity $\sin(A)\sin(B)=\frac{1}{2}[\cos (A-B)-\cos(A+B)]$ to get $$S=\frac{1}{2} \int_0^a \cos \left( \frac{n-n'}{a} \pi x \right)-\cos \left( \frac{n+n'}{a} \pi x \right) dx$$

This, when evaluated in the case of $n \not = n'$, gives $$S_{n \not =n'} = \frac{a}{2\pi(n'-n)} \sin ((n'-n)\pi) - \frac{a}{2\pi(n'+n)} \sin ((n'+n)\pi)$$

But since $\sin(k\pi)=0$ for any $k \in \mathbb{N}$, these terms vanish, so $S_{n \not =n'}=0$.

In the case of $n =n'$, the first term in the integral with the $\cos$'s is $1$, so the integral, when evaluated is $$S_{n =n'}=\frac{a}{2}-\frac{a}{2\pi(n'+n)} \sin ((n'+n)\pi)$$ but for the same reasons as before, the sine vanishes, and we're left with the desired $S_{n =n'}=\frac{a}{2}$.

More generally speaking, one could also argue that sines of this sort where the factors in the argument $n \not = n'$ are being integrated over must give $0$ because they form a complete basis and are therefore mutually orthogonal... but that's linear algebra and is perhaps better suited for another question.

• This is the particle in the box if I'm not mistaken. I guess I am having trouble understanding the other case where m=n and at the end one would have a denominator equal to 0. I hope you see what I mean. – user2216571 Feb 11 '16 at 23:00
• @user2216571 As far as I remember, I was (after some thought) able to "spot the point at which it fails", but I don't have time to it now, unfortunately. I will come back tomorrow. Good luck! – Bobson Dugnutt Feb 11 '16 at 23:24
• Okay I hope you'll be able to show me tomorrow. Thanks! – user2216571 Feb 12 '16 at 1:10
• Were you able to have a crack at it and find the problem? – user2216571 Feb 13 '16 at 16:25
• @user2216571 Yep, here you go! – Bobson Dugnutt Feb 13 '16 at 17:21