# Homework Help: Evaluating definite integral

1. Mar 24, 2013

### Saitama

1. The problem statement, all variables and given/known data
$$\int_{0}^{2\pi} \frac{dx}{1+e^{\sin x}}$$

2. Relevant equations

3. The attempt at a solution
Let $I=\int_{0}^{2\pi} \frac{dx}{1+e^{\sin x}}$

Since $\int_{a}^{b}f(x) dx=\int_{a}^{b} f(a+b-x)dx$
Hence,
$$I=\int_{0}^{2\pi} \frac{dx}{1+e^{-\sin x}}=\int_{0}^{2\pi} \frac{e^{\sin x}dx}{1+e^{\sin x}}$$

$$2I=\int_{0}^{2 \pi}dx$$
$$I=\pi$$

This is the right answer but when I try it with the following method it turns out to be zero.

Let $\sin x=t$ or $\cos xdx=dt$. Multiply the numerator and denominator by $\cos x$ & $\cos x=\sqrt{1-t^2}$
The integral transforms to
$$I=\int_{0}^{0} \frac{dt}{\sqrt{1-t^2} (1+e^t)}$$
Both the upper and lower limits are zero. The value of I should be zero. What have I done wrong?

Any help is appreciated. Thanks!

2. Mar 24, 2013

### ShreyasR

Yo Naruto fan :)
Last year i was confused with the same problem... when a trigonometric function is applied to 0 or 2∏, we get the same result... As trigonometric functions are periodic. You can draw a graph and u can see that the area under the curve is not 0. This implies that you can not substitute a trigonometric function like "sin x" with a variable like "t" when the difference between the upper and lower limits is greater than ∏/2... It doesn't appear wrong... but it is something like to prove LHS=RHS by multiplying both sides of an equation with zero...!
Hope this helped!

3. Mar 24, 2013

### jfgobin

Hello there,

Be careful with:

$\cos x = \sqrt{1- \sin^{2} x}$​

In particular, for $0 \le x \le 2\,\pi$:

$\cos x = \left \{ \begin{array}{ll} \sqrt{1- \sin^{2} x} & 0 \le x \le \pi/2\\ -\sqrt{1- \sin^{2} x} & \pi/2 < x \le 3\,\pi/2 \\ \sqrt{1- \sin^{2} x} & 3\,\pi/2 < x \le 2\,\pi \end{array}\right .$​

In your case, split the integral in 3 cases, and go ahead.

4. Mar 24, 2013

### Curious3141

JFGobin has provided the correct explanation, but you should note that once you split the integral up, you don't really save any work - you basically need to do the same thing you did the first time to get the result (plus at one point you need to evaluate $\displaystyle \int_{-1}^{1}\frac{1}{\sqrt{1-t^2}}dt$, which is easy, but still extra work). You do get the same answer though (I checked).

5. Mar 24, 2013

### Saitama

Thank you Curious and jfgobin!

The given integral can be separated into three integrals.
$$I=\int_{0}^{\pi/2} \frac{\cos x}{\sqrt{1-\sin^2x}(1+e^{\sin x})}dx-\int_{\pi/2}^{3\pi/2} \frac{\cos x}{\sqrt{1-\sin^2x}(1+e^{\sin x})}dx+\int_{3\pi/2}^{2\pi} \frac{\cos x}{\sqrt{1-\sin^2x}(1+e^{\sin x})}dx$$
Using the substitution $\sin x=t$.
$$I=\int_{0}^{1} \frac{dt}{\sqrt{1-t^2}(1+e^t)}+\int_{-1}^{1} \frac{dt}{\sqrt{1-t^2}(1+e^t)}+\int_{-1}^{0} \frac{dt}{\sqrt{1-t^2}(1+e^t)}$$
$$I=I_1+I_2+I_3$$

I did a change of variable in $I_3$, I substituted $t=-x$ or $dt=-dx$. The integral $I_3$ transforms to
$$I_3=\int_{1}^{0} \frac{-dx}{\sqrt{1-x^2}(1+e^{-x})}$$
which is equivalent to
$$I_3=\int_{0}^{1} \frac{e^tdt}{\sqrt{1-t^2}(1+e^{t})}$$

Now I can add $I_3$ and $I_1$. I end up with this:
$$I=\int_{0}^{1} \frac{dt}{\sqrt{1-t^2}}+\int_{-1}^{1} \frac{dt}{\sqrt{1-t^2}(1+e^t)}$$
But my expression doesn't include the integral mentioned by Curious3141.

6. Mar 24, 2013

### Dick

$I_1+I_3=I_2$. So if $I_1+I_3=\int_{0}^{1} \frac{dt}{\sqrt{1-t^2}}$ then $I=2\int_{0}^{1} \frac{dt}{\sqrt{1-t^2}}=\int_{-1}^{1} \frac{dt}{\sqrt{1-t^2}}$ (because the integral is symmetric in t).

7. Mar 24, 2013

### Saitama

How do you get a factor of 2?

$$I_1=\int_0^1 \frac{dt}{\sqrt{1-t^2}(1+e^t)}$$
$$I_3=\int_0^1 \frac{e^t dt}{\sqrt{1-t^2}(1+e^t)}$$

$$I_1+I_3=\int_0^1 \frac{dt}{\sqrt{1-t^2}}$$

How do you get $I_1+I_3=I_2$?

8. Mar 24, 2013

### Dick

Look back at the expressions you started with for I1, I2 and I3. I3 integrates $\frac{dt}{\sqrt{1-t^2}(1+e^t)}$ from -1 to 0, I1 integrates from 0 to 1. Put them together and it's the same as integrating -1 to 1. Which is I2.

9. Mar 24, 2013

### Saitama

Silly me.

Thanks a lot, Dick!