Evaluate $\int\frac{1}{\sin(x-a)\sin(x-b)}\,dx$ I'm stuck in solving the integral of $\dfrac{1}{\sin(x-a)\sin(x-b)}$. I "developed" the sin at denominator and then I divided it by $\cos^2x$ obtaining $$\int\frac{1}{\cos(a)\cos(b)\operatorname{tan}^2x-\cos(a)\sin(b)\operatorname{tan}x-\sin(a)\cos(b)\operatorname{tan}x+\sin(a)\sin(b)}\frac{1}{\cos^2x}dx$$ 
Then I made a substitution by $t=\operatorname{tan}x$ arriving to this $$\int\frac{1}{\cos(a)\cos(b)t^2-(\cos(a)\sin(b)+\sin(a)\cos(b))t+\sin(a)\sin(b)}dt$$ How can I solve it now? (probably I forgot something, it easy to make mistakes here) 
Thank you in advance!
 A: Hint for the original problem $\int\frac{1}{\sin(x-a)\sin(x-a)} \mathrm{d}x$:
$$\frac{1}{\sin(x-a)\sin(x-a)}=\csc^2(x-a) \; \mathrm{and}  \, \int{\csc^2u \,\mathrm{d}u}=-\cot u+C$$
A: Here is another way to perform the integral if you don't mind using complex numbers.
Let $z = e^{ix}, \alpha = e^{ia}$ and $\beta = e^{ib}$, we have
$$\begin{align}
& \int \frac{1}{\sin(x-a)\sin(x-b)} dx\\
= & \int \frac{1}{
\left(\frac{z\alpha^{-1}-\alpha z^{-1}}{2i}\right)
\left(\frac{z\beta^{-1}-\beta z^{-1}}{2i}\right)
}\frac{dz}{zi}\\
= & 4i\alpha\beta\int\frac{z dz}{(z^2-\alpha^2)(z^2-\beta^2)}\\
= & \frac{4i\alpha\beta}{\alpha^2-\beta^2}
\int\left(\frac{z}{z^2-\alpha^2} -\frac{z}{z^2-\beta^2}\right) dz\\
= & \frac{2i}{\alpha\beta^{-1} - \beta\alpha^{-1}}\left( \log(z^2 - \alpha^2) - \log(z^2-\beta^2)\right) + \text{const}\\
= & \frac{1}{\sin(a-b)} 
\log\left(\frac{z\alpha^{-1} - \alpha z^{-1}}{z\beta^{-1} - \beta z^{-1}}\right) + \text{const}'\\
=& \frac{1}{\sin(a-b)}\log\frac{\sin(x-\alpha)}{\sin(x-\beta)} + \text{const}'
\end{align}
$$
A: Looks like I am late in the race. Let me present you a slight different way to integrate it.
let $\displaystyle x = y + \frac{a+b}{2}$, and also let $\displaystyle  \frac{a-b}{2} = c$
$$\int \frac{1}{ \sin\left(y - \frac{a-b}{2}\right)\sin\left(y + \frac{a-b}{2}\right)} \, dx = \int \frac{1}{\sin(y-c) \sin(y+c)} \, dy  $$
Expanding this we get, 
$$\int \frac{1}{\sin^2(y) \cos^2(c) - \cos^2(y)\sin^2(c)}dy = \int \frac{\csc^2 (c) \sec^2(y) }{\tan^2(y) \cot^2(c) - 1} \, dy $$
Let, $\cot(c)\tan(y) = z$, then we get, 
$$\frac{1}{2 \cos(c)\sin(c)} \int \frac{1}{z^2 - 1}dz=\frac{1}{2 \cos(c)\sin(c)} \log \left( \frac{z-1}{z+1} \right ) $$
Substituting values, we get
$$\frac{1}{\sin(a-b)} \log \left( \frac{ \sin \left( -\frac{a-b}{2} + \left(x- \frac{a+b}{2}\right ) \right )}{ \sin \left( \frac{a-b}{2} + \left( x- \frac{a+b}{2}\right ) \right )} \right ) = \color{red}{\frac{1}{\sin(a-b)} \log \left( \frac{\sin(x-a)}{\sin(x-b)} \right ) + \mathrm{constant}}$$
A: Here is another approach to join the 'party' using a simple trigonometric technique.
$$
\begin{align}
&\int \frac{1}{\sin(x-a)\sin(x-b)} dx\\&=\frac{1}{\sin(a-b)}\int \frac{\sin(a-b)}{\sin(x-a)\sin(x-b)} dx\\
&=\frac{1}{\sin(a-b)}\int \frac{\sin((x-b)-(x-a))}{\sin(x-a)\sin(x-b)} dx\\
&=\csc(a-b)\int \frac{\sin(x-b)\cos(x-a)-\cos(x-b)\sin(x-a)}{\sin(x-a)\sin(x-b)} dx\\
&=\csc(a-b)\left[\int \frac{\sin(x-b)\cos(x-a)}{\sin(x-a)\sin(x-b)} dx-\int \frac{\cos(x-b)\sin(x-a)}{\sin(x-a)\sin(x-b)} dx\right]\\
&=\csc(a-b)\left[\int \frac{\cos(x-a)}{\sin(x-a)} dx-\int \frac{\cos(x-b)}{\sin(x-b)} dx\right]\\
&=\csc(a-b)\left[\int \frac{1}{\sin(x-a)}d(\sin(x-a))-\int \frac{1}{\sin(x-b)} d(\sin(x-b))\right]\\
&=\csc(a-b)\bigg[\ln|\sin(x-a)|-\ln|\sin(x-b)|\bigg]+\text{C}\\
&=\csc(a-b)\ln\left|\frac{\sin(x-a)}{\sin(x-b)}\right|+\text{C}.\\
\end{align}
$$
