How am I computing $\int \frac{x^{3}}{\sqrt{x^{2} + 9}}dx$ incorrectly? $ \displaystyle\int \frac{x^{3}}{\sqrt{x^{2} + 9}}dx$
doing a trig sub:
$x = 3\tan(\theta)$
$dx = 3\sec^{2}(\theta)d\theta$
$\displaystyle\int \frac{(3\tan(\theta))^{3}}{\sqrt{3\tan(\theta)^{2} + 9}}d\theta$
$\displaystyle\int \frac{ ( 27\tan^{3}(\theta) } { \sqrt{ 3\tan(\theta)^{2} + 9 } }d\theta$
$27\displaystyle\int \frac{\tan^{3}(\theta)\cdot\sec^{2}(\theta)}{\sqrt{\sec^{2}(\theta)}}d\theta$
$27\displaystyle\int \tan(\theta)\cdot\tan(\theta)\cdot\sec(\theta)\cdot d(\theta)$
Got stuck here and think I am doing this wrong.
Please help
Thank you
 A: $$
 \int u dv = uv - \int v du
$$
$$
  u = x^{2}, \qquad dv = \frac{x }{\sqrt{x^{2}+9}}dx
$$
$$
  du = 2x dx, \qquad v = \sqrt{x^{2}+9}
$$

$$
  \int \frac{x^{3}}{\sqrt{x^{2}+9}}dx = \frac{1}{3} \left(x^2-18\right) \sqrt{x^2+9}
$$
A: Your approach is correct except that the last step is wrong. It can be fixed and completed as below:
$$
\begin{aligned}
&\text { Let } x=3 \tan \theta \quad d x=3 \sec ^2 \theta d \theta\\
&I=\int \frac{27 \tan ^2 \theta\cdot 3 \sec ^2 \theta d \theta}{\sqrt{9 \tan ^2 \theta+9}}\\
&=27 \int \tan ^3 \theta \sec \theta d \theta\\
&=27 \int \tan ^2 \theta d(\sec \theta)\\
&=27 \int\left(\sec ^2 \theta-1\right) d(\sec \theta)\\
&=27\left(\frac{\sec ^3 \theta}{3}-\sec \theta\right)\\
&=9 \sec \theta\left(\sec ^2 \theta-3\right)+C\\&=9 \sec \theta\left(\tan ^2 \theta-2\right)+C\\&= \frac{\sqrt{x^2+9}}{3}\left(x^2-18\right)+C
\end{aligned}
$$

One more quicker method is integration by parts.
$$
\begin{aligned}
\int \frac{x^3}{\sqrt{x^2+9}} d x &=\int x^2 d\left(\sqrt{x^2+9}\right) \\
&=x^2 \sqrt{x^2+9}-\int \sqrt{x^2+9} d\left(x^2\right) \\
&=x^2 \sqrt{x^2+9}-\frac{2}{3}\left(x^2+9\right)^{\frac{3}{2}}+C \\
&=\frac{1}{3} \sqrt{x^2+9}\left(3 x^2-2 x^2-18\right)+C \\
&=\frac{1}{3}\left(x^2-18\right) \sqrt{x^2+9}+C
\end{aligned}
$$
