Theorem: Primitive of x squared by Root of x squared minus a squared

:$\ds \int x^2 \sqrt {x^2 - a^2} \rd x = \frac {x \paren {\sqrt {x^2 - a^2} }^3} 4 + \frac {a^2 x \sqrt {x^2 - a^2} } 8 - \frac {a^4} 8 \ln \size {x + \sqrt {x^2 - a^2} } + C$
for $\size x \ge a$.

Proof:
We have that $\sqrt {x^2 - a^2}$ is defined only when $x^2 \ge a^2$, that is, either:
:$x \ge a$
or:
:$x \le -a$
where it is assumed that $a > 0$.
First let $x \ge a$.
Let:
{{begin-eqn}}
{{eqn | l = z
      | r = x^2
}}
{{eqn | ll= \leadsto
      | l = \frac {\d z} {\d x}
      | r = 2 x
      | c = Power Rule for Derivatives
}}
{{eqn | ll= \leadsto
      | l = \int x^2 \sqrt {x^2 - a^2} \rd x
      | r = \int \frac {z \sqrt {z - a^2} \rd z} {2 \sqrt z}
      | c = Integration by Substitution
}}
{{eqn | r = \frac 1 2 \int \sqrt z \sqrt {z - a^2} \rd z
      | c = Primitive of Constant Multiple of Function
}}
{{eqn | r = \frac 1 2 \paren {\frac {2 z - a^2} 4 \sqrt z \sqrt {z - a^2} - \frac {a^4} 8 \int \frac {\d z} {\sqrt z \sqrt {z - a^2} } } + C
      | c = Primitive of $\sqrt {\paren {a x + b} \paren {p x + q} }$
}}
{{eqn | r = \frac {2 z - a^2} 8 \sqrt z \sqrt {z - a^2} - \frac {a^4} {16} \paren {2 \map \ln {\sqrt {z - a^2} + \sqrt z} } + C
      | c = Primitive of $\dfrac 1 {\sqrt {\paren {a x + b} \paren {p x + q} } }$
}}
{{eqn | r = \frac {2 z - 2 a^2} 8 \sqrt z \sqrt {z - a^2} + \frac {a^2} 8 \sqrt z \sqrt {z - a^2} - \frac {a^4} 8 \ln \paren {\sqrt {z - a^2} + \sqrt z} + C
      | c = 
}}
{{eqn | r = \frac {z - a^2} 4 \sqrt z \sqrt {z - a^2} + \frac {a^2} 8 \sqrt z \sqrt {z - a^2} - \frac {a^4} 8 \ln \paren {\sqrt {z - a^2} + \sqrt z} + C
      | c = 
}}
{{eqn | r = \frac {x \paren {\sqrt {x^2 - a^2} }^3} 4 + \frac {a^2 x \sqrt {x^2 - a^2} } 8 - \frac {a^4} 8 \ln \paren {x + \sqrt {x^2 - a^2} } + C
      | c = substituting for $z$
}}
{{eqn | r = \frac {x \paren {\sqrt {x^2 - a^2} }^3} 4 + \frac {a^2 x \sqrt {x^2 - a^2} } 8 - \frac {a^4} 8 \ln \size {x + \sqrt {x^2 - a^2} } + C
      | c = as $x + \sqrt {x^2 - a^2} > 0$
}}
{{end-eqn}}
Now suppose $x \le -a$.
Let $z = -x$.
Then:
:$\d x = -\d z$
and we then have:
{{begin-eqn}}
{{eqn | l = \int x^2 \sqrt {x^2 - a^2} \rd x
      | r = -\int \paren {-z}^2 \sqrt {\paren {-z}^2 - a^2} \rd z
      | c = Integration by Substitution
}}
{{eqn | r = -\int z^2 \sqrt {z^2 - a^2} \rd z
      | c = simplifying
}}
{{eqn | r = -\paren {\frac {z \paren {\sqrt {z^2 - a^2} }^3} 4 + \frac {a^2 z \sqrt {z^2 - a^2} } 8 - \frac {a^4} 8 \map \ln {z + \sqrt {z^2 - a^2} } } + C
      | c = from above
}}
{{eqn | r = -\frac {z \paren {\sqrt {z^2 - a^2} }^3} 4 - \frac {a^2 z \sqrt {z^2 - a^2} } 8 + \frac {a^4} 8 \map \ln {z + \sqrt {z^2 - a^2} } + C
      | c = simplifying
}}
{{eqn | r = -\frac {z \paren {\sqrt {z^2 - a^2} }^3} 4 - \frac {a^2 z \sqrt {z^2 - a^2} } 8 - \frac {a^4} 8 \paren {\map \ln {z - \sqrt {z^2 - a^2} } - \map \ln {a^2} } + C
      | c = Negative of $\map \ln {z + \sqrt {z^2 - a^2} }$
}}
{{eqn | r = -\frac {z \paren {\sqrt {z^2 - a^2} }^3} 4 - \frac {a^2 z \sqrt {z^2 - a^2} } 8 - \frac {a^4} 8 \paren {\map \ln {z - \sqrt {z^2 - a^2} } } + C
      | c = subsuming $\dfrac {a^4 \map \ln {-a^2} } 8$ into constant
}}
{{eqn | r = -\frac {\paren {-x} \paren {\sqrt {\paren {-x}^2 - a^2} }^3} 4 - \frac {a^2 \paren {-x} \sqrt {\paren {-x}^2 - a^2} } 8 - \frac {a^4} 8 \paren {\map \ln {\paren {-x} - \sqrt {\paren {-x}^2 - a^2} } } + C
      | c = substituting back for $x$
}}
{{eqn | r = \frac {x \paren {\sqrt {x^2 - a^2} }^3} 4 + \frac {a^2 x \sqrt {x^2 - a^2} } 8 - \frac {a^4} 8 \map \ln {-\paren {x + \sqrt {x^2 - a^2} } } + C
      | c = simplifying
}}
{{eqn | r = \frac {x \paren {\sqrt {x^2 - a^2} }^3} 4 + \frac {a^2 x \sqrt {x^2 - a^2} } 8 - \frac {a^4} 8 \ln \size {x + \sqrt {x^2 - a^2} } + C
      | c = as $-\paren {x + \sqrt {x^2 - a^2} } > 0$: {{Defof |Absolute Value}}
}}
{{end-eqn}}
{{qed}}