Real and Imaginary Parts of tan(z)

This is where I'm at:

I know $$ \cos(z) = \frac{e^{iz} + e^{-iz}}{2} , \hspace{2mm} \sin(z) = \frac{e^{iz} - e^{-iz}}{2i}, $$ where $$ \tan(z) = \frac{\sin(z)}{\cos(z)}. $$ Applying the above, with a little manipulation, gives me: $$ \tan(z) = \frac{i\left(e^{-iz} - e^{iz}\right)}{e^{iz} + e^{-iz}}.$$

My thoughts are that I could use $e^{z} = e^{x+iy} = e^x\left(\cos(y) + i\sin(y) \right)$ to express both the numerator and denominator in trig form. Then I could times both by the denominator's complex conjugate as to get a real denominator, which would then, in turn, allow me to express the function in its real and imaginary parts.

However, as I'm sure you'd agree, this is messy, and it's hard to shake the idea that I'm missing something far more elegant.


Solution 1:

I think that the simpler way is to write: $$ \sin z=\sin(x+iy)=\sin x \cos (iy)+\cos x \sin(iy)=\sin x \cosh y +i \cos x \sinh y $$ $$ \cos z=\cos(x+iy)=\cos x \cos (iy)+\sin x \sin(iy)=\cos x \cosh y -i \sin x \sinh y $$ $$ \tan z= \frac{\sin x \cosh y +i \cos x \sinh y}{\cos x \cosh y -i \sin x \sinh y} \cdot\frac{\cos x \cosh y +i \sin x \sinh y}{\cos x \cosh y +i \sin x \sinh y} = $$ $$ =\frac{\sin x \cos x +i \sinh y \cosh y}{\cosh^2 y - \sin^2 x} =\frac{\sin 2x +i \sinh 2y }{2\cosh^2 y - 2\sin^2 x+1-1}=\frac{\sin 2x +i \sinh 2y }{\cos 2x+\cosh2y} $$

Your way seems also good but a bit more complicated.
Edit note: x was written y by mistake in two of expressions which I corrected so that no confusion is encountered.

Solution 2:

$$ \begin{align} \tan(x+iy) &=\overbrace{i\frac{e^{y-ix}-e^{ix-y}}{e^{y-ix}+e^{ix-y}}}^{\tan(z)=i\frac{e^{-iz}-e^{iz}}{e^{-iz}+e^{iz}}}\overbrace{\frac{e^{y+ix}+e^{-ix-y}}{e^{y+ix}+e^{-ix-y}}}^1\\ &=i\frac{e^{2y}-e^{-2y}+e^{-2ix}-e^{2ix}}{e^{2y}+e^{-2ix}+e^{2ix}+e^{-2y}}\\[3pt] &=\frac{\sin(2x)+i\sinh(2y)}{\cosh(2y)+\cos(2x)} \end{align} $$