I'm currently learning integration techniques, and I often run into a problem; when i'm solving an integral, sometimes I need to use the natural log simplification and other times I need to use one of the inverse trig formulas, namely arctangent. I've done plenty of reading before I came here on when to use ln vs arctan, and perhaps my wording isn't correct(if so I apologize for that), but I haven't found any answers. Hopefully some of you fine folks can clarify things for me as my professor won't answer my emails.
For the following problem, i'm using the integration by parts technique:
$$\int{\arctan x} {\;dx} = x\;\arctan\;x \;- \int{\frac{x}{x^2\;+1}}\;dx$$
where u = $\arctan x$$\;\;du = \frac{1}{x^2+1}$ $\;\;dv = 1$ $\;\;v = x$
Then I use another substitution where $\;w = {x^2+1}$ and $\;\frac{dw}{2} = x\;dx$ for the integral left, giving me:
$$x\;\arctan\;x \:- \frac{1}{2}\int\frac{dw}{w}\;$$
After subbing back in, it looks to me like it's in the arctan format of $\frac{1}{a}\arctan\frac{x}{a}$ with $\;x^2+1$ in the denominator, but the answer is in fact:
$$x\;\arctan\;x \;-\; \frac{1}{2}(\ln|x^2+1|)+C$$
This sort of thing burns me often as i've done similar problems in the past that are the other way around. Is it because I used w substitution? Or perhaps i'm just not seeing something critical?
Thanks in advance for any help, and I apologize if my formatting sucks, i'm new to the site and I'm still learning.