I need to gain understanding of a proof of Stirling's formula. I have read through Tim Gowers' and Terence Tao's but I'm struggling to follow them. How rigorous is this proof, if at all? Thank you.
\begin{equation} \Gamma(n+1)=n!=\int_0^\infty t^n\mathrm{e}^{-t}\,\mathrm{d}t \end{equation}
Take the log of the integrand:
\begin{equation} \mathrm{log}(t^n\mathrm{e}^{-t})=n\mathrm{log}(t)-t \end{equation}
Let $t=n+\epsilon$, then:
\begin{equation} \begin{aligned} \mathrm{log}(t^n\mathrm{e}^{-t})&=n\mathrm{log}(n+\epsilon)-(n+\epsilon) \\ &=n\mathrm{log}\left(n\left(1+\frac{\epsilon}{n}\right)\right)-(n+\epsilon) \\ &=n\left(\mathrm{log}(n)+\mathrm{log}\left(1+\frac{\epsilon}{n}\right)\right)-(n+\epsilon) \\ \end{aligned} \end{equation}
For very large $n$, $\tfrac{\epsilon}{n}<1$
Taylors series for $\mathrm{log}(1+x)$ is:
\begin{equation} \begin{aligned} \mathrm{log}(1+x) &= x - \frac{x^2}{2}+\frac{x^3}{3}-\frac{x^4}{4}\pm \ldots \\ \implies \mathrm{log}(1+\tfrac{\epsilon}{n})&=\sum_{k=1}^{\infty} \frac{{(-1)}^{k+1}}{k} \frac{\epsilon^{k}}{n^k} \end{aligned} \end{equation}
\begin{equation} \begin{aligned} \therefore \,\,\, \mathrm{log}(t^n\mathrm{e}^{-t})&=n\Bigg(\mathrm{log}(n)+\sum_{k=1}^{\infty} \frac{{(-1)}^{k+1}}{k} \frac{\epsilon^{k}}{n^k}\Bigg)-n-\epsilon \\ &=n\mathrm{log}(n)-n+\sum_{k=1}^{\infty} \frac{{(-1)}^{k+1}}{k} \frac{\epsilon^{k}}{n^{k-1}} \\ &=n\mathrm{log}(n)-n-\frac{\epsilon^2}{2n}+\frac{\epsilon^{3}}{3n^{2}}-\frac{\epsilon^{4}}{4n^{3}} \end{aligned} \end{equation}
As this is only an approximation, take only the first term in the series,
\begin{equation} \begin{aligned} \therefore \,\,\, \mathrm{log}(t^n\mathrm{e}^{-t}) &\approx n\mathrm{log}(n)-n-\frac{\epsilon^2}{2n} \\ \implies t^n\mathrm{e}^{-t} &\approx \frac{n^n}{\mathrm{e}^n}\mathrm{e}^{-\frac{\epsilon^2}{2n}} \end{aligned} \end{equation}
Then putting it into our original integral:
\begin{equation} n!=\int_0^\infty t^n\mathrm{e}^{-t}\,\mathrm{d}t=\int_{-n}^\infty \frac{n^n}{\mathrm{e}^n}\mathrm{e}^{-\frac{\epsilon^2}{2n}}{d}\epsilon \end{equation}
As $\int_0^\infty \mathrm{e}^{-px^2}\,\mathrm{d}x=\sqrt{\frac{\pi}{p}}$
\begin{equation} n!\approx n^n\mathrm{e}^{-n}\sqrt{2\pi n} \end{equation}