# Ask Uncle Colin: A trigonometric integral

Ask Uncle Colin is a chance to ask your burning, possibly embarrassing, maths questions -- and to show off your skills at coming up with clever acronyms. Send your questions to colin@flyingcoloursmaths.co.uk and Uncle Colin will do what he can.

Dear Uncle Colin,

I'm trying to find a definite integral: $\int_0^\pi \sin(kx) \sin(mx) \dx$, where $m$ and $k$ are positive integers and the answer needs to be simplified as far as possible. I've wound up with $\left[\frac{ (k+m) \sin((k-m) \pi) - (k-m)\sin((k+m)\pi) }{2(k-m)(k+m)}\right]$, but it's been marked wrong.

-- Flat Out Unhappy: Routine Integration Evidently Right

Hello, FOURIER -- and thanks for your question!

You're almost, but not quite right -- and you've got a lot further than an awful lot of people would have done. You have, however, missed two slightly subtle wrinkles.

For the benefit of everyone else at the back of the class, here's how I'd tackle the problem:

First, use the formulas-you-never-use, which include $\cos(A) - \cos(B) \equiv -2 \sin\left( \frac{A+B}{2} \right) \left( \frac{A-B}{2} \right)$.

If you work it through (ignoring the factor of -2 for the moment), $A$ turns out to be $(k+m)x$ and $B$ is $(k-m)x$, making $\sin(kx) \sin(mx) \equiv -\frac{1}{2} \left( \cos((k+m)x) - \cos((k-m)x) \right)$.

The first wrinkle is: you can only integrate this as it stands as long as $k \ne m$ -- otherwise you'd be dividing by 0, which is a bit of a no-no. We'll need to come back to that case separately later; for now, let's assume $k \ne m$.

Integrating gives $-\frac{1}{2} \left [ \frac{1}{k+m} \sin((k+m)x) - \frac{1}{k-m} \sin((k-m)x) \right]_0^\pi$.

Here's the second wrinkle: $\sin(n\pi) = 0$, for all integer values of $n$. This integral is zero, for all positive integer choices of $k$ and $m$ (as long as they're different).

If they're the same, the thing we're integrating is $-\frac{1}{2} \left( \cos(2kx) - 1 \right)$, because $\cos(0)=1$.

This integrates to $-\frac{1}{2}\left[ \frac{1}{2k} \sin(2kx) - x \right]_0^\pi$. Again, the first term vanishes, leaving a final answer of $\frac{\pi}{2}$.

Your final answer should have been $I = \begin{cases}\frac{\pi}{2},\ k = m \\ 0, \ k \ne m \end{cases}$.

Hope that makes sense!

-- Uncle Colin

## Colin

Colin is a Weymouth maths tutor, author of several Maths For Dummies books and A-level maths guides. He started Flying Colours Maths in 2008. He lives with an espresso pot and nothing to prove.

#### Share

This site uses Akismet to reduce spam. Learn how your comment data is processed.