I want to show that $f(z) = e^z$ for $z = x + iy$ is injective when $-1 \leq x \leq 1, 0 \leq y \leq \pi$.
I proceed by supposing $f(z_1) = f(z_2)$ so $e^{x_1}e^{iy_1} = e^{x_2}e^{iy_2}$. We can use Euler's formula to expand and get
$$e^{x_1}\cos y_1 = e^{x_2} \cos y_2, e^{x_1}\sin y_1 = e^{x_2} \sin y_2.$$
Here I am struggling to prove that $x_1 = x_2$ and $y_1 = y_2$. Intuitively, I can see that since $0 \leq y \leq \pi$, then certainly $\cos$ is injective. And I am tempted to say that since $e^x$ is injective for real $x$, then we have an injective function. But of course, this doesn't imply anything about the injectivity of the product. How can I get started to prove the injectivity?
Note that if $f(z_1)=f(z_2)$ then $e^{x_1}=|f(z_1)|=|f(z_2)|=e^{x_2}$ hence since the exponential is injective on the reals we get $x_1=x_2$ so $e^{i(y_1-y_2)}=1$ or $y_1-y_2=2k\pi, k \in \mathbb Z$. But $|y_1-y_2|<2\pi$ by our assumptions so $k=0$ and we are done!
(if one doesn't want to use the fact that $e^c=1$ implies $c=2k\pi i$ then of course we can use the injectivity of cosine on $[0, \pi]$)