<s>[INST] Prove $|\cos z|^2=\cos^2x+\cosh^2y$ That what I tried 
$$
\cos z= \cos (x+iy)= \cos x \cos iy- \sin x \sin iy=\cos x \cosh y-i\sin x \sinh y\\
|\cos z|^2= \cos^2(x) \cosh^2(y)+\sin^2(x)\sinh^2(y)\\
\sinh^2(y)=\cosh^2(y)-1
$$
Then
$$
\cos^2(x) \cosh^2(y)+\sin^2(x) \cosh^2 (y)-\sin^2 (x)= \cosh^2 (y)-\sin^2 (x)
$$
 What did I do wrong ?
 [/INST] The formula you want to prove is wrong: for $z=0$, we have $\lvert\cos0\rvert^2=1$, whereas $\cos^20+\cosh^20=2$.
\begin{align}
\lvert\cos z\rvert&=
\cos^2x\cosh^2y+\sin^2x\sinh^2y\\
&=\cos^2x\sinh^2y+\cos^2x+\sin^2x\sinh^2y\\
&=\cos^2x+\color{red}{\sinh^2y}
\end{align}
Your formula is correct as well.
</s>