<s>[INST] How do I integrate $\frac{\sqrt{1-k^2\sin^2 x}}{\sin x}$ How do I evaluate this indefinite integral, for $|k| < 1$:
$$
\int\frac{\sqrt{1-k^2\sin^2 x}}{\sin x}\mathrm{d}x
$$
I tried the change of variable $t=\sin x$, and obtained two integrals, but I can't integrate either. 
 [/INST] The following solution is based on a suggestion of lab bhattacharjee:
$\displaystyle\int \frac{\sqrt{1-k^2\sin^2 x}}{\sin x} dx=\int\frac{\sqrt{1-k^2\sin^2 x}}{\sin^{2} x}\cdot\sin x dx=\int\frac{\sqrt{1-k^2(1-\cos^{2}x)}}{1-\cos^{2}x}\cdot\sin x dx$.
Now let $t=\cos x$, $dt=-\sin x dx$ to get $\displaystyle -\int\frac{\sqrt{1-k^2+k^2t^2}}{1-t^2}dt$; then let $kt=\sqrt{1-k^2}\tan\theta$ to get
$\displaystyle-\int\frac{\sqrt{1-k^2}\sec\theta}{1-\frac{1-k^2}{k^2}\tan^{2}\theta}\cdot\frac{\sqrt{1-k^2}}{k}\sec^{2}\theta d\theta=k(k^2-1)\int\frac{\sec^{3}\theta}{k^2\sec^{2}\theta-\tan^{2}\theta}d\theta$
$=\displaystyle k(k^2-1)\int\frac{\sec\theta}{k^2-\sin^{2}\theta}d\theta=k(k^2-1)\int\frac{\cos\theta}{\cos^{2}\theta(k-\sin\theta)(k+\sin\theta)} d\theta$.
Now let $u=\sin\theta$, $du=\cos\theta d\theta$ and use $\cos^{2}\theta=1-\sin^{2}\theta$ to obtain
$\displaystyle k(k^2-1)\int\frac{1}{(1-u)(1+u)(k-u)(k+u)}du$.
Then $\frac{1}{(1-u)(1+u)(k-u)(k+u)}=\frac{A}{1-u}+\frac{B}{1+u}+\frac{C}{k-u}+\frac{D}{k+u}\Rightarrow A=B=\frac{1}{2(k^2-1)} \text{ and }C=D=\frac{-1}{2k(k^2-1)},$
so $\displaystyle \frac{k}{2}\int\left(\frac{1}{1-u}+\frac{1}{1+u}-\frac{1/k}{k-u}-\frac{1/k}{k+u}\right) du=\frac{k}{2}\left[\ln\left\vert\frac{1+u}{1-u}\right\vert-\frac{1}{k}\ln\left\vert\frac{k+u}{k-u}\right\vert\right]+C$
where $\displaystyle u=\sin\theta=\frac{kt}{\sqrt{ k^{2}t^{2}+1-k^2}}=\frac{k\cos x}{\sqrt{ k^2\cos^{2}x+1-k^2}}=\frac{k\cos x}{\sqrt{1-k^2\sin^{2}x}}$.
</s>