why does $\displaystyle -3 cot^{-1} \frac{3}{\sqrt{x^2-9}} = 3 tan^{-1} \frac{3}{\sqrt{x^2-9}}$ ??
I get their difference is
$\displaystyle \begin{align*}&\frac{3\pi}{2} \;\; \{x: \left|x\right| < 3 \} \\ \\ &\frac{-3\pi}{2} \;\; \{x: \left|x \right| \geq 3 \} \end{align}$
so I wouldn't call them equal. Why do you think they are?
Ok, I show that the derivatives of each of these expressions do indeed equal the integrand but remember that there is a constant of integration when you integrate. So the two expressions you have that integral equal to can in fact differ by a constant, which they apparently do.
Given any right angle triangle with legs A and B and hypotenuse C it's pretty easy to show that: $\displaystyle \tan^{-1}(B/A) = \frac {\pi} 2 - cot^{-1}(A/B)$. Hence $\displaystyle 3 \tan^{-1}(B/A)+ 3 cot^{-1}(A/B) = \frac {3 \pi} 2$.