Orthogonality of Sine and Cosine Functions

Integrate[Sin[m Pi x/p]*Sin[n Pi x/p],{x,-p,p}]

Which is zero when m≠n. When m=n we get an indeterminant form, so have to go back to the integral

Integrate[Sin[n Pi x/p]*Sin[n Pi x/p],{x,-p,p}]

which is just p. It isn't too hard to show this by hand (you just need to use some trig identies), but it is a bit of a pain to keep track of all the details.

Integrate[Cos[m Pi x/p]*Cos[n Pi x/p],{x,-p,p}]

Which is zero when m≠n. When m=n we get an indeterminant form, so have to go back to the integral

Integrate[Cos[n Pi x/p]*Cos[n Pi x/p],{x,-p,p}]

Integrate[Cos[m Pi x/p]*Sin[n Pi x/p],{x,-p,p}]

Summary:

(∫_(-p)^p)Sin[m π x/p]*Sin[n π x/p]dx= p if m=n, 0 otherwise
(∫_(-p)^p)Cos[m π x/p]*Cos[n π x/p]dx= p if m=n, 0 otherwise
(∫_(-p)^p)Sin[m π x/p]*Cos[n π x/p]dx= 0

We will encounter these again in Section 3.6, where we do the work by hand. Section 2.1 of the text gives you an outline of how to do it.