Integration by trig substitution - Why can I draw a right triangle and use that to go back to the original variable? Suppose we are given an integral of the form $\int f(x) dx$ with $f(x)$ defined on $[a;b]$. 
We can then use inverse substitution using a function $g(t)$ defined over an interval $[\alpha;\beta]$ such that $g(\alpha) = a$ and $g(\beta) = b$. Also it makes the substitutation easier if $g(t)$ is one-to-one such that $g(t)^{-1}$ exists. 
Then $\int f(x) dx = F(x) = \int f(g(t))g^{'}(t) dt = F(g(t))$. So we have $F(g(t))$ as an anti-derivative of $f(x)$ with respect to the change of variable $x$ to $g(t)$. Since $g(t)$ is continous it has image $g([\alpha;\beta]) = [a;b]$, so we can evaluate $F(g(t))$ for any two points in the original interval $[a;b]$ to get values for $F(x)$ by using appropriate values for $t \in [\alpha;\beta]$, so indeed $F(g(t))$ is an anti-derivative of $F(x)$ with respect to the variable $x = g(t)$.
Now since we are dealing with an indefinite integral we must return the the original variable. We want an integral with $x$ instead of $t$, so we use the identity $x = g(t)$. In other words we are returning the original interval $[a;b]$. Then setting $g(t) = a/2$ yields $t = g^{-1}(a/2)$ so removal of terms involving $g(t)$ and $t$ in our integral $F(g(t))$ are trivial.
Please correct me if I am wrong about any of this.
In the case of trig substitution of the form $x = \sin(\theta)$ substitution back the the original integral involving $x$ is easy when terms are involving $\theta$ are trivial. However terms like $\cot(\theta)$ becomes much more difficult. I understand that using trig identities allow us to express $\cot(\theta)$ in terms of $x$, however I don't see why we can draw a right triangle with $\theta$ as the angle and then just divide two sides to get $\cot(\theta)$ in terms of $x$. Could someone explain why this is possible and right to do ? 
Thanks
Below I have attached an image for reference:
In this case we know that $sin(\theta) = x/3$. Why does this imply we can draw a triangle with side $\sqrt{9 - x^2}$ ? I see for any value of $\theta$, $x$ must be in proportion for the identity $sin(\theta) = x/3$ to be true.

 A: I think I see the core of your question from your last paragraph, your image, and your response in post. The essential answer to your question boils down to the definitions of the trig functions.
The definitions of the trigs are nothing more than definitions, and they are defined over right triangles with $\theta$ being either of the non-right angles. That is to say for example, as you surely know, $\sin\theta=\frac{opposite}{hypoteneuse}$. By geometric principles, given any two sides of any right triangle we can always find the third side by the theorem of Pythagoras. 
The technique of trigonometric substitution (like any other substitution) works when we can make a total substitution, and then completely reverse substitute the final result. In the case of succesful trig substitutions, we can always go back and call out the value of any of the trigs including $\cot \theta$. We can draw these because ALL of the trigs are defined over right triangles, and we can always find a third side given two. No one trig is more difficult to find than another over a right triangle with defined side lengths.
When all of the terms of an integral can be completely substituted by the method, the result, assuming you can find it, should always be re-translatable in to the original terms as all of the information required for the back substitution is included in the contents of a right triangle, as a trig of an angle is nothing more than the ratio of two sides of a right triangle. 
Given any of the 6 trigs with variable theta, we can always assign measures to two of three sides of a right triangle as that is how the trigs are defined, hence we can always define the third side. 
I hope this post is helpful, please let me know if it is less than clear. Trig sub is my favorite technique as far as methods go and so I am happy to have this out with you.
