Say we want to find $\displaystyle \displaystyle \int \frac{1}{x^2+1}\;{dx}$. Normally, we let $\displaystyle \displaystyle x = \tan{t}$, or realise that the integrand is the derivative of $\displaystyle \displaystyle \tan^{-1}{x}$, or do something along similar lines, but suppose we ignore those. Instead, we do the following:

Write $\displaystyle \displaystyle \int\frac{1}{x^2+1}\;{dx} = \int\frac{1}{(x-i)(x+i)}\;{dx}$ and let:

$\displaystyle \displaystyle t = \frac{x-i}{x+i} \Rightarrow \frac{dt}{dx} = \frac{2i}{(x+i)^2} \Rightarrow dx = \frac{(x+i)^2}{2i}\;{dt}$

$\displaystyle \displaystyle \therefore ~ \int\frac{1}{x^2+1}\;{dx} = \int\frac{1}{(x-i)(x+i)}\;{dx} = \int\frac{(x+i)^2}{2i(x+i)(x-i)}\;{dt}$

$\displaystyle \displaystyle = \frac{1}{2i}\int\frac{x+i}{x-i}\;{dt} = \frac{1}{2i}\int\frac{1}{t}\;{dt} = \frac{1}{2i}\ln{t}+k = \frac{1}{2i}\ln\left(\frac{x-i}{x+i} \right)+k$.

More generally, letting $\displaystyle \displaystyle t = \frac{x-ai}{x+ai}$ gives:

$\displaystyle \displaystyle \int\frac{1}{x^2+a^2}\;{dx} = \int\frac{1}{(x-ai)(x+ai)}\;{dx} = \int\frac{(x+ai)^2}{2ai(x+ai)(x-ai)}\;{dt}$

$\displaystyle \displaystyle = \frac{1}{2ai}\int\frac{x+ai}{x-ai}\;{dt} = \frac{1}{2i}\int\frac{1}{t}\;{dt} = \frac{1}{2i}\ln{t}+k = \frac{1}{2ai}\ln\left(\frac{x-ai}{x+ai} \right)+k$.

My Question (1):why are these identities not used and instead the arctangent ones are? I even suspected that I was missing something, but differentiating quickly confirmed that they are indeed correct.

We know that $\displaystyle \displaystyle \int_{0}^{\infty}\frac{1}{x^2+1}\;{dx} = \frac{\pi}{2}$

But using the relation found above gives:

$\displaystyle \displaystyle \int_{0}^{\infty}\frac{1}{x^2+1}\;{dx} = \frac{1}{2i}\int_{-1}^{1}\frac{1}{t}\;{dt}$, which doesn't converge, since the logarithmic function is not defined on $\displaystyle [-1, 1]$.

Question (2): why is this? I probably need to pick up a complex analysis book!