<s>[INST] Solution to Complex Equation $\cos z = 2i$ I tried solving the equation $\cos{z}=2i$ where $z$ is a complex number. The solution $i$ have ended up with is $z$, $= (4k+1)\frac{\pi}{2} - i\ln{(2+\sqrt{5})}$. However the text book solution is  $z=(2k+1)\frac{\pi}{2} - (-1)^k\ln{(2+\sqrt{5})}i$. Are the results geometrically same or my solution is erroneous. 
 [/INST] $$\cos z = \frac{1}{2}\left(e^{iz}+e^{-iz}\right).$$ Solve first for $w=e^{iz}$.
$$w^2-4iw + 1=0$$
so:
$$w=\frac{4i\pm\sqrt{-16-4}}{2} = (2\pm\sqrt{5})i$$
So we have to deal with two cases with care. If $w=(2+\sqrt{5})i$, you get your solution:
$$z = (4k+1)\frac{\pi}{2} - i\ln(2+\sqrt{5})$$
If $w=(2-\sqrt{5})i$, then using $2-\sqrt{5}=-(2+\sqrt{5})^{-1}$, we have:
$$iz = -\log(2+ \sqrt{5}) +\left(\frac{3\pi}{2}+2\pi k\right)i$$
So:
$$z = \left(\frac{3pi}{2}+2\pi k\right) + \log(2+ \sqrt{5})i$$
In the first case, let $m=2k$ and you have:
$$z = (2m+1)\frac{\pi/2} - (-1)^{m}\ln(2+\sqrt{5})i$$
and the second case $m=2k+1$ then:
$$ z = (2m+1)\frac{\pi}{2} - (-1)^{2m+1}\ln(2+\sqrt{5})$$
So the full answer merges the two answers.

You can probably write this carefully as one case. The two values of $w$ can be written as $$w=i(-1)^k(2+\sqrt{5})^{(-1)^k}$$. Then:
$$iz = \log w = (-1)^k \log(2+\sqrt{5}) + \frac{\pi}{2}i + k\pi i$$
So:
$$z = \left(k+1/2\right)\pi - (-1)^k \log(2+\sqrt{5}) i$$
</s>