PPS I think I understand the point of the triangle now. In this case, we have a triangle with adjacent side ##3## and opposite side ##\sqrt{x^2 - 9}## and a hypoteneuse of ##x##.
We are free to pick any trig substitution:
$$\cos \theta = \frac 3 x, \ \sec \theta = \frac x 3, \ \sin \theta = \frac{\sqrt{x^2 - 9}}{x}, \tan \theta = \frac{\sqrt{x^2 - 9}}{3}$$They are all essentially the same in terms of the relationship between ##x## and ##\theta##. It's really just a question of which one looks simplest. I picked ##\sec \theta## without drawing the triangle, because that looked the natural substitution to me.
Whatever you do, you should end up with the integral of ##\tan^2 \theta## and an intermediate answer of ##3\tan \theta - 3\theta + C##.
At this point, you can then use any of the trig functions from the triangle to express ##\theta##. I used ##x = 3\sec \theta##, because that was the substitution I originally used. But, it's equally valid to note that we also know that ##\tan \theta = \frac{\sqrt{x^2 - 9}}{3}##, and use the inverse of that.
This also explains why all the answers are valid. We can express ##\theta## in several different ways in terms of ##x##. Just look at the triangle:
$$\cos \theta = \arccos(\frac 3 x), \ \theta = arcsec(\frac x 3), \ \theta = \arcsin(\frac{\sqrt{x^2 - 9}}{x}), \ \theta = \arctan(\frac{\sqrt{x^2 - 9}}{3})$$This explains the point of drawing the triangle: you have all these different equations at your fingertips.