# 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 ${f(x)}$ integrable on ${[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 ${x \mapsto a-x}$. The negative sign from the ${dx}$ cancels with the negative coming from flipping the bounds of integration. ${\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 ${\sin(\tfrac{\pi}{2} – x) = \cos x}$ and ${\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? ${\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 ${\tfrac{\pi}{4}}$. How do we handle the second term? In fact, we can explicitly write down its antiderivative. Notice that ${\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 ${f(x) = \sin x + \cos x}$. You may or may not remember that ${\frac{f'(x)}{f(x)}}$ is the logarithmic derivative of ${f(x)}$, or rather what you get if you differentiate ${\log f(x)}$. As we are integrating the derivative of ${\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 ${I = \frac{\pi}{4}}$. ${\spadesuit}$

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

### 2 Responses to One cute integral served two ways

1. Jason says:

How would anyone think to do either of these?

2. noble-servant says:

typo in 3rd display mode equation this one:
$$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.$$ it should be $$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.$$