<s>[INST] Integral of $\int\frac{dx}{x^2+1}$ I know the formula$$\int\frac{dx}{x^2+1} = \tan^{-1}(x) + C$$
But, when integrating by parts:
$$u = x^2+1$$
$$u' = 2x$$
$$v' = 1$$
$$v = x$$
$$\int\frac{dx}{x^2+1} = uv - \int vu' dx = x(x^2+1) - \int 2x^2dx$$
$$ \int 2x^2dx = \frac{2x^3}{3} + C$$
So, finally: $$\int\frac{dx}{x^2+1} = x(x^2+1) - \frac{2x^3}{3} + C$$
Am I doing something wrong?
 [/INST] Look this is an easier approach: Put $x = \tan \alpha $ . then $dx = \sec^2 \alpha d \alpha $. Hence
$$ \int \frac{dx}{1 + x^2} = \int \frac{\sec^2 \alpha}{1 + \tan^2 \alpha} d \alpha = \int d \alpha = \alpha = \arctan x + C$$
</s>