Using trig substitution to evaluate $\int \frac{dt}{( t^2 + 9)^2}$ $$\int \frac{\mathrm{d}t}{( t^2 + 9)^2} = \frac {1}{81} \int \frac{\mathrm{d}t}{\left( \frac{t^2}{9} + 1\right)^2}$$
$t = 3\tan\theta\;\implies \; dt = 3 \sec^2 \theta \, \mathrm{d}\theta$
$$\frac {1}{81} \int \frac{3\sec^2\theta \mathrm{ d}\theta}{ \sec^4\theta} = \frac {1}{27} \int \frac{ \mathrm{ d}\theta}{ \sec^2\theta} = \dfrac 1{27}\int \cos^2 \theta\mathrm{ d}\theta $$
$$ =\frac 1{27}\left( \frac{1}{2} \theta + 2(\cos\theta \sin\theta)\right) + C$$
$\arctan \frac{t}{3} = \theta \;\implies$
$$\frac{1}{27}\left(\frac{1}{2} \arctan \frac{t}{3} + 2 \left(\frac{\sqrt{9 - x^2}}{3} \frac{t}{3}\right)\right) + C$$
This is a mess, and it is also the wrong answer. 
I have done it four times, where am I going wrong?
 A: Try returning to your integral: $$\int \cos^2\theta = \frac{\theta}{2} + \frac{\sin\theta\cos\theta}{2} + C$$
We get a factor of $\frac 12,$ and not $2$, multiplying the second term in the sum.
Note, more importantly, that your substitutions for $\cos\theta\sin\theta$ in terms of $\theta = \arctan(t/3)$ are also incorrect. 
We have that $\theta = \arctan(t/3) \implies \tan \theta = \dfrac t3.\;$ Corresponding to this is $\;\cos\theta = \dfrac{3}{\sqrt{t^2 + 9}}$ and $\;\sin\theta = \dfrac t{\sqrt{t^2 + 9}}.$
That gives us $$\frac{1}{ 27}\left( \frac 12\cdot \arctan \frac{t}{3} + \frac 12 \underbrace{\frac{t}{\sqrt{t^2 + 9}}}_{\sin \theta}\cdot \underbrace{\frac{3}{\sqrt{t^2 + 9}}}_{\cos\theta}\right) + C$$ $$ = \frac{1}{54}\left( \arctan \frac{t}{3} + \frac{3t}{t^2+9}\right) + C$$
A: The integral $$ \int \cos^2 \theta \, \mathrm d\theta=\frac{\theta}{2}+\frac{1}{2} \sin \theta \cos \theta+C. $$
(You had the coefficient wrong)
A: I would like to handle the integral by integration by parts. $$
\begin{aligned}
\int \frac{d t}{\left(t^{2}+9\right)^{2}} &=-\int \frac{1}{2 t} d\left(\frac{1}{t^{2}+9}\right) \\
&=-\frac{1}{2 t\left(t^{2}+9\right)}-\frac{1}{2} \int \frac{1}{t^{2}\left(t^{2}+9\right)} d t \\
&=-\frac{1}{2 t\left(t^{2}+9\right)}-\frac{1}{18} \int\left(\frac{1}{t^{2}}-\frac{1}{t^{2}+9}\right) d t \\
&=-\frac{1}{2 t\left(t^{2}+9\right)}+\frac{1}{18 t}+\frac{1}{54} \arctan \left(\frac{t}{3}\right)+C \\
&=\frac{1}{54}\left[\frac{3 t}{t^{2}+9}+\arctan \left(\frac{t}{3}\right)\right]+C
\end{aligned}
$$
