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. 
 A: 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.
