It was given to integrate $$I=\int\sqrt{\frac{\sin(x-\alpha)}{\sin(x+\alpha)}} \; dx.$$
Attempt:
\begin{align}I&= \int\sqrt{\frac{\sin((x+\alpha)-2\alpha)}{\sin(x+\alpha)}}\; dx\\&= \sqrt{\sin 2\alpha}\int\sqrt{\cot 2\alpha - \cot (x+\alpha)}\;dx\; .\end{align}
Then I took \begin{align}\cot 2\alpha - \cot (x+\alpha)= z^2 \\ \implies [1 + \cot^2(x+\alpha)]\;dx= 2z\;dz\\ \implies [1+\{\cot 2\alpha - z^2\}^2]\; dx= 2z\;dz\; .\end{align}
Now, \begin{align}\int\sqrt{\cot 2\alpha - \cot (x+\alpha)}\; dx\\ &= \int\frac{z\cdot 2z}{1+\{\cot 2\alpha - z^2\}^2}\;dz\\ &= \int\frac{2}{\dfrac{(1+ \cot^2 2\alpha)}{z^2} + z^2 -2\cot2\alpha}\; dz\\ &= \int \frac{\left(1+ \dfrac{\sqrt{(1+ \cot^2 2\alpha)}}{z^2}\right)+ \left(1- \dfrac{\sqrt{(1+ \cot^2 2\alpha)}}{z^2}\right)}{\dfrac{(1+ \cot^2 2\alpha)}{z^2} + z^2 -2\cot2\alpha}\; dz \; .\end{align}
This makes me to break the integral to get \begin{align}\int\sqrt{\cot 2\alpha - \cot (x+\alpha)}\; dx\\ &= \int \frac{\left(1+ \dfrac{\sqrt{(1+ \cot^2 2\alpha)}}{z^2}\right)+ \left(1- \dfrac{\sqrt{(1+ \cot^2 2\alpha)}}{z^2}\right)}{\dfrac{(1+ \cot^2 2\alpha)}{z^2} + z^2 -2\cot2\alpha}\; dz\\ \\ &= \int\frac{\left(1+ \dfrac{\sqrt{(1+ \cot^2 2\alpha)}}{z^2}\right)}{\left(z-\dfrac{\sqrt{(1+ \cot^2 2\alpha)}}{z}\right) +\text{const.}}\; dz +\int\frac{\left(1- \dfrac{\sqrt{(1+ \cot^2 2\alpha)}}{z^2}\right)}{\left(z+\dfrac{\sqrt{(1+ \cot^2 2\alpha)}}{z}\right) +\text{const.}}\; dz \\ &=-\frac{1}{z- \dfrac{(1+ \cot^2 2\alpha)}{z}}-\frac{1}{z+ \dfrac{(1+ \cot^2 2\alpha)}{z}} .\end{align}
So, $$I= -\sqrt{\sin 2\alpha}\left(\frac{1}{z- \dfrac{(1+ \cot^2 2\alpha)}{z}}+\frac{1}{z+ \dfrac{(1+ \cot^2 2\alpha)}{z}}\right)\; .$$
Unfortunately, my book gave the answer as $$I= \cos\alpha \cos^{-1} (\cos x\sec\alpha) - \sin\alpha\log\left(\sin x+ \sqrt{\sin^2 x - \sin^2\alpha}\right)\; .$$
This is not near to my solution; I've made somewhere a big plunder.
So, could anyone please tell me where I did mistake? Is my attempted technique wrong?