Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

According to my textbook: $$\int_{-L}^{L} \cos\frac{n \pi x}{L} \cos\frac{m \pi x}{L} dx = \begin{cases} 0 & \mbox{if } n \neq m \\ L & \mbox{if } n = m \neq 0 \\ 2L& \mbox{if } n = m = 0 \end{cases} $$

According to the trig identity given on this cheat sheet:

$$ \cos{\alpha}\cos{\beta} = \frac{1}{2}\left [ \cos \left (\alpha -\beta \right ) + \cos \left(\alpha +\beta \right ) \right ] $$

Substituting this trig identity in and integrating from $-L \mbox{ to } L$ gives:

$$\int_{-L}^{L} \cos\frac{n \pi x}{L} \cos\frac{m \pi x}{L} dx = \frac{L}{\pi} \left [\frac{\sin \left ( \pi (n - m) \right )}{n - m} + \frac{\sin \left ( \pi (n+m) \right )}{n + m}\right ] $$

Evaluating the right side at $n = m$ gives a zero denominator, making the whole expression undefined. Evaluating the right hand side at $n \neq m$ gives $0$ because the sine function is always $0$ for all integer multiples of $\pi$ as can be clearly seen with the unit circle. None of these results jive with the first equation.

Could you explain what mistakes I am making with my thinking?

share|cite|improve this question

If $a=0$, then $\cos(ax)$ should be simplified before finding its antiderivative. This will keep you from dividing by zero, and it will make the answer come out right. (E.g., if $a=(m-m)\pi/L$ or $a=(0+0)\pi/L$.)

share|cite|improve this answer
Thanks! I knew there was something simple I was missing. – wdkrnls Jan 12 '11 at 6:11

The integration is wrong if $n=m$ or if $n=-m$, because it is false that $\int \cos(0\pi x)\,dx = \frac{\sin(0\pi x)}{0}+C$. So the very use of the formula assumes that $|n|\neq|m|$.

But if $|n|\neq|m|$, then your formula does say that the integral should be $0$, the same thing you get after the substitution. What makes you say that it "does not jive"?

share|cite|improve this answer
Thanks! By "does not jive" I was just trying to express that the expression was inconsistent. – wdkrnls Jan 12 '11 at 6:13
@wdkrnls: Except that it wasn't: in the only case in which the formula could be applied, it gave exactly the same answer as the formula you had. Of course it could not be applied in cases where it could not be applied... but that's a bit of a pleonasm, after all. You said none of the results agreed, but in fact the case $|n|\neq|m|$ agreed perfectly. – Arturo Magidin Jan 12 '11 at 6:15

What Arturo says is correct that the answer you get is not quite right on the diagonal ( m=n) and the anti diagonal (m=-n). In a certain sense it is almost right. What do I mean? If we take a limit of the $$ lim_{n-m\rightarrow 0} \frac{L}{\pi} \left [\frac{\sin \left ( \pi (n - m) \right )}{n - m} + \frac{\sin \left ( \pi (n+m) \right )}{n + m}\right ] =$$ $$\frac{L}{\pi}[\pi+\frac{sin(2\pi n)}{2n}]$$. Now if $n$ is a nonzero integer, you recover the answer $L$. If $n=0$, then when we take the limit of the new expression as $n$ approaches zero, we get the answer $2L$.

Now a technical note. I took this limit in a particular way. To make this well defined, what one must show is that the two dimensional limits, $$lim_{(x,y)\rightarrow (n,n)}\frac{sin(x-y)}{x-y}=1$$. Also note that the case where $m=-n$ is similar.

share|cite|improve this answer
As a general note, whenever I see a formula where the range of values that is applicable for the formula is not complete, it is useful to see if the limiting behavior of that formula gives the right answer. – Baby Dragon Jan 2 '13 at 2:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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