Solve the integral $\int \frac{dx}{\sin \left(x\right)-\sin \left(a\right)}$ $$\int \frac{dx}{\sin \left(x\right)-\sin \left(a\right)}=\int \frac{dx}{2\sin \left(\frac{x-a}{2}\right)\cos \left(\frac{x+a}{2}\right)}$$
I'm stuck here, what substitution could work this out? 
 A: HINT:
Use $\sin x=\dfrac{2t}{1+t^2}$  where $t=\tan\dfrac x2$
to find $\sin x-\sin a=\dfrac{2t\csc a-(1+t^2)}{1+t^2}=-\dfrac{(t-\csc a)^2-\cot^2a}{1+t^2}$
A: HINT:
Use the Weierstrass substitution $t=\tan (x/2)$.  Then, $\sin(x)=\frac{2t}{1+t^2}$ and $dx=\frac{2}{1+t^2}\,dt$

SPOILER ALERT:  Scroll over the highlighted area to reveal the solution

$$\begin{align}\int \frac{1}{\sin(x)-\sin(a)}\,dx&=\int \frac{1}{\frac{2t}{1+t^2}-\sin(a)}\,\frac{2}{1+t^2}\,dt\\\\&=-2\csc(a)\int \frac{1}{(t^2-2\csc(a)t+1)}\,dt\\\\&=-2\csc(a)\int \frac{1}{(t-\csc(a))^2-\cot^2(a)}\,dt\\\\&=-\sec(a)\int \left(\frac{1}{t-\cot(a/2)}-\frac{1}{t-\tan(a/2)}\right)\,dt\\\\&=\sec(a)\left(\log(\tan(x/2)-\tan(a/2))-\log(\tan(x/2)-\cot(a/2))\right)+C\end{align}$$

A: Put the integral in standard form: $$\int\frac{dx}{\sin x-\sin a}=\frac{-1}{\sin a}\int\frac{dx}{1-\csc a\sin x}=\frac{-1}{\sin a}\int\frac{d\nu}{1+e\cos\nu}$$ where $e=\csc a>1$ is the eccentricity, and $\nu=x+\frac{\pi}2$ is the true anomaly. Then convert to hyperbolic anomaly:
$$\sinh H=\frac{\sqrt{e^2-1}\sin\nu}{1+e\cos\nu},\cosh H=\frac{\cos\nu+e}{1+e\cos\nu},dH=\frac{\sqrt{e^2-1}}{1+e\cos\nu}d\nu$$ so now
$$\int\frac{dx}{\sin x-\sin a}=\frac{-1}{\sin a\sqrt{e^2-1}}\int dH=\frac{-1}{\cos a}H+C$$ Since $$\tanh H=\frac{\sinh H}{\cosh H}=\frac{\sqrt{e^2-1}\sin\nu}{\cos\nu+e}=\frac{\cot a\sin\nu}{\cos\nu+\csc a}=\frac{\cos a\cos x}{1-\sin a\sin x}$$ our final result reads
$$\int\frac{dx}{\sin x-\sin a}=\frac{-1}{\cos a}\tanh^{-1}\left(\frac{\cos a\cos x}{1-\sin a\sin x}\right)+C$$ Perhaps not the first weapon of choice for a mathematician but natural for a physicist.
