Asymptotic expansion of the logarithmic integral

I am trying to derive the asymptotic expansion for the logarithmic integral. I found the following question very useful (logarithmic integral function and asymptotic expansion), but I am still not getting the right conclusion and so I wanted to ask this question.

I am supposed to find that $$Li(x) = \frac{x}{\log x} + \frac{1!x}{\log^2x}+\cdots+\frac{(k-1)!x}{\log^kx}+O\left(\frac{x}{\log^{k+1}x}\right)$$, but I get extra terms that I don't know how to remove.

We have $$Li(x) = \int_2^x\frac{1}{\log t}dt = \int_{\log2}^{\log x}\frac{e^y}{y}dy$$ after a change of variables ($$t=e^y$$). But if I apply integration by parts to this, I find the desired terms, but also some undesired terms (of the form $$2/\log^k2)$$.

\begin{align*} Li(x) &= \frac{e^y}{y}\Big|_{\log2}^{\log x} + \int_{\log2}^{\log x}\frac{e^y}{y^2}dy \\ &= \frac{x}{\log x}-\frac{2}{\log2} + \frac{e^y}{y^2}\Big|_{\log2}^{\log x} + \int\frac{2e^y}{y^3}dy \\ &= \frac{x}{\log x} + \frac{x}{\log^2x}-\frac{2}{\log2}-\frac{2}{\log^22} + \int\frac{2e^y}{y^3}dy. \end{align*} It's very clear that as I repeat this process I am going to get these unwanted terms. So can anybody explain to me how to remove these and find what we desire?

• For any fixed positive $k$, the function under the big-$\mathcal{O}$ is undbounded as $x\to +\infty$. Hence, you can absorbe the constants into the error term since they are all bounded functions of $x$.
– Gary
Commented Apr 20, 2020 at 9:04

You do not remove the terms $$-\frac2{\log^k2}$$. You tuck them under the $$O\left(\frac x{\log^{k+1}x}\right)$$ term in the asymptotic expansion, since they are all constants.