Can you explain how you figured it out?

so refer to textbook page 50, the book provides a method. For x just follow the book, for y follow it until the end to prove that y1+y2=0, however the range of y is not limited to be positive in this question. In this case, we will have to expand:

cos(x+iy) = cosx coshy - i sinx sinhy

and realize that sinx is never 0, meaning sinhy will always be there, and sinhy is injective for a positive or negative y of same magnitude.