Evaluate $\int_0^{\pi/2} \frac{1+2\cos x}{(2+\cos x)^2}$ I don’t know how to begin solving. Can I get a hint?
My failed attempt
Let $t =\tan (x/2)$
Then $$I =2 \int_0^1 \frac{(3-t^2)}{(3+t^2)^2 }$$
which I am not able to solve
 A: $$\int_0^\tfrac{\pi}{2} \frac{1 + 2\cos x}{(2 + \cos x)^2}{\rm d}x \\
= \int_0^\tfrac{\pi}{2} \frac{1 + 2\cos x}{(2 + \cos x)^2}\frac{/\sin^2 x}{/\sin^2 x} {\rm d}x \\
= \int_0^\tfrac{\pi}{2} \frac{\csc^2 x + 2\cot x \csc x}{(2\csc x + \cot x)^2}{\rm d}x \\
= \int_0^\tfrac{\pi}{2} \frac{-1}{(2\csc x + \cot x)^2}{\rm d}(2\csc x + \cot x) \\
= \left[\frac{1}{(2\csc x + \cot x)}\right]_0^\tfrac{\pi}{2}\\
= \left[\frac{\sin x}{(2 + \cos x)}\right]_0^\tfrac{\pi}{2} \\
= \frac{1}{2}$$ Hope it helps.
A: Since $1=\sin^2x+\cos^2x$, $1+2\cos x=\sin^2x+\cos x(2+\cos x)$, so the integrand is $\frac{\sin^2x}{(2+\cos x)^2}+\frac{\cos x}{2+\cos x}$. By the product rule, one antiderivative of this integrand is $\frac{\sin x}{2+\cos x}$, so $I=\frac{\sin\pi/2}{2+\cos\pi/2}=\frac12$.
If you'd prefer a solution using $t=\tan\tfrac{x}{2}$, follow it up with $t=\sqrt{3}\tan y$, reducing the problem to $\int_0^{\pi/6}\tfrac{2}{\sqrt{3}}\cos2ydy=\tfrac12$.
A: Continuing from your method is messy but possible:
Let $\frac{(3-t^2)}{(3+t^2)^2 } = \frac{A}{(3+t^2)} + \frac{B}{(3+t^2)^2}$. Then $3-t^2 = (3+t^2)A + B$. When $t = 0, 3 = 3A + B$, and when $t = 1, 2=4A+B$, so $A = -1, B= 6$. Thus:
$$I = -2 \int_0^1 \frac{1}{3+t^2} \ dt + 12 \int_0^1 \frac{1}{(3+t^2)^2} \ dt $$
For the second integral, substitute $t = \sqrt{3} \tan u, dt = \sqrt{3} \sec^2 u$. Then $(3+t^2)^2$ $ =(3(1 + \tan^2 u))^2 = 9 \sec^4 u$, and so:
$$I_2 = \frac{\sqrt{3}}{9} \int_0^1 \cos^2u \ du = \frac{\sqrt3}{18} \int_0^1 1+\cos2u \ du= \left[\frac{\sqrt3}{18} (u+\frac{1}{2} \sin 2u)\right]_0^1 = \left[\frac{\sqrt3}{18} (\tan^{-1} \frac{t}{\sqrt3}+\frac{1}{2} \sin(2(\tan^{-1}\frac{t}{\sqrt3}))\right]_0^1$$
and therefore:
$$I = -2 \left[\frac{1}{\sqrt 3} \tan^{-1} \frac{t}{\sqrt3}\right]_0^1+12\left[\frac{\sqrt3}{18} (\tan^{-1} \frac{t}{\sqrt3}+\frac{1}{2} \sin(2(\tan^{-1}\frac{t}{\sqrt3}))\right]_0^1$$
$$=-2(\frac{1}{6\sqrt3} \pi - 0) + 12 \cdot \frac{\sqrt{3}}{18}(\frac{\pi}{6}+\frac{\sqrt3}{4}-0) = \frac{1}{2}.$$
A: By substitution $u=\tan(\frac{x}{2})$ then $du=\frac{1}{2}\sec^2(\frac{x}{2})$.
Using the trigonometric formula, $\sin (x)=\frac{2u}{1+u^2}, \quad \cos(x)=\frac{1-u^2}{1+u^2}$ and $dx=\frac{2 du}{1+u^2}$.
When  you  do the required substitutions, you find a nice integral with rational expression, which can be solved by decomposition into simple elements.
A: Hint
Like How to integrate $\int \frac{\cos(x) + \sqrt 3}{1+ 4 \sin(x+\frac{\pi}{3}) + 4\sin^2(x+\frac{\pi}{3})}{\rm d}x$,
find $$\dfrac{dy}{dx}$$ where $$y=\dfrac{a\sin x+b\cos x+c}{2+\cos x}$$
Compare the coefficients of $\sin x,\cos x,\sin x\cos x$ and the constant to find the arbitrary constants $a,b,c$
