Integrate a rational function with a denominator in the form a - cos(x) I am preparing for a basic level calculus test and came across this problem:
$$ \int_0^{\pi/2} \dfrac{1}{2-\cos{x}} dx$$
Which appears to be simple enough before I realize that I can't multiply the top and bottom by $ 2+\cos{x} $ and get anywhere fast.  The prompt and Wolfram Alpha suggest a u-substitution of $ u = \tan{\frac{x}{2}} $ but I really have no idea how to implement that.  How is this substitution used?  Is this even an appropriate problem for my current level of math knowledge?
 A: hint: use the sub $u = \tan( x/2), \cos t = \frac{1-u^2}{1+u^2}$ and some partial fraction.
differencing you get $$du = (1 + u^2) dx/2,  x = 0 \to u = 0, x = \pi/2\to u = 1$$ therefore the $\int_0^{\pi/2} \frac{dx}{2-\cos x}$ is transformed into 
$$\int_0^1 \frac{2du}{(1 + u^2} \frac{1}{\left(2 - \frac{1-u^2}{1+u^2}\right)}
=2 \int_0^1\frac{du}{3u^2 + 1} = \frac{2}{3} \int_0^1 \frac{du}{u^2 + 1/3}$$
can you continue now?
A: We start with 
$$\int_0^{\pi/2} \dfrac{1}{2-\cos{x}} dx$$
Let's start as you suggest and see where it takes us, multiplying top and bottom by $2 + \cos x$.
$$ \int_0^{\pi/2} \frac{2 + \cos x}{4 - \cos^2 x} dx = \int_0^{\pi/2} \frac{2 + \cos x}{3 + \sin^2 x} dx.$$
The mathematics of wishful thinking suggests that we split this integral and handle the easy part first.
$$ \int_0^{\pi/2} \frac{\cos x}{3 + \sin^2 x} dx = \int_0^1 \frac{1}{3 + u^2} du$$
when we perform the substitution $u = \sin x$. This is now a classic inverse trigonometric integral, and will lead you to $\arctan$.
What did we leave behind? We left
$$ \int_0^{\pi/2} \frac{2}{3 + \sin^2 x} dx.$$
This looks a bit tricky. One way to proceed is to recognize $3 = 3\sin^2 x + 3 \cos^2 x$, so that we have
$$ \int_0^{\pi/2} \frac{2}{3 \cos^2 x + 4\sin^2 x} dx.$$
Now multiplying by $\sec^2(x)/\sec^2(x)$ gives
$$\int_0^{\pi/2} \frac{2 \sec^2 x}{3 \cot^2 x + 4} dx.$$
Now you can finish with the substition $u = 3\cot^2 x + 4$.
Is this what I'd recommend? It's hard to say. The substitution you mention is a well-known substitution. But it's important to recognize that with these problems, as long as you follow your nose and charge forward, you'll probably reach a resolution.
