<s>[INST] Equality of two complex expressions for $\log\dfrac{1+iz}{1-iz}$ I am considering the complex expression:
$w=\log\dfrac{1+iz}{1-iz}$
where $z=x+iy$
On substitution $z=x+iy$ in above expression, I got:
$w=\log\dfrac{1+i(x+iy)}{1-i(x+iy)}$
$=\log\dfrac{(1-y)+ix}{(1+y)-ix}........(*)$
Now there are two ways in which one can proceed. For first one I attempted the following:
$w=\log((1-y)+ix)-\log((1+y)-ix))$
Now using the identity $\log(x+iy)= \log(\sqrt{x^2+y^2})+i\tan^{-1}\dfrac{y}{x}$
Next,
$w=\dfrac{1}{2}(\log((1-y)^2+x^2)-\log((1+y)^2+x^2)))+i(\tan^{-1}\dfrac{x}{1-y}-\tan^{-1}\dfrac{-x}{1+y})$
$=\dfrac{1}{2}(\log\dfrac{(1-y)^2+x^2}{(1+y)^2+x^2})+i\tan^{-1}(\dfrac{2x}{1-x^2-y^2}). ..........(1)$
For the second way, I rationalized the denominator of expression given by $...(*)$ and got the following:
$w=\log\dfrac{(1-y)+ix}{(1+y)-ix}*\dfrac{(1+y)+ix}{(1+y)+ix}$
$=\log\dfrac{(1-x^2-y^2)+i(2x)}{(1+y)^2+x^2}$
$=\log\dfrac{\sqrt{(1-x^2-y^2)^2+4x^2}}{(1+y)^2+x^2}+i\tan^{-1}\dfrac{2x}{1-x^2-y^2}.......(2)$
The two expressions given by equations $....(1)$ and $...(2)$ must be equal but they are not. Their real parts do not match. Why are the two expressions not equal?
 [/INST] Since $z\ne \pm i,$ \begin{align}
& \frac12\log\frac{(1-y)^2+x^2}{(1+y)^2+x^2} = \log\frac{\sqrt{(1-x^2-y^2)^2+4x^2}}{(1+y)^2+x^2}
\\\iff{}& \sqrt{\frac{(1-y)^2+x^2}{(1+y)^2+x^2}} = \frac{\sqrt{(1-x^2-y^2)^2+4x^2}}{(1+y)^2+x^2}
\\\iff{}& \sqrt{(1-y)^2+x^2}\;\left((1+y)^2+x^2\right)  = \sqrt{(1+y)^2+x^2}\sqrt{(1-x^2-y^2)^2+4x^2}
\\\iff{}& \left((1-y)^2+x^2\right)\; \left((1+y)^2+x^2\right)^2 = \left((1+y)^2+x^2\right)\;\left((1-x^2-y^2)^2+4x^2\right)
\\\iff{}& \text{True}.
\end{align}
Btw,

using the identity $\log(x+iy)= \log(\sqrt{x^2+y^2})+i\tan^{-1}\dfrac{y}{x}$

is false: \begin{align}\operatorname{Log}(-1-i)-\operatorname{Log}\sqrt{(-1)^2+(-1)^2} &=-\dfrac{3\pi}4 i\\&\ne i\arctan\dfrac{-1}{-1}.\end{align}
</s>