Dear Uncle Colin,

I need to evaluate $\int_0^{\piby2} \frac{1}{1+\sin(x)}\dx$ but I end up with $\infty - \infty$ and that’s no good! How should I be doing it?

Big Integral, Not Exactly Trivial

Hi, BINET, and thanks for your message!

This is a fun problem! I can think of several possible approaches.

### What I suspect you did

The ‘obvious’ approach here is to multiply top and bottom by $(1-\sin(x))$, making the integral $\int_0^{\piby 2} \frac{1-\sin(x)}{\cos^2(x)}\dx$.

That can be rewritten as $\int_0^{\piby 2} \sec^2(x) - \sec(x)\tan(x) \dx$ and integrated as $\left[ \tan(x) - \sec(x) \right]_0^{\piby 2}$.

However, neither of the terms is defined at $\piby 2$, which is what you get when you divide by something that’s not defined throughout the interval ((OK, OK, it’s defined in the limit, but it’s still asking for trouble.))

### Approach 1: L’Hopital

The resulting integral is $\tan(x) - \sec(x)$, or $\frac{\sin(x) - 1}{\cos(x)}$. The numerator and denominator are both zero at $\piby 2$, so we can apply L’Hopital’s rule and say that the value in the limit is $\frac{\cos(x)}{-\sin(x)}$, which is zero.

The integral is then $[(0) - (-1)] = 1$.

### Approach 2: Symmetry

The original integral, $I= \int_0^{\piby 2} \frac{1}{1+\sin(x)}\dx$, is equal to $\int_{\piby 2}^{\pi} \frac{1}{1+\sin(x)}\dx$, because of symmetry. That means $2I = \int_0^{\pi} \frac{1}{1+\sin(x)}\dx$, or $\left[\tan(x) - \sec(x)\right]_0^\pi = 2$.

Again, $I= 1$.

### Approach 3: Substitution

If you use the substitution $u = \pi - x$ in the original integral, you wind up with $\int_0^{\piby 2} \frac{\cos(u) - 1}{\sin^2(u)} \d{u}$. That integrates to $\left[\cot(u) - \cosec(u)\right]_0^{\piby2}$.

Aha! That’s solved the problem at $\piby 2$! However, that comes at a price: neither term is defined at $u=0$.

However, we have small angle approximations. $\cosec(u)-\cot(u) = \frac{1-\cos(u)}{\sin(u)}$, which - for small $u$ - is very close to $\frac{u^2/2}{u}$, which approaches 0 in the limit. At $u=\piby 2$, the expression is 1, so we end up with 1 again.

I’m sure there are other ideas I haven’t considered! All the same, I hope one of these helps.

- Uncle Colin