Evaluating integral $\int_0^{2\pi}\frac{1}{2-\sin(x)}\,dx$

definite integralsintegration

I come across a problem, which is to evaluate: $$\int_0^{2\pi}\frac{1}{2-\sin(x)}\,dx$$
My attempt so far is:

$$\begin{align}\int_0^{2\pi}\frac{1}{2-\sin(x)}\,dx
&= \int_0^{2\pi}\frac{1}{2-\frac{2\tan(\frac{x}{2})}{1+\tan^2(\frac{x}{2})}}\,dx\\
&= \int_0^{2\pi}\frac{1+\tan^2(\frac{x}{2})}{2+2\tan^2(\frac{x}{2})-2\tan(\frac{x}{2})}\,dx\\
&= \int_0^{2\pi}\frac{\frac{1}{2} \sec^2(\frac{x}{2})}{1+\tan^2(\frac{x}{2})-\tan(\frac{x}{2})}\,dx\end{align}$$

I'm wondering whether I'm in the right direction and how can I proceed?

Best Answer

Note that because of periodicity, $\displaystyle \int_0^{2\pi} = \int_{-\pi}^{+\pi}.$

If you let $u = \tan\tfrac x2$ so that $\sin x= \dfrac{2u}{1+u^2}$ and $du = \dfrac{2\,du}{1+u^2},$ then as $x$ goes from $-\pi$ to $+\pi,$ $u$ goes from $-\infty$ to $+\infty.$

\begin{align} & \int_{-\pi}^{+\pi} \frac 1 {1+\tan^2(\frac{x}{2})-\tan(\frac{x}{2})} \big(\tfrac 1 2\sec^2\tfrac x 2 \,dx\big) \\[8pt] = {} & \int_{-\infty}^{+\infty} \frac 1 {1+u^2 - u} \, du \\[12pt] = {} & \int_{-\infty}^{+\infty} \frac 1 {(u-\frac 1 2 )^2 + \frac 3 4} \, du \quad \left( \begin{array}{c} \text{This is complet-} \\ \text{ing the square.} \end{array} \right)\\[10pt] = {} & \frac 4 3 \int_{-\infty}^{+\infty} \frac 1 {\left( \frac{2u-1}{\sqrt3} \right)^2 + 1} \, du \quad \left( \begin{array}{c} \text{Here we multiplied the} \\ \text{top and bottom by }4/3. \end{array} \right) \\[10pt] = {} & \frac 2 {\sqrt3}\int_{-\infty}^{+\infty} \frac 1 {\left( \frac{2u-1}{\sqrt3} \right)^2+1} \left( \tfrac 2 {\sqrt3} \, du \right) \\[10pt] = {} & \frac 2 {\sqrt3} \int_{-\infty}^{+\infty} \frac 1 {w^2+1} \, dw = \frac{2\pi}{\sqrt3}. \end{align}