Locating the maximum point $x_n$ of $f_n(x):=e^{-1/x}\Bigl(1+\frac{1}{n^2 x^n} \Bigr)$ in $(0,1)$ I am trying to observe the behavior of $x_n \in (0,1)$ defined such that the function
\begin{equation}
f_n(x):=e^{-1/x}\Bigl(1+\frac{1}{n^2 x^n} \Bigr)
\end{equation}
attains its maximum inside the interval $(0,1)$ at $x=x_n$.
Upon using the Wolfram alpha, I have found out that as $n \to \infty$ it seems that $x_n \to 0^+$ and
\begin{equation}
\int_0^1 f_n(x) dx \leq 2 \int_0^{2x_n} f_n(x)dx.
\end{equation}
That is, as $n \to \infty$, the graph of $f_n$ on $(0,1)$ is sufficiently localized around its maximum value.
Now my question are the following two:

*

*I am trying to estimate the rate at each $x_n \to 0^+$ as $n \to \infty$. But I cannot find a nice way to do so.


*Is the above estimate for the integral correct? How one can prove it? Could anyone please help me with it as well?
This kind of analysis is quite new to me, so I am a bit stuck. I deeply appreciate any help.
 A: The maximum $x_n$ of
$$f_n(x):=e^{-1/x}\Bigl(1+\frac{1}{n^2 x^n} \Bigr)$$
is the smallest solution in $(0,1)$ of the equation
$$x=n x^n+\frac{1}{n}.$$
For $n\gg 1$ this gives $x_n\rightarrow 1/n$.
The integral is given by
$$\int_0^1 f_n(x)dx=\text{Ei}(-1)+n^{-2}\,\Gamma (n-1,1)+1/e$$
$$\qquad\rightarrow \sqrt{2 \pi } e^{-n} n^{n-\frac{7}{2}}\;\;\text{for}\;\;n\gg 1.$$
Here is a comparison of the exact integral (gold data points) and the asymptote (blue) --- the difference is hardly noticeable for $n>10$.

A: Suppose that you consider
$$f(x)=n^2 x^n-n x+1+O(x^{n+1})$$
Use power series reversion to obtain
$$x_n=-\frac {f(x)-1}n+(-1)^n \frac {(f(x)-1)^n}{n^{n-1} }+O\left((f(x)-1)^{n+1}\right)$$ Since we want $f(x)=0$, then
$$\color{blue}{\large x_n=\frac 1 n+\frac 1{n^{n-1}}}$$ which is extremly accurate. For example, for $n=10$, the difference between the estimate and the solution is
$\sim 1.0 \times 10^{-16}$.
Even if it does not mean much
$$f(x_n)=n^{2-n} \left(\left(n^{2-n}+1\right)^n-1\right)$$ is very small (as expected). For example, $f(x_5)=3.25\times 10^{-4}$ and $f(x_{10})=1.00\times 10^{-15}$.
Edit
Using one step of Newton method with $x_0=\frac 1n$, a much better estimate is
$$\color{blue}{\large x_n=\frac 1 n+\frac 1{n^{n-1}-n^2}}$$
For example, for $n=10$, the difference between the estimate and the solution is
$\sim 4.5 \times 10^{-24}$.
Since, for $t>0$
$$\int_0^t e^{-1/x} \left(1+\frac{1}{n^2 x^n}\right)\,dx=\frac{\Gamma \left(n-1,\frac{1}{t}\right)}{n^2}+e^{-1/t} t-\Gamma
   \left(0,\frac{1}{t}\right)$$ the integral inequality holds forall $n>5$ using for $x_n=\frac 1n$ or any of the above estimates.
Update
Just fr the fun, using one single iteration of Halley method instead of Newton
$$\color{blue}{\large x_n=\frac 1n +\frac{2 n \left(n^n-n^3\right) } {2 n^n \left(n^n-2 n^3\right)+n^5 (n+1) }}$$ which, for $n=5$ give the solution within an error of $1.05\times 10^{-8}$; the corresponding value of the function is  $5.05\times 10^{-8}$.
