<s>[INST] A long nasty limit problem: $\lim_{x \to \infty}\left[8e\,\sqrt[\Large x]{x^{x+1}(x-1)!}- 8x^2-4x \ln x - \ln^2 x - (4x + 2 \ln x) \ln 2\pi\right]$ Does the following limit admit a closed-form?
$$\lim_{x \to \infty}\left[8e\,\sqrt[\Large x]{x^{x+1}(x-1)!}- 8x^2-4x \ln x - \ln^2 x - (4x + 2 \ln x) \ln 2\pi\right]$$
My professor gives this question as a challenge problem in the end of calculus class but I can't solve it. I tried to use a Stirling's approximation for the first term and I got
$$8e\,\sqrt[\Large x]{x^{x+1}(x-1)!} = 8e\cdot x\sqrt[\Large x]{x!} \sim 8 x^2\cdot \sqrt[\Large 2x]{2\pi x}$$but I don't know how to use it to solve the original problem. Any idea? Any help would be appreciated. Thanks in advance.
 [/INST] Taking the logarithm of the first term divided by $ 8e $:
$$ \frac 1 x\left[x\ln x + \ln\left(x!\right)\right], $$
Stirling-approximate the second term to get
$$ \ln\left(x!\right) = x\ln x - x + \frac 1 2\ln x + \frac 1 2 \ln 2\pi + \frac 1 {12x} + \mathcal{O}(x^{-1}). $$
The first term is therefore
$$\begin{align} &8\exp\left[1 + 2 \ln x - 1 + \frac 1 2\frac{\ln x}{x} + \frac 1 2 \frac{\ln 2\pi}{x} + \frac 1 {12x^2} + \mathcal{O}(x^{-2})\right]\\
&=8x^2 \cdot \exp\left[\frac 1 2\frac{\ln x}{x} + \frac 1 2 \frac{\ln 2\pi}{x} + \frac 1 {12x^2} + \mathcal{O}(x^{-2})\right];
\end{align}$$
now expand the exponential to order $ \mathcal{O}(x^{-2}) $ and you get
$$\begin{align} &8x^2 \bigg[1 + \bigg(\frac 1 2\frac{\ln x}{x} + \frac 1 2 \frac{\ln 2\pi}{x} + \frac 1 {12x^2}\bigg) +\frac 1 2\bigg(\frac 1 2\frac{\ln x}{x} + \frac 1 2 \frac{\ln 2\pi}{x} \bigg)^2 + \mathcal{O}(x^{-2}) \bigg]\\
& =8x^2 \bigg[1 + \frac 1 2\frac{\ln x}{x} + \frac 1 2 \frac{\ln 2\pi}{x} + \frac 1 {12x^2} +\frac 1 8\frac{\ln^2 x}{x^2} + \frac 1 8 \frac{\ln^2 2\pi}{x^2} + \frac 1 4 \frac{\ln x\ln 2\pi}{x^2} + \mathcal{O}(x^{-2}) \bigg]\\
& = 8x^2 +4x\ln x + 4x\ln 2\pi + \frac 2 {3} + \ln^2 x 
+ \ln^2 2\pi + 2\ln x\ln 2\pi + \mathcal{O}(1),
\end{align}$$
which cancel term by term with the rest of the expression to give $ \ln^2 2\pi +\dfrac{2}{3} $.
</s>