Can You Perform Operations on a Big O Term

67 Views Asked by At

I am a student and have been reading about Stirling's approximation of the gamma function. Wikipedia has a result as follows

$$\Gamma(z) = \sqrt{\frac{2\pi}{z}}\left(\frac{z}{e}\right)^z\left(1 + O\left(\frac{1}{z}\right)\right)$$

If I take the log of both sides I get $$\ln\left(\Gamma(z)\right) = \ln\left(\sqrt{\frac{2\pi}{z}}\left(\frac{z}{e}\right)^z\left(1 + O\left(\frac{1}{z}\right)\right)\right) = \frac{1}{2}\ln\left(\frac{2\pi}{z}\right) + z\ln(z) - z + \ln\left(1 + O\left(\frac{1}{z}\right)\right)$$

I would like to know if there is a way to convert the $\ln\left(1 + O\left(\frac{1}{z}\right)\right)$ term to a single $O(f(z))$ term. Or maybe similarly, what happens if you take the natural log of a big O term?

I have also looked at this post. One thing I noticed in this post is that the asymptotic notation included information about where it converges. In the above post, the user who asked the question specifies as $s \rightarrow 1^+$. In this case, I believe I would be looking at $z \rightarrow \infty$. If that is the case why doesn't the $O\left(\frac{1}{z}\right)$ term go away since $$\lim_{z\rightarrow\infty}\frac{1}{z} = 0$$

After some help from @Andrew D. Hwang, @FShrike, and @CyclotomicField, I understand now that $\ln(1 + u) = u - \frac{u^2}{2} + \frac{u^3}{3} - \ldots$ by the Maclaurin expansion. I also believe that we can similarly say $$\ln\left(1 + \frac{1}{z}\right) = \frac{1}{z} - \frac{1}{2z^2} + \frac{1}{3z^3} \ldots = O\left(\frac{1}{z}\right) | z\to\infty$$.

So, now I am not entirely sure if $$\ln\left(1 + O\left(\frac{1}{z}\right)\right) = O\left(\frac{1}{z}\right)$$ However, I believe this is saying that there is some constant $c$ such that $$\ln\left(1 + \frac{c}{z}\right) = O\left(\frac{1}{z}\right)$$ I believe any positive $c$ would work here. Am I right in thinking this?

I appreciate any direction you can provide.