I need to integrate $\frac{x}{1+x^2}$ and I tried it like this: $$f(x)=\frac{x}{1+x^2}=\frac{x}{(x+1)(x-1)}=\frac{x+1-1}{(x+1)(x-1)}= \frac{x+1}{(x+1)(x-1)}-\frac{1}{(x+1)(x-1)}=\frac{1}{x-1}-\frac{1}{1+x^2}$$ After I simplified it I integrate it! $$\int{f(x)}=\int{\frac{1}{x-1}}-\int{\frac{1}{1+x^2}}$$
$\int{\frac{dx}{1+x^2}}$ becomes arctan(x) and I substitute $\int{\frac{dx}{x-1}}$ to $\int{\frac{du}{u}}$ now it becomes $ln(x-1)$ after this been done I get: $$\int{f(x)}=ln(x-1)-arctan(x)$$ but when I type integrate x/(1+x^2) into wolframAlpha I it tells me the answer is: $$\int{f(x)}=\frac{1}{2}log(x^2+1)$$ where did I go wrong or what should I have done instead ?
Thank you for your help in advance,
Raavgo
The mistake is at the very beginning: it is not true that $1+x^2 = (1-x)(1+x)$. What you thought about is $1\color{red} - x^2 = (1-x)(1+x)$. (Also, remember that the roots of $1+x^2$ are $\pm \Bbb i$, therefore your factorization is clearly wrong.)
The exercise is much simpler if you notice that $x = \frac 1 2 (1+x^2)'$, therefore
$$\int \frac x {x^2 + 1} \ \Bbb d x = \int \frac {\frac 1 2 (x^2 + 1)'} {x^2 + 1} \ \Bbb d x = \frac 1 2 \log |x^2 + 1| + C ,$$
where $C \in \Bbb R$ is an integration constant.
(I have used the well-known formula that $\int \frac {f'} f \ \Bbb d x = \log |f| + C$.)