So I saw a youtube video of the following integral, which can be solved by letting u=tanx, then you get
$\int \frac{1}{1+x^2} dx $ = ${tan}^{-1}x + C$
But it should also be solvable through partial fraction decomposition.
$\int \frac{1}{1+x^2}dx$ = $\int {\frac{A}{x-i} + \frac{B}{x+i}dx}$
$\frac{1}{1+x^2}$ = $\frac{A}{x-i}$ + $\frac{B}{x+i}$
$1$ = $A(x+i)$ + $B(x-i)$
$x=i$: $1$ = $2iA$
$A$=$\frac 1{2i}$ = -$\frac {i}{2}$
$x=-i$: $1 = -2iB$
$B$ = $\frac{i}2$
$\int \frac{1}{1+x^2}dx$ = $\int -\frac{i}{2(x-i)}$ + $ \frac{i}{2(x+i)}dx$ = $-\frac{i}2$ln$\lvert {x-i}\rvert$ + $\frac{i}2$$ln\lvert {x+i}\rvert$ + C = $\frac{i}2ln\lvert {x+i}\rvert - ln\lvert {x-i}\rvert$ + C
This should be equal to ${tan}^{-1}x + C$ right?
${tan}^{-1}({1})$ = $\frac\pi4$
$\frac{i}2(ln\lvert {1+i}\rvert - ln\lvert {1-i}\rvert)$ = $\frac{i}2(ln{\sqrt2}-ln{\sqrt2})$=O
So these are obviously not equal, then I thought why must i have absolute value sign in the logarithmic expressions, that rule I know only applies for integarting with real constants.
Thus,
$\int \frac{1}{1+x^2} dx = $$\frac{i}2(ln({x+i}) - ln({x-i}))$ + C = $\frac{i}2ln(\frac{({x+i})^2}{x^2+1}) + C$
Evaluated at x=1 gives us
$\frac{i}2ln(\frac{({1+i})^2}{1^2+1})$ = $\frac{i}2ln(i)$ = $\frac{i}2\cdot \frac{i\pi}{2}$ = $-\frac\pi4$
So, im quite close, but I must have missed something somewhere, and I cant find the mistake. But this triggers two other questions: How would I show that
$\frac{i}2ln(\frac{({x+i})^2}{x^2+1})$ = $\tan^{-1}x$ (or some other logarithmic expression if that expression is where the error lies)
and, why dont I need to take absolute value when integrating
$\int \frac{1}{x+a}dx$
with complex constants? Is the explanation as easy that I can evaluate all logarithmic expressions using complex numbers?