integration by substitution, using $\;t = \tan \left(\frac 12 x\right)$

$\displaystyle\int_0^\frac{\pi}{2}\frac{1}{2-\cos x} \, dx$ using the substitution $t=\tan\frac{1}{2}x$

• $x=2\tan^{-1}t$

• $\dfrac{dx}{dt}=\dfrac{2}{1+t^2}$

• $dx=\dfrac{2}{1+t^2}\,dt$

• $\displaystyle\int_0^1 \left(\frac{1}{2-\cos x}\right)\left(\frac{2}{1+t^2}\right)\,dt$

Is this the right idea? If so what do I do next?

$\displaystyle\int_0^1\left(\frac{1}{2-\frac{1-t^2}{1+t^2}}\right) \,\left(\frac{2}{1+t^2}\right)\, dt$

$\displaystyle\int_0^1\frac{2}{1+3t^2}\,dt$

$=2\left[\frac{\ln(1+3t^2)}{6t}\right]_0^1$

-
Can you express $\cos x$ in terms of $t$ to complete the substitution? –  Mark Bennet May 19 '13 at 17:44
And also note that you need to attend to the limits of your integral. –  Mark Bennet May 19 '13 at 17:46
The reason that the $t=\tan \frac x 2$ substitution (sometimes called the Weierstrass Substitution) is so useful, is that $\sin x = \cfrac {2t}{1+t^2}$ and $\cos x = \cfrac{1-t^2}{1+t^2}$ - so it reduces trigonometric integrals to integrals of rational functions. The formulae should remind you of Pythagoras. Your first task is to prove these formulae, and then investigate online, so that you have a strong grasp of what is going on here. This simple substitution is a first introduction to some important mathematical ideas. –  Mark Bennet May 19 '13 at 18:04
Well this substitution parametrizes the unit circle. The idea is considerably generalised in the study of algebraic curves in algebraic geometry. –  Mark Bennet May 19 '13 at 18:14
After substituting, I think you should be at $\int_0^1 \frac{2\,dt}{1+3t^2}$. The substitution $\sqrt{3}t=u$ then gets us to the end. –  André Nicolas May 19 '13 at 19:21

If $\;t = \tan\left(\frac 12 x\right)$, xo $\,x = 2\tan^{-1}t,\,$ what should $\dfrac 1{2 - \cos x}$ then be?

We need to replace the function (integrand) of $x$ to one expressed as a function of $t$.

What are the new limits for $\,t\,$ if $\;t = \tan\left(\frac 12 x\right)$?

When $x = 0,\;$ $t = \tan\left(\frac 02\right) = 0$. Okay. But, when $x = \pi/2$, the upper limit of integration needs to be $t = \tan\left(\pi/4\right)$

See Weierstrass Substitution for why $\;\cos x = \dfrac{1-t^2}{1+t^2},\;$ and in general, for the logic of using "$t$-substitution": $t = \tan \frac x2$.

After substituting all of the above, we should have the integrand:

$$\frac{1}{2-\dfrac{1-t^{2}}{1+t^{2}}}\frac{2}{1+t^{2}}=\frac{2}{2(1+t^{2})-(1-t‌​^{2})}=\frac{2}{1+3t^{2}}=\frac{2}{1+(\sqrt{3}t)^{2}}$$

So we have

$$\int_0^1 \frac{2}{1+(\sqrt{3}t)^{2}}\,dt = 2\int_0^1 \frac{1}{1+(\sqrt{3}t)^{2}}\,dt\tag{1}$$

Now, I'm afraid to say, the work isn't done yet. We cannot use $\ln|f(t)|$ where $f(t) =1 + \sqrt{3}t)^{2}$ because we do not have an integrand in the form of $\;\dfrac{f'(t)}{f(t)} \,dx$.

But we're all set up with $(1)$ to use the substitution $$u = \sqrt 3 t.\,\implies du = \sqrt 3 dt \implies dt = \dfrac{1}{\sqrt 3} du$$

Then we have an integrand of the form $$2 \int_0^{\sqrt 3} \dfrac{1}{\sqrt 3} \dfrac{1}{1 + u^2}\,du = \dfrac{2}{\sqrt 3}\int_0^{\sqrt 3} \dfrac{1}{1 + u^2}\,du\tag{2}$$

Now, we recall that $$\int \dfrac {1}{1 + u^2} \,du = \tan^{-1}u + C\tag{\star}$$

Can you try and finish it from here? Apply $\star$ to the integral given by $(2)$

$(\star)$ See trigonometric substitution for integrals involving $a^2 + u^2$, where $a$ is a constant. Our integral is of the same form, with $a = 1$:

$$\int \frac{du}{a^2 + u^2} = \frac 1a\tan^{-1}\left(\frac ua\right)\,+ C$$

-
$\int_{0}^1$ --- –  maxmitch May 19 '13 at 17:52
Yes, indeed. You answered before I finished writing...;-) –  amWhy May 19 '13 at 17:55
So you multiply out $\int_{0}^\frac{\pi}{2} \left(\frac{1}{2-\cos x}\right)\left(\frac{2}{1+t^2}\right)\,dt$ and then put the new limits in? and then what do you do about the $cosx$? –  maxmitch May 19 '13 at 17:57
@maxmitch - as soon as you change $dx$ to $dt$ in the integral, you need to put in the limits for $t$ instead of the ones for $x$. –  Mark Bennet May 19 '13 at 18:06
Note that for $t = \tan\left(x/2\right)$, we have $\;\cos x= \dfrac{1-t^2}{1+t^2}$ –  amWhy May 19 '13 at 18:12

Hint:

When $\tan \dfrac{x}{2}=t$ you have $\cos x= \dfrac{1-t^2}{1+t^2}$

-
If $x=2\arctan t$ then $\cos x = \cos\left(2\arctan t\right)$. Use the fact that $\cos(2u)=\cos^2u-\sin^2u$. So you get $$\cos x = \cos^2\left(\arctan t \right) -\sin^2\left(\arctan t \right)$$
If $\varphi=\arctan t$ then $\dfrac t1=t = \tan\varphi=\dfrac{\text{opposite}}{\text{adjacent}}$, so $\cos\varphi=\dfrac{\text{adjacent}}{\text{hypotenuse}}$. So $\text{opposite}=t$, $\text{adjacent}=1$, and by the Pythagorean theorem $\text{hypotenuse}=\sqrt{1+t^2}$.
Then $\cos=\dfrac{\text{adjacent}}{\text{hypotenuse}}$ and so $$\cos^2(2\arctan t) = \cos^2 (\cdot)-\sin^2(\cdot) = \left(\frac{1}{\sqrt{1+t^2}}\right)^2 - \left(\text{something similar}\right)^2 = \cdots\cdots$$