Finding the big-$O$ estimate of the solutions to $\cot x = x$ So a problem for my class I am asked to find the big-$O$ estimate (up to 3 terms) of the solutions to $\cot x = x$. We label the solutions to this equation in increasing order $0<x_1<x_2<\cdots$ and we wish to find the expansion of $x_n$ as $n \rightarrow\infty$.
I've computed the expansion
$$\cot x = x^{-1} - \frac{1}{3}x - \frac{1}{45}x^3 + O(x^5)$$
I observe graphically that for integer $m\ge0$ there exists exactly one solution between $m\pi$ and $(m+1/2)\pi$ ($x_{m+1}$ by the previous labelling). So we know that the leading order of $x_n$ should be $(n-1)\pi$. I'm not sure where to proceed from here. I tried iterating $x$ in the series expansion, but the increasing powers of $x$ gives larger errors with each iteration.

You already find the first term $n\pi$ for $x_n$ (with $0=x_0<x_1<...$). So, let's denote $x_n=n\pi+y_n$ with $y_n=\mathcal{o}(n)$ and $0<y_n<\frac{\pi}{2}$.
$$\begin{align}
&\Longrightarrow \cot(y_n)=n\pi+y_n  \xrightarrow{n\to+\infty}+\infty \\
&\Longrightarrow  y_n  \xrightarrow{n\to+\infty} 0
\end{align}$$
So $y_n=\mathcal{o}(1)$ and we can compute the series expansion of $\cot(y_n)$ when $y_n \to 0$, we have
$$\begin{align}
n\pi+y_n=\cot(y_n) = \frac{1}{y_n}+\mathcal{O}(y_n) &\Longleftrightarrow n\pi = \frac{1}{y_n}+\mathcal{O}(y_n)\\
&\Longleftrightarrow y_n = \frac{1}{n\pi + \mathcal{O}(y_n)}\\\
&\Longleftrightarrow y_n = \frac{1}{n\pi } \left(1 + \mathcal{O}(\frac{y_n}{n})  \right)\\\
&\Longleftrightarrow y_n = \frac{1}{\pi}\cdot\frac{1}{n}+\mathcal{o}\left(\frac{1}{n}  \right)\\
\end{align}$$
We obtain then the second term $\frac{1}{\pi}\cdot\frac{1}{n}$.
Let's denote $x_n=n\pi+ \frac{1}{\pi}\cdot\frac{1}{n}+z_n$ with $z_n=\mathcal{o}\left(\frac{1}{n}  \right)$. We have
$$\begin{align}
n\pi+\frac{1}{\pi}\cdot\frac{1}{n}+z_n &=\cot\left(\frac{1}{\pi}\cdot\frac{1}{n}+z_n  \right) \\&=\frac{1}{\frac{1}{\pi}\cdot\frac{1}{n}+z_n} -\frac{1}{3}\left( \frac{1}{\pi}\cdot\frac{1}{n}+z_n \right)+\mathcal{o}\left( \frac{1}{n} \right)\\
&=\pi n \left(1+ \pi n z_n  \right)^{-1}-\frac{1}{3}\left( \frac{1}{\pi}\cdot\frac{1}{n}+z_n \right)+\mathcal{o}\left( \frac{1}{n} \right)\\
&=\pi n \left(1- \pi n z_n +\mathcal{o}(n^2z_n^2) \right)-\frac{1}{3\pi}\cdot\frac{1}{n}+\mathcal{o}\left( \frac{1}{n} \right)\\
&=\pi n - \pi^2 n^2 z_n +\mathcal{o}(n^2z_n)-\frac{1}{3\pi}\cdot\frac{1}{n}+\mathcal{o}\left( \frac{1}{n} \right)\tag{1}\\
\end{align}$$
Then
$$\begin{align}
 (1) &\Longleftrightarrow \frac{4}{3\pi}\cdot\frac{1}{n} = -\pi^2 n^2 z_n++\mathcal{o}(n^2z_n)+\mathcal{o}\left( \frac{1}{n} \right)\\
&\Longleftrightarrow z_n = -\frac{4}{3\pi^3}\cdot\frac{1}{n^3} +\mathcal{o}\left( \frac{1}{n^3} \right)\\\
\end{align}$$
Conclusion:
$$x_n = n\pi+\frac{1}{\pi}\cdot\frac{1}{n}-\frac{4}{3\pi^3}\cdot\frac{1}{n^3} +\mathcal{o}\left( \frac{1}{n^3} \right)$$
