<s>[INST] Asymptotic expansion of the solution of $\tan x=x$. I am trying to find an asymptotic expansion of the soltion $x_n$ of the equation $\tan x=x$ in the intervall $I_n= \left]-\frac{\pi}{2}+n\pi , \frac{\pi}{2} + n\pi\right[$. I have showed that
$$x_n = n\pi + \frac{\pi}{2}-\frac{1}{n\pi}+o\left(\frac{1}{n}\right)$$ But I still need an other term, to find the result :
$$ x_n =n\pi + \frac{\pi}{2}-\frac{1}{n\pi}+\frac{1}{2\pi n^2}+o\left(\frac{1}{n^2}\right)$$ !
Any help is really appreciated !
NB: I have checked many similar responses in the website but I need to see the calculation and understand it ;) !
 [/INST] Too long for a comment
Let's look for the solution in the form $x=\pi n+\frac{\pi}{2}-x_1+x_2+...$, where $x_2\ll x_1\ll1$.
We also suppose $\frac{x_2}{x_1}\sim x_1$
$$\tan x=x\,\Rightarrow\,\tan(\pi n+\frac{\pi}{2}-x_1+x_2+..)=\cot(x_1-x_2-..)=x=\pi n+\frac{\pi}{2}-x_1+x_2+..$$
$$\cot(x_1-x_2-..)=\frac{\cos()}{\sin()}=\frac{1-\frac{(x_1-x_2)^2}{2}-...}{(x_1-x_2-..)(1-\frac{(x_1-x_2)^2}{6}-..)}=\frac{1-\frac{(x_1-x_2)^2}{2}-...}{x_1(1-\frac{x_2-..}{x_1})(1-\frac{(x_1-x_2)^2}{6}-...)}$$
$$\frac{1}{x_1}\Big(1+\frac{x_2}{x_1}+...\Big)\Big(1-\frac{(x_1-x_2)^2}{3}-...\Big)=\pi n+\frac{\pi}{2}-x_1+x_2+...$$
$$\frac{1}{x_1}+\frac{x_2}{x_1^2}+...=\pi n+\frac{\pi}{2}-x_1+x_2+...$$
$$\frac{1}{x_1}=\pi n\,\Rightarrow\,x_1=\frac{1}{\pi n}$$
$$\frac{x_2}{x_1^2}=\frac{\pi}{2}\,\Rightarrow\, x_2=\frac{\pi}{2}x_1^2=\frac{1}{2\pi n^2}$$
$$x=\pi n+\frac{\pi}{2}-x_1+x_2+...=\pi n+\frac{\pi}{2}-\frac{1}{\pi n}+\frac{1}{2\pi n^2}+...$$
</s>