# Solving an integral with trig substitution

I'm looking to solve the following integral using substitution:

$$\int \frac{dx}{2-\cos x}$$

Let $z=\tan\frac{x}{2}$

Then $dz=\frac 1 2 \sec^2 \frac x 2\,dx$

$$\sin x=\frac{2z}{z^2+1}$$

$$\cos x =\frac{1-z^2}{z^2+1}$$

$$dx=\frac{2\,dz}{z^2+1}$$

$$\int \frac{dx}{2-\cos x} = \int \frac{\frac{2\,dz}{z^2+1}}{2-\frac{1-z^2}{z^2+1}} =\int \frac{2\,dz}{3z^2+1}$$

But this is where things start to look at bit sticky. If I integrate this last fraction, then I get a very complex expression that seems to defeat the point of z-substitution. Any suggestions for where I may be going wrong?

Thanks!

Edit:

Thank you for your feedback. I've completed my work as per your suggestions:

$$\int \frac{2\,dz}{3z^2+1} = 2\cdot\left(\frac{\tan^{-1} \frac{z}{\sqrt{3}}}{\sqrt{3}} \right) = \frac{2\tan^{-1} \left(\sqrt{3}\tan{\frac{x}{2}}\right)}{\sqrt{3}}+c$$

• $2(z^2+1)-(1-z^2)=2z^2+z^2+2-1=3z^2+1$ May 19 '15 at 20:01
• last denominator should be $3z^2+1$
– WW1
May 19 '15 at 20:01
• Look up arctan(x) derivative May 19 '15 at 20:02
• Similar problems (and maybe exactly this one, too) have already been answered on MSE many times. Use the Weierstrass half-angle substitution, the residue theorem or both. May 19 '15 at 20:10

HINT:

$$\int \frac{1}{a^2+x^2}dx=\frac1a \arctan(x/a)+C$$