<s>[INST] 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
 [/INST] $$\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.
</s>