Integration by substitution trig

I need to integrate $\frac {1}{2-\cos x}$ and I am given $t=\tan(x/2)$. What should I do with it?

-
What did you try ? –  Amr Jan 3 '13 at 3:20
$\sin x=\frac {2t}{1+t^2}$ and $\cos x=\frac {1-t^2}{1+t^2}$ –  bbr4in Jan 3 '13 at 3:23
Where are you stuck? –  Ron Gordon Jan 3 '13 at 3:30
I have $dt/dx=(1/2) \sec^2 (x/2)$ –  bbr4in Jan 3 '13 at 3:33
Can you write $\sec^2{(x/2)}$ in terms of $t$? If so, then the integral is relatively straightforward. –  Ron Gordon Jan 3 '13 at 3:34

$$t=\tan\frac{x}{2}\Longrightarrow x=2\arctan t\Longrightarrow dx=\frac{2}{1+t^2}dt\Longrightarrow$$

$$\int\frac{dx}{2-\cos x}=2\int\frac{dt}{1+t^2}\cdot\frac{1}{2-\frac{1-t^2}{1+t^2}}=2\int\frac{dt}{1+3t^2}=\ldots$$

And now you're left with a rather easy, almost immediate, integral.

-
Shouldn't the second equation be $x = \arctan 2t$? –  Calvin Lin Jan 3 '13 at 3:51
No. It is $$t=\tan\frac{x}{2}\,$$ not $$t=\frac{\tan x}{2}$$ –  DonAntonio Jan 3 '13 at 3:54
Ah, my bad. You're right. –  Calvin Lin Jan 3 '13 at 4:01