Prove that the equation $\tan (z)=z$ has only real roots. Prove that the equation $\tan(z)=z$ has only real roots. How to do it?
The idea is that the increment of the argument need to look at the boundary of the square with a side of $\pi n$ and another that $\tan(z)-z$ has a pole at $0$. I do not know how to use it. 
 A: Consider Rouchet's Theorem for meromorphic functions:

*

*$f$, $g$ are meromorphic in open connected $G \subset \overline{\mathbb{C}}$


*$f(z)>g(z)$ on $\partial G$.
Then $$Z_{f+g} - P_{f + g} = Z_{f} - P_{f}$$ where $Z_h$, $P_h$ denote the number of zeroes and poles of $h$ inside $G$ counted with multiplicieties.
Now  consider two functions, $f(z)=z$ and $g(z)=-\tan(z)$ on the circle $|z|=\pi n$.
As we know, $\tan(z)$ is bounded outside the $\epsilon$-neighborhood of its poles $\pi/2 + \pi n, n \in \mathbb{Z}$.
Choose $M$ s.t. the inequality $M\ge |\tan(z)|$ holds outside the $\epsilon$-neighborhood of $\pi/2 + \pi n, n \in \mathbb{Z}$.
On the circle $|z|=\pi n$ for large enough $n$ we have:
$$
|z| = \pi n > M \ge |\tan(z)|
$$
since $|\pi n - (\pi/2 + \pi k)| \ge \epsilon$. (Just choose $\epsilon < \pi/2$ and adjust the corresponding $M$).
By Rouchet's Theorem for meromorphic functions:
$$
Z_{z-tan(z)} - P_{z-tan(z)} = Z_{z} - P_{z} \\
\implies Z_{z-tan(z)} = P_{z-tan(z)} + Z_{z} - P_{z} = 2n + 1 - 0 = 2n + 1
$$
which is exactly the number of real roots of the equation $\tan(x)=x$ on $x \in (-\pi n, \pi n)$:

*

*3 roots on interval $x \in (-\pi/2, \pi/2)$

*1 root on each interval $ x \in (-\pi k + \pi/2, -\pi (k-1) + \pi /2)$, $k=1, 2, 3, ..., n$

*1 root on each interval $x \in (\pi/2 + \pi k, \pi /2 + \pi k)$, $k=0, 1, 2, 3,..., n-1$
A: Suppose $\tan(x+iy)=x+iy$. Use the expansion $\tan(x+iy)=\frac{\sin2x}{\cos2x+\cosh2y}+i\frac{\sinh 2y}{\cos 2x+\cosh 2y}$ to get: $$\frac{1}{\cos2x+\cosh2y}(\sin2x+i \sinh2y)=x+iy .$$
This means that the 2 vectors $(\sin2x,\sinh2y)$ and $(x,y)$ are proportional, and therefore the determinant of the matrix $\begin{pmatrix}x & y \\ \sin2x &\sinh2y \end{pmatrix}=0$. 
We get $x \sinh2y=y \sin2x$. Using the well-known inequalities $$|\sin t| \leq |t|,|\sinh t| \geq |t|$$ we see that we must have $x=0$ or $y=0$ (this is true because equality holds in the inequalities above iff $t=0$).
The case $y=0$ gives the wanted real solutions, and a small calculation shows that the case $x=0$ gives the one-and-only imaginary solution, namely $z=0$.
