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

How to show that $\displaystyle\frac{1}{\pi} \int_{-\pi}^{\pi} \cos(mx)\cos(nx) \,dx = \delta_{mn}$?

If you use $\cos(x)\cos(y)=\cos(x-y)+\cos(x-y)$, you get that

$$\begin{align} \frac{1}{\pi} \int_{-\pi}^{\pi} \cos(mx)\cos(nx) \,dx &= \frac{1}{\pi}\left( \int_{-\pi}^{\pi} \cos((m-n)x)\,dx+\int_{-\pi}^{\pi} \cos((m+n)x) \,dx \right) \\ &= \frac{1}{\pi}\left(\left[\frac{1}{m-n}\sin((m-n)x)\right]_{x=-\pi}^{x=\pi}+\left[\frac{1} {m+n}\sin((m+n)x)\right]_{x=-\pi}^{x=\pi}\right) \\ &= \frac{1}{\pi}\frac{2((n-m)\sin(\pi n+\pi m)+(n+m)\sin(\pi n-\pi m))}{2 n^2-2 m^2 }. \end{align}$$

But now if I consider $m=n=k$, then integral goes to $0$ and if I consider $m \neq n$, then it still goes to $0$. $\delta_{mn}$ is Kronecker delta.

share|cite|improve this question
If $m=n$, you can't write the second line in your align. – Davide Giraudo Sep 10 '12 at 20:16
Too much work. Look at the graph and realize that if $k\ne0$, $\int_{-\pi}^\pi\cos(kx)dx=0$: there’s as much above the axis as below. On the other hand, the integral of $\cos^2(kx)$ over the same interval is clearly $1/2$ times the length, ’cause there’s as much below the line $y=1/2$ as above. – Lubin Sep 10 '12 at 20:31
Better explanation for $\cos^2(kx)$: this function is $\cos(2kx)+1/2$, and the previous argument applies. – Lubin Sep 10 '12 at 20:40
Your conclusion that the integral goes to $0$ when $m = n$ is wrong. You actually get $0/0$, which tells you that the formula is not valid when $m = n$. – Tunococ Sep 10 '12 at 20:41
up vote 7 down vote accepted

When you integrate, be cautious about inadvertently dividing by $0$. Treat such situations entirely separately.

share|cite|improve this answer

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.