Show that the complex $\cos$ function has only real roots

Building on your second approach: $$ \cos(x+iy)=\cos(x)\cos(iy)-\sin(x)\sin(iy) =\cos(x)\cosh(y)- i\sin(x)\sinh(y) $$ so that $$ |\cos(x+iy)| ^2 = \cos^2(x)\underbrace{\cosh^2(y)}_{1 + \sinh^2(x)} + \underbrace{\sin^2(x)}_{1 - \cos^2(x)}\sinh^2(y) = \cos^2(x) + \sinh^2(y) $$ and therefore $$ \begin{align} \cos(x+iy) = 0 &\iff \cos(x) = 0 \text{ and } \sinh(y) = 0 \\ &\iff \cos(x) = 0 \text{ and } y = 0 \, . \end{align} $$


In your second approach, note that $\cos(iy)=\cosh y$ and $\sin(iy)=i\sinh y$. You get $$\cos x\cosh y-i\sin x\sinh y=0.$$ So both the real and imaginary parts are zero: $\cos x\cosh y=0$ and $\sin x\sinh y=0$. If $y$ is a nonzero real number then $\sinh y$ and $\cosh y$ are both nonzero which gives $\cos x=0$ and $\sin x=0$, impossible.