How to evaluate a complex function and its modulus How can I evaluate the expression: $|\cos z|^2 + |\sin z|^2$ where $z$ is a complex number? I believe it is not like the case of real-valued functions. Any help is worth to be appreciated for. Thanks!
 A: Write $z = x + iy$ and use the addition formulas for sine and cosine.  (It turns out that they still work for complex numbers!)
$$\cos z = \cos(x+iy) = \cos x \cos (iy) - \sin x \sin(iy)$$
$$\sin z = \sin(x+iy) = \sin x \cos(iy) + \cos x \sin(iy)$$
Now you have to get both of these equations into the form $a + ib$, where $a$ and $b$ are real numbers.  To do this, you'll need to know that $$\cos(iy) = \cosh y$$ $$\sin(iy) = i \sinh(y),$$ where $$\cosh y = \frac{e^y + e^{-y}}{2}$$ $$\sinh y = \frac{e^y - e^{-y}}{2}$$ are the hyperbolic trigonometric functions.
And of course you know that $|a + ib| = \sqrt{a^2 + b^2}$, and I leave the details to you.
A: An alternative to Jesse's computation is to consider the following definition for the complex trigonometric functions:
$$
\sin z=\frac{e^{iz}-e^{-iz}}{2i}\quad\text{and}\quad \cos z=\frac{e^{iz}+e^{-iz}}{2}
$$
and remember that $|z|^2=z\overline{z}$. So what you want is 
$$
\frac{(e^{iz}-e^{-iz})(e^{-i\overline{z}}-e^{i\overline{z}})}{4}
+
\frac{(e^{iz}+e^{-iz})(e^{-i\overline{z}}+e^{i\overline{z}})}{4}.
$$
A: Trig identities make for a short proof:
$$
|\cos z|^2 + |\sin z|^2  = \cos(z)\cos(\bar{z})+\sin(z)\sin(\bar{z}) = \cos(z-\bar{z}) = \cos(2i\mathrm{Im}[z]) = \cosh(2\mathrm{Im}[z])
$$
A: We do $|\cos z|^2$ in some detail. The calculation for  $|\sin z|^2$ is almost the same.  When we add, there is cancellation: the sum is very simple. In a comment at the end, we give a much easier argument. Hindsight is $20$-$20$.
Let $w=\cos z$. Then
$$w=\frac{e^{iz}+e^{-iz}}{2}.$$
Let $z=x+iy$.
Then $e^{iz}=e^{-y}e^{ix}$. Similarly, $e^{-iz}=e^{y}e^{-ix}$
and therefore
$$w=\frac{e^{-y}e^{ix}+e^{y}e^{-ix}}{2},$$
and 
$$\overline{w}=\frac{e^{-y}e^{-ix}+e^{y}e^{ix}}{2}.$$
Multiply. We get 
$$w\overline{w}=\frac{1}{4}\left(e^{-2y}+e^{2y}+ e^{2ix}+e^{-2ix}\right),$$ 
and therefore
$$|\cos z|^2= \frac{1}{2}\left(\cosh 2y+\cos 2x\right).$$
A similar calculation shows that 
$$|\sin z|^2= \frac{1}{2}\left(\cosh 2y-\cos 2x\right),$$
and therefore
$$|\cos z|^2+|\sin z|^2=\cosh 2y.$$
Comment: Note that $|\cos z|^2+|\sin z|^2$ turned out to be  simple, and independent of $x$.  The simplicity of the answer is a voice telling us that we have  missed something obvious.  We should listen.
A formally  almost trivial computation shows that 
$$\frac{\partial}{\partial x}(\cos z\;\overline{\cos z}+\sin z\;\overline{\sin z})\equiv 0,$$
and therefore  $|\cos z|^2+|\sin z|^2$ is a function of $y$ alone! (There is some hidden work here. Depending on background,  we may need to do some checking to verify that the derivatives obey the expected rules.)
Now we can use the usual hyperbolic function representations for $\cos iy\;$ and $\sin iy\;$ to obtain an expression for $|\cos z|^2+|\sin z|^2$ equivalent to $\cosh 2y$.
The comment by itself would be solution enough. But I thought I should not hide the ultimately unnecessary computational trail that got me there.
A: Note that
$$\newcommand{\Im}{\operatorname{Im}}
\begin{align}
e^{-2\Im(z)}
&=\left|\,e^{iz}\,\right|^2\\
&=(\cos(z)+i\sin(z))\,(\overline{\cos(z)}-i\,\overline{\sin(z)})\\
&=|\cos(z)|^2+|\sin(z)|^2+i(\sin(z)\,\overline{\cos(z)}-\overline{\sin(z)}\cos(z)\,)\tag1
\end{align}
$$
and
$$
\begin{align}
e^{2\Im(z)}
&=\left|\,e^{-iz}\,\right|^2\\
&=(\cos(z)-i\sin(z))\,(\overline{\cos(z)}+i\,\overline{\sin(z)})\\
&=|\cos(z)|^2+|\sin(z)|^2-i(\sin(z)\,\overline{\cos(z)}-\overline{\sin(z)}\cos(z)\,)\tag2
\end{align}
$$
Therefore,
$$
\begin{align}
|\cos(z)|^2+|\sin(z)|^2
&=\frac{e^{2\Im(z)}+e^{-2\Im(z)}}2\\
&=\cosh(2\Im(z))\tag3
\end{align}
$$
A: Let $z = x + iy$. Then

$$
\cos(z) = \cos(x + iy) = \cos(x)\cosh(y) - i\sin(x)\sinh(y).
$$
So
$$
|\cos(z)|^{2} = \cos^{2}(x)\cosh^{2}(y) + \sin^{2}(x)\sinh^{2}(y).
$$
Using the identities, $\cos^{2}(x) + \sin^{2}(x) = 1 $ and $\cosh^{2}(y) - \sinh^{2}(y) = 1$, we have 
$$
|\cos(z)|^{2} = \cos^{2}(x)(1 + \sinh^{2}(y) ) + (1 - \cos^{2}(x))\sinh^{2}(y) = \cos^{2}(x) + \sinh^{2}(y).
$$
Similarly, 
$$
\sin(z) = \sin(x + iy) = \sin(x)\cosh(y) + i\cos(x)\sinh(y).
$$
So
\begin{align*}
|\sin(z)|^{2} = \sin^{2}(x)\cosh^{2}(y) + \cos^{2}(x)\sinh^{2}(y)& = \sin^{2}(x)(1 + \sinh^{2}(y)) + (1 - \sin^{2}(x))\sinh^{2}(y).\\
& = \sin^{2}(x) + \sinh^{2}(y)
\end{align*}
Thus,
$$
|\cos(z)|^{2} + |\sin(z)|^{2} = \cos^{2}(x) + \sinh^{2}(y) + \sin^{2}(x) + \sinh^{2}(y) = 1 + 2\sinh^{2}(y)
$$
