TITLE: All positive solutions of $\tan x=x$
QUESTION [9 upvotes]: If $x_1,x_2,\cdots$ are all positive solutions of the equation $\tan x-x=0$ Find value of:
$$S=\sum_{k=1}^{\infty}\cos^2(x_k)$$
My try:
The first solution will be in the interval $\left(\frac{\pi}{2}, \frac{3\pi}{2}\right)$ in which $\tan x$ is monotonic. 
So the solution in that interval is given by $$x_1=\tan^{-1}(x_1)$$
So $$\cos(x_1)=\cos(\tan^{-1}(x_1))=\frac{1}{\sqrt{1+x_1^2}}$$
Hence
$$S=\sum_{k=1}^{\infty}\frac{1}{1+x_k^2}$$
Any way to proceed here?

REPLY [4 votes]: We will use techniques similar to those used in this answer.

Consider the function
$$\newcommand{\Res}{\operatorname*{Res}}\newcommand{\Im}{\operatorname{Im}}
f(z)=\frac{\frac{z^2}{1+z^2}}{\tan(z)-z}\tag1
$$
$f$ has $3$ singularities other than those in $S=\{z_n\in\mathbb{C}\setminus\{0\}:\tan(z_n)=z_n\}$: $\{0,+i,-i\}$.

Near $z=0$, we have $\tan(z)=z+\frac{z^3}3+O\!\left(z^5\right)$, thus,
$$
\begin{align}
f(z)
&=\frac{z^2\left(1+O\!\left(z^2\right)\right)}{\frac{z^3}3\left(1+O\!\left(z^2\right)\right)}\\
&=\frac3z+O(z)\tag2
\end{align}
$$
Therefore,
$$
\Res_{z=0}(f(z))=3\tag3
$$

Near $z=i$, we have $\frac1{1+z^2}=\frac1{z+i}\frac1{z-i}$, thus,
$$
\begin{align}
f(z)
&=\frac1{z-i}\frac{\frac{i^2}{2i}}{\tan(i)-i}+O(1)\\
&=\frac1{z-i}\frac1{2(\tanh(1)-1)}+O(1)\tag4
\end{align}
$$
Therefore,
$$
\Res_{z=i}(f(z))=\frac1{2(\tanh(1)-1)}\tag5
$$

Since $f$ is odd,
$$
\Res_{z=-i}(f(z))=\frac1{2(\tanh(1)-1)}\tag6
$$

Near $z=z_n$, where $z_n\in S$, we have
$$
\begin{align}
f(z)
&=\frac1{z-z_n}\frac{\frac{z_n^2}{1+z_n^2}(z-z_n)}{\tan(z)-z}+O(1)\\
&=\frac1{z-z_n}\frac{\frac{\tan^2(z_n)}{1+\tan^2(z_n)}}{\sec^2(z_n)-1}+O(1)\\[6pt]
&=\frac{\cos^2(z_n)}{z-z_n}+O(1)\tag7
\end{align}
$$
Therefore,
$$
\Res_{z=z_n}(f(z))=\cos^2(z_n)\tag8
$$

For each $k\in\mathbb{Z}$,
$$
|\tan(k\pi+iy)|=|\tanh(y)|\lt1\tag9
$$
Furthermore, for $\Im(z)\gt\pi$,
$$
|\tan(z)|\le\coth(|\Im(z)|)\le\coth(\pi)\tag{10}
$$
Therefore, on the square of side $2k\pi$ centered at $0$, we have $|\tan(z)|\le\coth(\pi)$. Thus, on those squares,
$$
\begin{align}
f(z)
&=\frac{1+O\!\left(\frac1{z^2}\right)}{-z\left(1+O\!\left(\frac1z\right)\right)}\\
&=-\frac1z+O\!\left(\frac1{z^2}\right)\tag{11}
\end{align}
$$
Therefore, the sum of all the residues is $-1$.

Pulling together $(3)$, $(5)$, $(6)$, $(8)$, and $(11)$, we get
$$
-1=3+\frac1{\tanh(1)-1}+\sum_{z_n\in S}\cos^2(z_n)\tag{12}
$$
gives
$$
\begin{align}
\sum_{z_n\in S}\cos^2(z_n)
&=-4-\frac1{\tanh(1)-1}\\
&=\frac{e^2-7}2\tag{13}
\end{align}
$$
This includes both positive and negative solutions of $\tan(x)=x$. Thus, the sum over the positive solutions is
$$
\sum_{z_n\in S^+}\cos^2(z_n)=\frac{e^2-7}4\tag{14}
$$