# Calculate the $\int_0^{2\pi}\cos(mx)\cos(nx)dx$

I'm having trouble with this problem:

Consider the integral: $$\tag 1\int_0^{2\pi}\cos(mx)\cos(nx)dx$$

a. Write $\cos(mx)$ and $\cos(nx)$ in terms of complex exponentials and compute $\cos(mx)\cos(nx)$

b. Show that, for integer $L$: $$\int \exp(iLx)dx = \begin{cases} 2\pi, & \text{ if } L=0 \\ 0, & \text{otherwise}, \end{cases}$$ (where i is a complex number)

c. Compute the integral in $(1)$ by using the above.

-
That's a pretty good program you have here. Have you tried to apply it? – 1015 Feb 19 '13 at 3:02
"where $i$ is a complex number" -- I'm sure that in this context $i$ is a square root of $-1$, not just any complex number. – Jonas Meyer Feb 19 '13 at 3:10
@julian: why should Leslie try, if people here will solve it for him/her, within 10 minutes? – GEdgar Feb 19 '13 at 3:26

Using complex exponentials, or more elementarily the cosine addition laws $\cos(A+B)=\cos A\cos B-\sin A\sin B$ and its twin $\cos(A-B)=\cos A\cos B+\sin A\sin B$, we find that $$\cos(mx)\cos(nx)=\frac{1}{2}\left(\cos((m+n)x)+\cos((m-n)x)\right).$$ Integrate. Be careful about the case $m=n$.

-
and also about $m+n=0?$ – lab bhattacharjee Feb 19 '13 at 4:40
That too, if we are interested in negative integers. In the trigonometric series context, which this question usually belongs to, the integers are non-negative. – André Nicolas Feb 19 '13 at 4:44

Hint:

$$\cos kx=\frac{e^{ikx}+e^{-ikx}}{2}\Longrightarrow \cos mx\cos nx=\frac{1}{4}\left(e^{i(m+n)x}+e^{-i(m+n)x}+e^{i(m-n)x}+e^{-i(m-n)x}\right)$$

-

Recall that

$$\cos x = \frac{e^{ix}+e^{-ix}}{2}$$

Then expand

$$\cos (mx)\cos (nx) = \left(\frac{e^{imx}+e^{-imx}}{2}\right) \left(\frac{e^{inx}+e^{-inx}}{2}\right)$$

so it becomes a sum of complex exponentials.

For the second part, merely find the antiderivative of $\exp(i L x), \, \forall L \neq 0$ and then find that the definite integral over $[0, 2\pi]$. Then do the same for when $L = 0$.

Combine the two above results to conclude what the integral of the cosines is.

-