Arctan equalling a logarithm?

$$\int\frac{dx}{x^2+1}=\arctan x=\frac1{2i}\cdot\ln\bigg[\frac{x-i}{x+i}\bigg]$$

$$\int\frac{dx}{x^2-1}=\arctan ix=\frac12\cdot\ln\bigg[\frac{x-1}{x+1}\bigg]$$

If your question is why the two forms are symbolically equivalent, the answer lies in the fact that trigonometric functions are related to the circle, whose equation is $x^2+y^2=r^2$, whereas the natural logarithm is related to the hyperbola, whose equation is $x^2-y^2=r^2$, which, after a rotation of $45^\circ$ and a bit of scaling, becomes $y=\dfrac1x$ , whose primitive is $\ln x$. Hope this helps !


Lemma: for $x\in \mathbb{R}^{+}$ $$\log(x)=2\,\mathrm{arctanh}\!\left(\frac{-1+x}{x+1}\right) \tag{1}$$ proof: let $x=e^{2u},\,u\in \mathbb{R}$, $$\begin{aligned} \log(e^{2u})&=2\,\mathrm{arctanh}\!\left(\frac{-1+e^{2u}}{e^{2u}+1}\right)\\ 2u&=2\,\mathrm{arctanh}\!\left(\frac{-1+e^{2u}}{e^{2u}+1}\right)=2\,\mathrm{arctanh}\!\left(\frac{-e^{-u}+e^{u}}{e^{u}+e^{-u}}\right)\\ 2u&=2\,\mathrm{arctanh}\!\left(\frac{\sinh{(u)}}{\cosh{(u)}}\right)=2\,\mathrm{arctanh}\!\left(\tanh{(u)}\right)=2u\\ \end{aligned} \tag{2}$$

Now define $\alpha$ and $\beta$ via: $$ax^2+bx+c=a(x-\alpha)(x-\beta)$$ $$\alpha=-{\frac {b}{2a}}+{\frac {\sqrt{{b}^{2}-4\,ca }}{2a}},\quad\beta=-{\frac {b}{2a}}-{\frac {\sqrt{{b}^{2}-4\,ca}}{ 2a}} \tag{3}$$ from $(3)$ it follows that: $$ \begin{aligned} a \left( \alpha+\beta \right) &=-b\\ a \left( \alpha-\beta \right) &=\sqrt {{b}^{2}-4\,ca} \end{aligned} \tag{4}$$ we then note that, from: $$\sqrt {4\,ca-{b}^{2}}=i\sqrt {{b}^{2}-4\,ca},\quad\arctan(ir)=i\,\mathrm{arctanh{(r)}}$$ and $(4)$, that: $$ \begin{aligned} 2\,\arctan \left( {\frac {2\,ax+b}{\sqrt {4\,ca-{b}^{2}}}} \right) { \frac {1}{\sqrt {4\,ca-{b}^{2}}}}&=\frac{2}{a\left( \alpha-\beta \right)}\,\mathrm{arctanh} \left( {\frac {-2\, x+\alpha+\beta}{\alpha-\beta}} \right)\\ &=\frac{2}{a\left( \alpha-\beta \right)}\,\mathrm{arctanh} \left( {\frac {-1+{\frac {x-\alpha }{x-\beta}}}{-1+{\frac {x-\alpha}{x-\beta}}}} \right)\\ &=\frac{2}{a\left( \alpha-\beta \right)}\,\log \left(\frac {x-\alpha }{x-\beta}\right) \end{aligned} $$ where the last line follows from $(1)$ under the assumption that: $$\frac {x-\alpha}{x-\beta}\in \mathbb{R}^{+}$$