# 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)}$$

You can verify that the factor $\sqrt{\frac{\csc{\left(x\right)}-\cot{\left(x\right)}}{\csc{\left(x\right)}+\cot{\left(x\right)}}}$ is equal to $\left|\tan{\frac{x}{2}}\right|$. This strongly suggests that the tangent half-angle substitution would be a more natural choice here.

We find that for $\theta\in[0,\frac{\pi}{2}]$,

\begin{align} I{\left(\theta\right)} &=\int_{0}^{\theta}\frac{\sec{\left(x\right)}}{\sqrt{1+2\sec{\left(x\right)}}}\sqrt{\frac{\csc{\left(x\right)}-\cot{\left(x\right)}}{\csc{\left(x\right)}+\cot{\left(x\right)}}}\,\mathrm{d}x\\ &=\int_{0}^{\theta}\frac{\sec{\left(x\right)}}{\sqrt{1+2\sec{\left(x\right)}}}\sqrt{\tan^{2}{\left(\frac{x}{2}\right)}}\,\mathrm{d}x\\ &=\int_{0}^{\tan{\left(\frac{\theta}{2}\right)}}\frac{\frac{1+t^2}{1-t^2}\cdot t}{\sqrt{1+2\frac{1+t^2}{1-t^2}}}\cdot\frac{2}{1+t^2}\,\mathrm{d}t;~~~\small{\left[\tan{\left(\frac{x}{2}\right)}=t\right]}\\ &=\int_{0}^{\tan^{2}{\left(\frac{\theta}{2}\right)}}\frac{\mathrm{d}u}{\sqrt{\left(1-u\right)\left(3+u\right)}};~~~\small{\left[t=\sqrt{u}\right]}\\ &=\int_{\frac12}^{\frac12\sec^{2}{\left(\frac{\theta}{2}\right)}}\frac{\mathrm{d}w}{\sqrt{1-w^2}};~~~\small{\left[\frac{1+u}{2}=w\right]}\\ &=\arcsin{\left(\frac12\sec^{2}{\left(\frac{\theta}{2}\right)}\right)}-\arcsin{\left(\frac12\right)}.\blacksquare\\ \end{align}

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}$$