I've been trying to integrate $$\int\frac{dx}{(x-a)(x-b)}$$
By using the substitution $$x=a \cos^2 \theta + b \sin^2 \theta$$
The only problem here is I arrived at the result $$\frac{2}{a-b} \ln |\csc 2\theta - \cot 2\theta|+c$$
and I having trouble on how to substitute from $\theta$ to $x$.
You can use a Weierstrass substitution: $$t:=\tan\theta\implies\csc 2\theta-\cot 2\theta=\frac{1+t^2}{2t}-\frac{1-t^2}{2t}=t=\sqrt{\frac{x-a}{b-x}}$$since$$x-a=(b-a)\sin^2\theta,\,b-x=(b-a)\cos^2\theta.$$