Finding $\int \frac{x^2}{(a^2-x^2)^{\frac{3}{2}}}dx$ using trigonometric substitution. Where did I go wrong? Evaluate the following integral using trigonometric substitution
$$\int \frac{x^2}{(a^2-x^2)^{\frac{3}{2}}}dx$$
I used the substitution $x=a \sin(u)$, then $dx = a \cos(u) du$. The integral then becomes:
$$\int \frac{a^2 \sin^2(u) a \cos(u)}{(a^2-a^2 \cos^2(u))^{\frac{3}{2}}}du = \int \frac{a^3 \sin^2(u)  \cos(u)}{(a^2 \sin^2(u))^{\frac{3}{2}}}du =\int \frac{\cos(u)}{\sin(u)}du = \ln | \sin(u)  | + C$$
The last equality comes from the substitution $v=\sin(u)$. Now from the first substitution we have $x=a\sin(u)$ and thus $\sin(u) = \frac{x}{a}$. This gives us
$$\int \frac{x^2}{(a^2-x^2)^{\frac{3}{2}}}dx = \ln \left| \frac{x}{a}\right| + C = \ln|x| + C'$$
Where $C' = C - \ln|a|$. This however is of course not correct (unless I am missing something...). Can anyone tell me where I went wrong on this one? Thanks a lot!
 A: The bottom should be $a^3\cos^3 u$, so you are essentially integrating $\tan^2 u$, that is, $\sec^2 u-1$.
A: $\newcommand{\angles}[1]{\left\langle #1 \right\rangle}%
 \newcommand{\braces}[1]{\left\lbrace #1 \right\rbrace}%
 \newcommand{\bracks}[1]{\left\lbrack #1 \right\rbrack}%
 \newcommand{\dd}{{\rm d}}%
 \newcommand{\ds}[1]{\displaystyle{#1}}%
 \newcommand{\equalby}[1]{{#1 \atop {= \atop \vphantom{\huge A}}}}%
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}%
 \newcommand{\ic}{{\rm i}}%
 \newcommand{\imp}{\Longrightarrow}%
 \newcommand{\pars}[1]{\left( #1 \right)}%
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}%
 \newcommand{\sgn}{\,{\rm sgn}}%
 \newcommand{\ul}[1]{\underline{#1}}%
 \newcommand{\verts}[1]{\left\vert #1 \right\vert}%
 \newcommand{\yy}{\Longleftrightarrow}$
\begin{align}
&\int{x^{2} \over \pars{a^{2} - x^{2}}^{3/2}}\,\dd x
=
\int\,\bracks{%
-\,{1 \over \pars{a^{2} - x^{2}}^{1/2}}
+
{a^{2} \over \pars{a^{2} - x^{2}}^{3/2}}}\dd x
\\[3mm]&=
\int\,\bracks{%
-\,{1 \over (a^{2} - x^{2})^{1/2}}
-
{1 \over a}\,\partiald{}{a}{1 \over \pars{a^{2} - x^{2}}^{1/2}}
}\dd x
=
-\pars{1 + {1 \over a}\,\partiald{}{a}}
\overbrace{\int{1 \over (a^{2} - x^{2})^{1/2}}
\dd x}^{x\ =\ \verts{a}\sin\pars{\theta}}
\\[3mm]&=
-\pars{1 + {1 \over a}\,\partiald{}{a}}\theta\pars{a}
=
-\pars{1 + {1 \over a}\,\partiald{}{a}}\arcsin\pars{x \over \verts{a}}
\\[3mm]&=
-\arcsin\pars{x \over \verts{a}}
-
{1 \over a}\,\pars{-\,{x \over \verts{a}\,\sqrt{a^{2} - x^{2}\,}}}
\\[5mm]&
\end{align}
$${\large%
\int{x^{2} \over \pars{a^{2} - x^{2}}^{3/2}}\,\dd x
=
-\arcsin\pars{x \over \verts{a}}
+
{x\sgn\pars{a} \over a^{2}\sqrt{a^{2} - x^{2}\,}}}
$$
