<s>[INST] 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!
 [/INST] 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}}$$
</s>