What is $\int \frac{ \sqrt{(a^2 - x^2)}}{x^2}$? I tried the following trig substitution:
$x = a\sin \theta$
$$ \int \frac{ \sqrt{(a^2 - x^2)}}{x^2} = \int \frac{\sqrt{a^2 - a^2 \sin^2 \theta}}{a^2 \sin^2 \theta} = \int \frac{a \cos \theta}{a^2 \sin^2}$$
Setting  $u = \sin x$ yields:
$$\frac{1}{a} * \int u^{-2} = - \frac{1}{a \sin \theta}$$
However my textbook states that the answer should really be:
$$ -\frac{\sqrt{a^2 - x^2}+x\tan^{-1}(\frac{x}{\sqrt{a^2-x^2}})}{x}$$
Where did I mess up?
 A: You forgot to substitute dx. dx = acosθdθ
A: $x = a\sin \theta \implies \color{blue}{ dx = a\cos \theta \,d\theta}$
$$ \int \frac{ \sqrt{(a^2 - x^2)}}{x^2}\,\color{blue}{dx} = \int \frac{\sqrt{a^2 - a^2 \sin^2 \theta}}{a^2 \sin^2 \theta}\,\color{blue}{(a \cos \theta\,d\theta)} = \int \frac{a^2 \cos^2 \theta\, d\theta }{a^2 \sin^2 \theta} = \int \frac {\cos^2 \theta}{\sin^2 \theta}\; d\theta = \int \cot^2 \theta \,d\theta $$
Or 
$$=\int \frac{a^2 (1 -\sin^2 \theta)\, d\theta }{a^2 \sin^2 \theta} = \int \frac {1-\sin^2 \theta}{\sin^2 \theta}\; d\theta.$$
$$ = \int \frac 1{\sin^2 \theta} \, d\theta - \int \,d\theta$$ 
$$ = \left(\int \csc^2 \,d\theta\right) - \theta + c$$
$$= -\cot\theta - \theta + C$$
and recall that, since $x = a\sin \theta,$ then $\sin \theta = \frac xa$ and so $\theta = \sin^{-1}\left( \frac xa\right)$
That gives us $$= -\sin^{-1}\left(\frac xa\right) - \cot\left( \sin^{-1}\left(\frac xa\right)\right)+C\tag{1}$$ 
Now using that $$\cot \left(\sin^{-1}\frac xa\right) = \frac{\sqrt{1 - \left(\frac {x^2}{a^2}\right)}}{\frac xa},$$
we get that the integral is equal to $$- \frac{ a\sqrt{1 -\left(\frac xa\right)^2} + x \sin^{-1}\left(\frac xa\right)}{x}+C$$
And under appropriate restricted values for x and a, this is equivalent to
$$-\left(\frac{\sqrt{a^2 - x^2} + x \tan^{-1}\left(\frac x{\sqrt{a^2 - x^2}}\right)}{x}\right)+C\tag{form you seek}$$
Note that the result we obtain at $(1)$ is perfectly correct, as well.  
A: You need to replace $dx$ with $d\theta$ and then $du$. You don't seem to have done that.
A: Say no to trig substitution for easy integrals.
$$\int \dfrac{\sqrt{a^2 - x^2}}{x^2} dx = \dfrac{-1}{x} \sqrt{ a^2-x^2} - \int\dfrac{1}{x}\dfrac{x}{\sqrt{a^2 - x^2}}\ dx \\= \dfrac{-1}{x} \sqrt{x^2 - a^2} - \sin^{-1} \left(\dfrac xa\right) +C$$
A: To arrive to the textbook formula you need to substitute $v=\dfrac{x}{\sqrt{a^2-x^2}}$ but this is a bit difficult to guess.
In fact proceed to $x=a\tanh(u)$ to exploit $[1-\tanh^2]$.
Then $\displaystyle I=\int \dfrac{\sqrt{a^2-x^2}}{x^2}\mathop{dx}=\int\dfrac {\mathop{du}}{\cosh(u)\sinh(u)^2}$
Now substitute $v=\sinh(u)$ 
Notice that $v=\sinh(\tanh^{-1}(\frac xa))=\dfrac{\frac xa}{\sqrt{1-(\frac xa)^2}}$ is equal to the change proposed at the start.
$$\begin{align} I &=\int\dfrac{\mathop{dv}}{v^2(1+v^2)}=\int\left(\dfrac 1{v^2}-\dfrac 1{1+v^2}\right)\mathop{dv}=-\dfrac 1v-\arctan(v)+C\\\\&=-\dfrac{\sqrt{a^2-x^2}}x-\arctan\left(\dfrac{x}{\sqrt{a^2-x^2}}\right)+C\end{align}$$

Remark: you can also arrive to the same result with $x=a\sin(u)$ and $v=\tan(u)$.
