unplebeian said:
... Rainbow_Child, may I ask you what inspiration led you for such a asubstitution? I mean what insight did you have (not joking, I am serious...assuming your steps are correct that's an incredible that you could 'see' that substitution was going to work)...
I didn' t "saw" the transformation from the begging, even though I would like to!

I construct it. The integral was not fitting in any "recipe" I know, so I started like looking for a transformation
\sin x=\sqrt{k\,f(u)},\quad d\,x=\frac{\sqrt{k}\,f'(u)}{2\,\sqrt{f(u)\,(1-k\,f(u))}}\,d\,u
and now the integral becomes
\int \frac{f'(u)}{2\,\sqrt{k}\,f(u)\,\sqrt{(1-k\,f(u))\,(1+f(u))}}\,d\,u
Now I want to get rid of the square root \sqrt{(1-k\,f(u))\,(1+f(u))}, so the easy way is to set it equal to u^2, but that will produce additional square roots if we solve for f(u).
The
"trick" is to the set u^2 the
fraction \frac{1+f(u)}{1-k\,f(u)}, so f(u)=\frac{u^2-1}{k\,u^2+1} and
(1+f(u))\,(1-k\,f(u))=\frac{1+f(u)}{1-k\,f(u)}\,(1-k\,f(u))^2=u^2\,\left(\frac{k+1}{k\,u^2+1}\right)^2
Putting all these together you have the answer! Maybe there is a quicker way, but I could think only that!
unplebeian said:
... I tried the following and it seems to work out.
Let u= sin^2(x) +k, to get sin^2(x)= u-k and hence cos(x)= sqrt(1-u+k)
dx= cosec(x)/(2 x cos(x)) which yields in
int (du/sqrt(1-u-k)) From there it's easy.
I think that your transformation leads to
\int \frac{1}{\2\,(u-k)\,\sqrt{u\,(-u+k+1)}}\,du
if I did correctly the calculations.