One cute integral served two ways

Research kicks up, writing kicks back. So in this brief note, we examine a pair of methods to examine an integral. They’re both very clever, I think. We seek to understand $$ I := \int_0^{\pi/2}\frac{\sin(x)}{\sin(x) + \cos(x)} dx $$

We base our first idea on an innocuous-seeming integral identity.

For $latex {f(x)}$ integrable on $latex {[0,a]}$, we have $$ \int_0^a f(x) dx = \int_0^a f(a-x)dx. \tag{1}$$

The proof is extremely straightforward. Perform the substitution $latex {x \mapsto a-x}$. The negative sign from the $latex {dx}$ cancels with the negative coming from flipping the bounds of integration. $latex {\diamondsuit}$

Any time we have some sort of relationship that reflects into itself, we have an opportunity to exploit symmetry. Our integral today is very symmetric. As $latex {\sin(\tfrac{\pi}{2} – x) = \cos x}$ and $latex {\cos(\tfrac{\pi}{2} – x) = \sin x}$, notice that $$ I = \int_0^{\pi/2}\frac{\sin x}{\sin x = \cos x}dx = \int_0^{\pi/2}\frac{\cos x}{\sin x + \cos x }dx. $$
Adding these two together, we see that $$ 2I = \int_0^{\pi/2}\frac{\sin x + \cos x}{\sin x + \cos x} dx = \frac{\pi}{2}, $$
and so we conclude that $$ I = \frac{\pi}{4}. $$
Wasn’t that nice? $latex {\spadesuit}$

Let’s show another clever argument. Now we rely on a classic across all mathematics: add and subtract the same thing. \begin{align} I = \int_0^{\pi/2}\frac{\sin x}{\sin x + \cos x}dx &= \frac{1}{2} \int_0^{\pi/2} \frac{2\sin x + \cos x – \cos x}{\sin x + \cos x}dx \\
&= \frac{1}{2} \int_0^{\pi/2} \frac{\sin x + \cos x}{\sin x + \cos x}dx + \frac{1}{2}\int_0^{\pi/2}\frac{\sin x – \cos x}{\sin x + \cos x}dx. \end{align} The first term is easy, and evaluates to $latex {\tfrac{\pi}{4}}$. How do we handle the second term? In fact, we can explicitly write down its antiderivative. Notice that $latex {\sin x – \cos x = -\frac{d}{dx} (\sin x + \cos x)}$, and so the last term is of the form $$ -\frac{1}{2}\int_0^{\pi/2} \frac{f'(x)}{f(x)}dx $$
where $latex {f(x) = \sin x + \cos x}$. You may or may not remember that $latex {\frac{f'(x)}{f(x)}}$ is the logarithmic derivative of $latex {f(x)}$, or rather what you get if you differentiate $latex {\log f(x)}$. As we are integrating the derivative of $latex {\log f(x)}$, we see that $$ -\frac{1}{2} \int_0^{\pi/2}\frac{f'(x)}{f(x)}dx = -\frac{1}{2} \ln f(x) \bigg\rvert_0^{\pi/2}, $$
which for us is $$ -\frac{1}{2} \ln(\sin x + \cos x) \bigg\rvert_0^{\pi/2} = -\frac{1}{2} \left( \ln(1) – \ln(1) \right) = 0. $$

Putting these two together, we see again that $latex {I = \frac{\pi}{4}}$. $latex {\spadesuit}$

This entry was posted in Mathematics and tagged , , . Bookmark the permalink.

2 Responses to One cute integral served two ways

Leave a Reply