TITLE: Computing $ \int \frac{{x}~{\cos^{-1}(x)}}{\sqrt{1-{x^2}}}~\mathrm{d}x $.
QUESTION [7 upvotes]: I've just begun to learn integration which makes me a little nervous! Here's a question I'm having a problem with. 
Also my first time trying to use LaTeX. I apologise for any discrepancies.

Compute:
  $$ \int \frac{{x}~{\cos^{-1}(x)}}{\sqrt{1-{x^2}}}~\mathrm{d}x $$

Here's what I did:
Substitute $ u = \cos^{-1}(x) $. So, $ -~\mathrm{d}u = \frac{1}{\sqrt{1-x^2}}~\mathrm{d}x$.
Also, I think it's also correct (please correct me if not) that $ x = \cos(u) $. This could be my mistake.
$$ = -\int u~\cos(u)~\mathrm{d}u $$
Using integration by parts for $ f(x) = u $, $ f'(x) = 1 $, $ g'(x) = \cos(u) $ and $ g(x) = \sin(u) $,
$$ = -~(u~\sin(u) - \int \sin(u)~\mathrm{d}u) $$
$$ = -~u~\sin(u) - \cos(u) + C $$
Substituing back,
$$ -~\cos^{-1}(x)~\sin(\cos^{-1}(x)) - \cos(\cos^{-1}(x)) + C $$
I understand integration by parts could've been applied directly in the very beginning. But my first instinct when I solved was this. Is it in any way incorrect? I appreciate your time.

REPLY [3 votes]: Great work! The problem is just when you substitute back to $x$. Recall that $u = \cos^{-1}x$ and $x = \cos u$, so:
$$
\sin u = \sqrt{\sin^2 u} = \sqrt{1 - \cos^2 u} = \sqrt{1 - x^2}
$$
Hence, we obtain:
$$
-u \sin u - \cos u + C = -(\cos^{-1}x)\sqrt{1 - x^2} - x + C
$$