# Evalutating an indefinit integral

How can I evaluate the following integral? $$\int\frac{\cos{x}}{1+\sin{2x}} dx$$

I tried the following way, but I was not able to proceed further: $$\begin{gather} I&=\int\frac{\cos{x}}{\left(\sin{x}+\cos{x}\right)^2} dx\\ &= \int\frac{\sec{x}}{\left(1+\tan{x}\right)^2} dx \end{gather}$$

• Hope you'll satisty with the solution. – Arpit Yadav Aug 12 '18 at 3:01

Hint:

Write numerator as $$2\cos x=\cos x+\sin x +(\cos x-\sin x)$$

Using lab bhattacharjee result,$$I=\int \frac{\cos x+ \sin x}{{(\cos x+ \sin x})^2}dx\space +\int \frac{\cos x-\sin x}{(\cos x+\sin x)^2}dx$$ $$I=I_1+I_2$$ $$I_1=\int \frac{1}{\cos x+\sin x}dx$$ $$I_1=\int\frac{1}{\sqrt2(\cos x\cdot\cos{\frac{\pi}{4}+\sin x\cdot \sin{\frac{\pi}{4}})}}dx$$ $$I_1=\int\frac{\sec(x-\pi/4)}{\sqrt2}dx$$ $$I_1=\frac{1}{\sqrt2}\cdot\ln[(\sec(x-\pi/4)+\tan(x-\pi/4)]+C_1$$ Now$$I_2=\int \frac{\cos x-\sin x}{(\cos x+\sin x)^2}dx$$ $$\sin x+\cos x=t\implies(\cos x-\sin x)dx=dt$$ $$I_2=\int\frac {1}{t^2}\space dt$$ $$I_2=-\frac{1}{t}+C_2=-\frac{1}{\sin x+\cos x}+C_2$$