Integration of $\sin(nx)\cos(mx)$
Andrew Henderson
How do I integrate the following: $\displaystyle\int_{-\pi}^\pi \sin(nx)\cos(mx)\,dx$
Thanks, I am really stuck.
$\endgroup$ 04 Answers
$\begingroup$HINT: Use properties of definite integral $$f(-x)=f(x) \Rightarrow \int_{-a}^{a}f(x)dx=2\int_{0}^{a}f(x)dx$$ $$f(-x)=-f(x) \Rightarrow \int_{-a}^{a}f(x)dx=0$$
$\endgroup$ 0 $\begingroup$The prosthaphaeresis/Werner formula useful to know here is $$ 2\sin{a}\cos{b} = \sin{(a+b)}+\sin{(a-b)} $$ So in this case, $$ \sin{nx}\cos{mx} = \frac{1}{2}\big( \sin{(n+m)x}+\sin{(n-m)x} \big), $$ which is easy to integrate: assuming that $n,m$ are positive integers, if $n \neq m$, you find $$ \int_{-\pi}^{\pi} \sin{nx}\cos{mx} \, dx = -\frac{1}{2}\left[ \frac{\cos{(n+m)x}}{n+m}+\frac{\cos{(n-m)x}}{n-m} \right]_{-\pi}^{\pi} = 0, $$ since $\cos{ax}$ is an even function, so the values of the RHS at the endpoints are the same. On the other hand, if $n=m$ the second term is not present in the prosthapharesis formula, and you just have $$ 2\sin{nx}\cos{nx} = \sin{2nx}, $$ and the integral is zero again, since $$ \int_{-\pi}^{\pi} \sin{nx}\cos{nx} \, dx = -\frac{1}{2n}(\cos{2n\pi}-\cos{2n\pi}) = 0. $$
$\endgroup$ $\begingroup$for $m\neq 0$ it i odd function thus answer is $0$ and for $n=0$ easily integer will give answer equal zero. $\sin{(-nx)}\cos{(-mx)}=-\sin{(nx)}\cos{(mx)}$
$\endgroup$ 2 $\begingroup$A simple way to do the indefinite integral is this $$ \int \underbrace{\sin(nx)}_{\displaystyle u} \Big(\underbrace{\cos(nx)\,dx}_{\dfrac{du} n}\Big) = \frac 1 n \int u\,du = \frac 1 n\cdot \frac{u^2} 2 +\text{constant} = \frac{\sin^2(nx)}{2n} +\text{constant} $$ and then of course you plug in the bounds $-\pi$ and $\pi$ and then subtract.
However, in this case there's a simple way to do it even if you cannot find the indefinite integral. You need to remember that $\underbrace{\sin(-\theta) = -\sin\theta}_\text{odd}$ and $\underbrace{\cos(-\theta) = \cos\theta}_\text{even}$. \begin{align} & \int_{-\pi}^0 \sin(nx)\cos(nx)\,dx + \int_0^\pi \sin(nx)\cos(nx)\,dx \\[10pt] = {} & \int_\pi^0 -\sin(nw)\cos(nw)\,(-dw) + \int_0^\pi \sin(nx)\cos(nx)\,dx \\ & \qquad\text{where } w = -x \\[12pt] = {} & \int_\pi^0 \sin(nw)\cos(nw)\,dw + \int_0^\pi \sin(nx)\cos(nx)\,dx \\[10pt] = {} & - \int_0^\pi \sin(nw)\cos(nw)\,dw + \int_0^\pi \sin(nx)\cos(nx)\,dx \\[10pt] = {} & 0\text{ because the two integrals are the same.} \end{align} When you use the second method, there is no need to find the antiderivative.
$\endgroup$