<s>[INST] Integral using trigonometric substitution I'd like to ask for feedback on my calculation for this integral:
$$\int{\frac{dx}{2-\cos{x}}}$$
Using half-angle substitution:
$$t = \tan{\frac{x}{2}}$$
$$\cos{x} = \frac{1-t^2}{1+t^2}$$
$$dx = \frac{2dt}{1+t^2}$$
So
$$\int{\frac{dx}{2-\cos{x}}} = \int{\frac{1}{2-\frac{(1-t^2)}{1+t^2}}}\cdot\frac{2dt}{1+t^2}$$
$$= 2\,\,\int{\frac{1}{2(1+t^2)-(1-t^2)}}\,\,dt$$
$$= 2\,\,\int{\frac{1}{3(\frac{1}{3}+t^2)}}\,\,dt$$
$$= \frac{2}{3}\,\,\int{\frac{1}{(\frac{1}{\sqrt(3)^2})+t^2}}\,\,dt$$
Integrating the expression
$$=\frac{2}{3}\frac{1}{\sqrt{3}}\cdot \tan^{-1}{(\frac{t}{\sqrt{3}})}+c$$
$$=\frac{2}{3\sqrt{3}}\cdot \tan^{-1}{(\frac{1}{\sqrt{3}}\tan{(\frac{x}{2})})}+c$$
I believe the last expression should have $\frac{2}{\sqrt{3}}$ and not $\frac{2}{3\sqrt{3}}$, but in my calculation this appears correct.  Any feedback would be greatly appreciated!
 [/INST] Note also that it is $\tan^{-1}(\sqrt 3t)$, not $\tan^{-1}\left(\frac{t}{\sqrt 3}\right)$.
Setting $t=\frac{1}{\sqrt 3}\tan\theta$ gives you
$$\begin{align}\frac 23\int\frac{1}{\left(\frac{1}{\sqrt 3}\right)^2+t^2}dt&=\frac 23\int\frac{1}{\frac 13+\frac 13\tan^2\theta}\cdot\frac{d\theta}{\sqrt 3\cos^2\theta}\\&=\frac 23\cdot\frac{1}{\frac 13\cdot \sqrt 3}\int d\theta\\&=\frac{2}{\sqrt 3}\tan^{-1}(\sqrt 3 t)+C\\&=\frac{2}{\sqrt 3}\tan^{-1}\left(\sqrt 3\tan\frac x2\right)+C\end{align}$$
</s>