<s>[INST] Find Value of $\int _{0}^{\frac{\pi}{2}} \frac{\cos x \:dx}{\sin^2 x+\cos x}$ Find Value of $$I=\int _{0}^{\frac{\pi}{2}} \frac{\cos x \:dx}{\sin^2 x+\cos x}$$
I have done in a very lengthy approach:
First i have written the Integrand as $$\frac{\cos x \:dx}{\sin^2 x+\cos x}=\frac{-\cos x}{\cos^2 x-\cos x-1}=-\left (\frac{A}{\cos x-p}+\frac{B}{\cos x-q}\right) $$
where $A=\frac{p}{p-q}$ and $B=\frac{q}{q-p}$ where $p$ and $q$ are roots of quadratic $\cos ^2 x-\cos x-1=0$
Now $$I=-A\int _{0}^{\frac{\pi}{2}}\frac{dx}{\cos x-p}+B\int _{0}^{\frac{\pi}{2}}\frac{dx}{\cos x-q}$$
In each of the above Integral use the substitution $\tan\left(\frac{x}{2}\right)=t$ and we get standard integrals.
Any other approach?
 [/INST] Let $\tan\frac{x}{2}=t$.
Thus, $$dt=\frac{1}{2\cos^2\frac{x}{2}}dx=\frac{1}{2}(1+t^2)dx.$$
Hence, $dx=\frac{2}{1+t^2}dt$ and
$$\int\limits_0^{\frac{\pi}{2}}\frac{\cos{x}}{\sin^2x+\cos{x}}dx=\int\limits_0^1\frac{\frac{1-t^2}{1+t^2}\cdot\frac{2}{1+t^2}}{\frac{4t^2}{(1+t^2)^2}+\frac{1-t^2}{1+t^2}}dt=2\int\limits_0^1\frac{t^2-1}{t^4-4t^2-1}dt=$$
$$=\int\limits_0^1\left(\frac{\sqrt5-1}{\sqrt5}\cdot\frac{1}{x^2+\sqrt5-2}-\frac{1+\sqrt5}{2\sqrt{5+2\sqrt5}}\left(\frac{1}{x+\sqrt{2+\sqrt5}}-\frac{1}{x-\sqrt{2+\sqrt5}}\right)\right)dt$$
and we get a very ugly answer.
</s>