# Definite Integral Problem using substitution $t=\tan(x/2)$

Solve $$\int_0^\pi \frac {x} {1+\sin x} dx$$ using $$\sin x = \frac {2\tan(x/2)} {1+\tan^2(x/2)}$$ and the substitution $$t = \tan(x/2)$$. I tried doing this but I got to a point where my integral limits were $$0$$ to $$\infty$$. This happened when I substituted for $$\tan(x/2)$$ Is there a way of doing this using this substitution only? And also why does this happen?

UPDATE: What I did - $$I = \int_0^\pi \frac {\pi-x} {1+\sin x} dx = \int_0^\pi \frac {\pi} {1+ \sin x} dx - I$$ Using $$\sin x = \frac {2\tan(x/2)} {1+\tan^2(x/2)}$$  $$2I = \int_0^\pi \frac {\pi} {1+\sin x} dx = \pi\int_0^\pi \frac {\sec^2(x/2)} {1+ \tan^2(x/2)+2 \tan(x/2)} dx$$ Now if there were no limits, this could've been solved easily by $$t = \tan x$$. But I can't do that because if I did, the limits would become $$0$$ to $$\infty$$. A way to solve this would be multiplying and dividing by $$1+ \sin x$$ but I don't want to do that. I want to use $$t=\tan x$$

• Maybe you should try integration by parts first to get rid of that free $x$ on the top there. – Bob Jones Mar 17 '17 at 8:00
• Set $x\rightarrow x-\pi$ and see what happpens..nearly the same question was asked a few days ago by the user @bui so have a look in his profile – tired Mar 17 '17 at 8:08

After the main symmetry trick, another symmetry trick and a rationalization: $$\int_{0}^{\pi}\frac{du}{1+\sin u}=2\int_{0}^{\pi/2}\frac{1-\sin u}{\cos^2 u}\,du =2\left[\tan u-\frac{1}{\cos u}\right]_{0}^{\pi/2}=\color{red}{\large2}.$$
• @AnswerQuicklyPlease: you still have to split the integration range in halves since $\sin(x)$ is not injective on $(0,\pi)$. And after that, rationalization leads to the solution way faster than the given substitution. – Jack D'Aurizio Mar 17 '17 at 9:44
If we must solve the problem with the suggested substitution, the integral becomes $$\int_0^\infty\frac{4\arctan t dt}{(1+t)^2}$$. The identity $$\int_0^\infty f(t)dt=\int_0^1\left(f(t)+\tfrac{1}{t^2}f\left(\tfrac{1}{t}\right)\right)dt$$ changes this to $$\int_0^1\frac{2\pi dt}{(1+t)^2}=\pi$$.
Hint. Alternatively, by the change of variable $u=\pi-x$, one gets $$I=\int_0^\pi \frac {x} {1+\sin x} dx=\int_0^\pi \frac {\pi-u} {1+\sin (\pi-u)} du=\pi\int_0^\pi \frac {1} {1+\sin u} du-I$$ the latter integral being easier to evaluate.