Integrate $\int \ln(x^2 +1)\ dx$ $$\int \ln(x^2 +1)\ dx$$
I done it using integration by parts where 
$\int u\ dv = uv - \int v\ du$
Let $u$ = $\ln(x^2 +1)$ 
$du = \frac{2x}{x^2+1} dx $
Let $dv = dx$ so $v=x$ 
$\int \ln(x^2 +1)\ dx = x \ln (x^2 +1) - \int \frac{2x^2}{x^2+1} $
I integrate $2\int \frac{x^2}{x^2+1} $ separately using substitution.
Let $u$ = $x^2 + 1$ -> $dx= \frac{1}{2x} du $
substitute $u$ back into it I get a simplified $\int \frac{x}{x^2 + 1} dx$ 
I used substitution again and got $ \frac{1}{2} \int \frac{1}{u} du$
When I sub it back into the original question, this is my final answer, 
$x\ln(x^2 +1) + \frac{1}{2} \ln(x^2 +1) + C$
However, this answer is wrong, 
The answer is, $x\ln(x^2 +1) - 2x + 2\tan^{-1} (x) + C $
I believe my integration of  $2\int \frac{x^2}{x^2+1} $ is wrong. Where did I went wrong ?  

$2\int \frac{x^2}{x^2+1} $
Does not equal the expression with just an x in the numerator after the substitution .
You can add subtract 1 in numerator to integrate  $2\int \frac{x^2}{x^2+1} $
This is wrong :- $2\int \frac{x^2}{x^2+1} $
This is what you get after applying by-parts :- $2\int \frac{x^2}{x^2+1} dx $
Since differential of x is $dx$ .
In by parts formula we have differential of $u $ not it's differenciation.
