# What's wrong with this method of evaluating an integral?

I was trying to evalute the integral $$\int \frac{1}{x^2+1} \,dx$$ by partial fractions.

$$\frac{1}{x^2+1} = \frac{1}{2i}\left(\frac{1}{x-i} - \frac{1}{x+i}\right)$$

Therefore, \begin{aligned} \int \frac{1}{x^2+1} \,dx &= \frac{1}{2i} \int \left(\frac{1}{x-i} - \frac{1}{x+i}\right) \,dx \\ &= \frac{1}{2i} (\ln(x-i) - \ln(x+i)) \\ &= \arctan\left(\frac{1}{x}\right) +C \end{aligned}

Because $$x - i = \exp\left(\sqrt{x^2+1}+i\arctan{\frac{1}{x}}\right)$$ and $$x + i = \exp\left(\sqrt{x^2+1}-i\arctan{\frac{1}{x}}\right).$$

This differs from what you get from trigonometric substitution, which is where I'm having difficulties in finding my error.

In the last step, I'm assuming that $$\ln(z)$$ works as you would expect for complex numbers.

• You have swapped $+$ and $-$ in $\exp$. Thus the answer is $-\arctan \frac{1}{x} + C$ which is the same as $\arctan x + C$ Jul 31 '20 at 16:45
• Also it should be $x - i = \exp(\log \sqrt{x^2+1} - i \arctan(1/x))$ (for $x > 0$). Jul 31 '20 at 16:50
• How is $\arctan(1/x) = - \arctan(x)$ Jul 31 '20 at 16:53
• No, $\arctan(x)+\arctan(1/x)=\operatorname{sgn}(x)\pi/2$ for all $x\neq 0$, and you absorb the $\pm\pi/2$ into $C$. Jul 31 '20 at 17:24

In the your fifth equation you will actually get $$I=-\tan^{-1}(1/x)+C$$ and due to the identity: $$\tan^{-1} x+\tan^{-1} (1/x)= \pi/2$$ We get $$I=\pi/2+\tan^{-1} x+ D$$ Uther wise the standard formula gives $$I=\tan^{-1} x+E$$ These two results differ only by a constant, which is normal in indefinite integration.