<s>[INST] How to evaluate $\int \sqrt{\frac{\csc x-\cot x}{\csc x+\cot x}}\frac{\sec x}{\sqrt{1+2\sec x}}dx$ $$\int \sqrt{\frac{\csc x-\cot x}{\csc x+\cot x}}\frac{\sec x}{\sqrt{1+2\sec x}}dx$$
$$\int \frac{1}{\csc x+\cot x}\frac{\sec x}{\sqrt{1+2\sec x}}dx$$
This becomes $$-\int\frac{dt}{(t^2+t)\sqrt{t^2+2t}} $$ after putting $\cos x=t$. Solution to this is obtained by putting $t=\frac{1}{p}$
Hence finally I get $$\int \sqrt{\frac{\csc x-\cot x}{\csc x+\cot x}}\frac{\sec x}{\sqrt{1+2\sec x}}dx=ln(2\sec x+1)+ln\Big(\frac{\sqrt{2\sec x+1}+1}{\sqrt{2\sec x+1}-1}\Big)$$
But the answer given is $$\sin^{-1}{\Big( \frac{1}{2}\sec^2\frac{x}{2}\Big)}$$
 [/INST] Let $$I = \int\sqrt{\frac{\csc x-\cot x}{\csc x+\cot x}}\cdot \frac{\sec x}{\sqrt{1+2\sec x}}dx = \int\sqrt{\frac{\csc x-\cot x}{\csc x+\cot x}\cdot \frac{\csc x-\cot x}{\csc x-\cot x}}\frac{\sec x}{\sqrt{1+2\sec x}}dx$$
So $$I = \int\frac{\csc x-\cot x}{\sqrt{\csc^2 x-\cot^2 x}}\cdot \frac{\sec x}{\sqrt{1+2\sec x}}dx$$
So $$I = \int\frac{1-\cos x}{\sin x}\times \frac{1}{\cos x}\times \frac{\sqrt{\cos x}}{\sqrt{2+\cos x}}dx$$
So $$I = \int\frac{1-\cos x}{\sin x}\times \frac{1}{\sqrt{\cos x}\sqrt{2+\cos x}}dx$$
So $$I = \int\frac{2\sin^2 \frac{x}{2}}{2\sin \frac{x}{2}\cos \frac{x}{2}}\times \frac{1}{\sqrt{2\cos^2 \frac{x}{2}-1}}\times \frac{1}{2\cos^2 \frac{x}{2}+1}dx$$
So $$I = \frac{\tan \frac{x}{2}}{\sqrt{4\cos^4 \frac{x}{2}-1}}dx = \frac{1}{2}\int\frac{\tan \frac{x}{2}\sec^2 \frac{x}{2}}{\sqrt{1-\left(\frac{1}{2}\sec^2 \frac{x}{2}\right)^2}}dx$$
Now Put $\displaystyle \frac{1}{2}\sec^2 \frac{x}{2} = t\;,$ Then $\displaystyle \frac{1}{2}\tan \frac{x}{2}\sec^2 \frac{x}{2}dx = dt$
So we get $$I = \int\frac{1}{\sqrt{1-t^2}}dt = \sin^{-1}(t)+\mathcal{C} = \sin^{-1}\left( \frac{1}{2}\sec^2 \frac{x}{2}\right)+\mathcal{C}$$
</s>