I want to find the solutions of $$\cos^{2}z=-1$$ and I proceeded in a couple of different ways that are giving different result (so I'm questioning if this idea is correct). I defined $w=e^{iz}$ and then considering that $$\cos z=\frac{w^2+1}{2w},$$ I had $$\frac{w^4+6w^2+1}{4w^{2}}=0,$$ Then the solutions$$w_1=-3+2\sqrt2,\,\,\,w_2=-3-2\sqrt2$$ And then I applied the logarithm $$z=-i Log(-3+2\sqrt2)$$ But when I then try to compute the cosine of $z$ the result it's 3 and not 0 as it should be. What am I missing?
What really bothers me is that if I simply consider $$\cos z=\frac{w^2+1}{2w}=i,$$ Then I find a different result such as $z=-i+i\sqrt2$ and $z=-i-i\sqrt2$
If, as you did, $w=e^{iz}$, then your equation becomes $\frac12\left(w+\frac1w\right)=\pm i$. Consider the case in which you have $\frac12\left(w+\frac1w\right)=i$. Then $w=\left(1\pm\sqrt2\right)i$. Now:
The case in which you have $\frac12\left(w+\frac1w\right)=-i$ is similar.