Why isn't this operation in complex equations allowed? I'm trying to solve this equation: $e^z=e^{iz}$. Let's suppose $z=x+iy$. 
Therefore we have the equality $e^{x+iy}=e^{ix-y}$.
Hence we have these two equalities:
$$e^x\sin y=e^{-y}\sin x\ \text{and}\ e^x\cos y=e^{-y}\cos x.$$ 
The author solved the question, but he was very explicit saying that we can't divide these equations with each other and have $\tan y=\tan x$.
My question is why this operation isn't allowed?
EDIT
If $\tan x=\tan y$, then $y=x+\pi n$. Put $y=0$ and $n=1$, then $x=-\pi$. Therefore, we have $e^{-\pi}=e^{-\pi i}$ which is false.

When $a=b$ and $c=d\ne0$ then ${a\over c}={b\over d}$. There is no question about that. From your two equalities you can therefore infer that $\cos y=\cos x=0$ ("exceptional case"), or $$\tan y=\tan x\tag{1}$$
for any solution $(x,y)$ of your problem. Forgetting about the exceptional case for the moment this only says that any solution $(x,y)$ of the original problem will have to satisfy $(1)$; but it does not say that any solution of $(1)$ will also be a solution of the original problem. 
In order to obtain more conditions for $(x,y)$ square your two equalities and add them. This gives $e^{2x}=e^{-2y}$, or $$x=-y\ .\tag{2}$$
The  candidates satisfying $(1)\wedge(2)$ are $$(x_k,y_k):=(k\pi, -k\pi)\qquad(k\in{\mathbb Z})\ ,$$
and the "exceptional candidates" satisfying $(2)$ are
$$(x_k,y_k):=\left(\bigl(k+{1\over2}\bigr)\pi, -\bigl(k+{1\over2}\bigr)\pi\right)\qquad(k\in{\mathbb Z})\ .$$
Now you have to check which of all these candidates actually solve the original problem.
