Bounds for the Gamma function
=============================
.. if-builder:: html
.. toctree::
:maxdepth: 2
1. Bounds for :math:`\Gamma(x)` for real :math:`x`
--------------------------------------------------
The classical bounds (Stirling formula) that results from the Euler-Maclaurin formula for positive integers :math:`n` and :math:`m \geq 0` are
.. raw:: html
$$
\displaystyle \sum\limits_{j =1}^{2m} \frac{B_{2j}}{2j(2j-1)x^{2j-1}} \ \leq \ \log n! - \left(n+\frac{1}{2}\right)\log(n) + n - \log(\sqrt{2\pi}) \ \leq \ \sum\limits_{j =1}^{2m+1} \frac{B_{2j}}{2j(2j-1)x^{2j-1}}.
$$
These inequalities were described in words in more general form in :cite:`Benderski33` and
subsequently rediscovered several times :cite:`Choi12`, :cite:`Camargo24`.
:cite:`Alzer97`
presents an extension of the inequalities above for real arguments in lighlty different form
(see also remark 2.1 of :cite:`Chen16`).
.. admonition:: Theorem (1997)
:class: thm-tme-emt
For real :math:`x > 0` and :math:`m \geq 0`, we have
:math:`\displaystyle \sum\limits_{j =1}^{2m} \frac{B_{2j}}{2j(2j-1)x^{2j-1}} \ \leq \ \log \Gamma(x) - \left(x-\frac{1}{2}\right)\log(x) + x - \log(\sqrt{2\pi}) \ \leq \ \sum\limits_{j =1}^{2m+1} \frac{B_{2j}}{2j(2j-1)x^{2j-1}}`.
There are also several bounds for :math:`\Gamma(x)` with a fixed number of terms available in the literature. For instance,
in p. 118 of Ramanujan's lost notebook :cite:`Andrews-Berndt13`, one finds
.. raw:: html
$$
\displaystyle \sqrt[6]{8x^3+4x^2+x+\frac{1}{100}} \ \leq \ \frac{\Gamma(x+1)}{\sqrt{\pi}\left(\frac{x}{e}\right)^x} \ \leq \ \sqrt[6]{8x^3+4x^2+x+\frac{1}{30}}.
$$
Bounds of similar shape was obtaineb by :cite:`Mortici11`.
.. admonition:: Theorem (2011)
:class: thm-tme-emt
For :math:`\alpha = \frac{128}{1215} \approx 0.105349`,
:math:`\beta = \frac{218 336}{135} − \frac{256e^{24}}{43 046 721 \pi^4} \approx 0.087944`
and :math:`x \geq 3`, we have
:math:`\displaystyle \sqrt[8]{16x^4 + \frac{32}{3}x^3+\frac{32}{9}x^2 - \frac{176}{405}x - \alpha} \ \leq \ \frac{\Gamma(x+1)}{\sqrt{\pi}\left(\frac{x}{e}\right)^x} \ \leq \ \sqrt[8]{16x^4 + \frac{32}{3}x^3+\frac{32}{9}x^2 - \frac{176}{405}x - \beta}`.
Improving on Ramanujan's and some other estimates, :cite:`Chen16` obtained the following result.
.. admonition:: Theorem (2016)
:class: thm-tme-emt
For :math:`x \geq 2`, we have
:math:`\displaystyle 1 - \frac{2117}{5080320x^7}\leq \ \frac{\Gamma(x+1)}{\sqrt{2\pi x}\left(\frac{x}{e}\right)^x \left( 1 + \frac{1}{12x^3+\frac{24}{7}x - \frac{1}{2}} \right)^{x^2+\frac{53}{210}}} \ \leq \ 1 - \frac{2117}{5080320x^7} + \frac{1892069}{2347107840 x^9}`.
Meanwhile, :cite:`Batir08` presented some estimates for :math:`\Gamma(x)` of certain shapes with optimal constants.
.. admonition:: Theorem (2008)
:class: thm-tme-emt
For :math:`x > 0`, :math:`a = \sqrt{2e} = 2.33164`, and :math:`b = \sqrt{2\pi} = 2.50662...` we have
:math:`\displaystyle a\left( \frac{x+1/2}{e}\right)^{x+1/2} \leq \Gamma(x+1) < b\left( \frac{x+1/2}{e}\right)^{x+1/2}`.
The constants :math:`a` and :math:`b` are the best possible.
.. admonition:: Theorem (2008)
:class: thm-tme-emt
For :math:`x \geq 1`, :math:`a = 1/6`, and :math:`b = \frac{e^2}{2\pi} - 1 = 0.176005...` we have
:math:`\displaystyle x^xe^{-x} \sqrt{2\pi(x+a)} < \Gamma(x+1) < x^xe^{-x} \sqrt{2\pi(x+b)}`.
The constants :math:`a` and :math:`b` are the best possible.
2. Bounds for the Digamma function :math:`\psi(x) = \Gamma'(x)/\Gamma(x)` for real :math:`x`
---------------------------------------------------------------------------------------------
Let
.. raw:: html
$$
\displaystyle F_N(\lambda,x) \ = \ \log(x-\lambda) - \sum\limits_{n = 1}^{N} (-1)^{n} \frac{B_n(\lambda)}{n} (x-\lambda)^{-n}.
$$
In :cite:`Diamond-Straub16`, the authors prove the following result.
.. admonition:: Theorem (2016)
:class: thm-tme-emt
Let :math:`N\ge 1` and let :math:`\lambda_0` be the unique root of :math:`B_N(\lambda)` in :math:`[0,1/2]` for :math:`N` even or
the unique root of :math:`B_{N+1}(\lambda)` for :math:`N` odd. For :math:`x > \lambda`, we have
:math:`\left\{ \begin{array}{cl} \psi(x) > F_N(\lambda,x), & N \equiv 1 \mod 4, \ \lambda \ \in \ [\lambda_0, 1/2]; \\ \psi(x) < F_N(\lambda,x), & N \equiv 3 \mod 4, \ \lambda \ \in \ [\lambda_0, 1/2]; \\ \psi(x) > F_N(\lambda,x), & N \equiv 2 \mod 4, \ \lambda \ \in \ [0, \lambda_0]; \\ \psi(x) < F_N(\lambda,x), & N \equiv 0 \mod 4, \ \lambda \ \in \ [0, \lambda_0]. \end{array}\right.`
The first two cases of the theorem above for :math:`\lambda = 0` yields the following result which was previously published in
:cite:`Gordon94`.
.. raw:: html
$$
\displaystyle \log(x) - \frac{1}{2x} - \frac{1}{12x^2} < \psi(x) < \log(x) - \frac{1}{2x} - \frac{1}{12x^2} + \frac{1}{120x^4}.
$$
Some variants of these inequalities for :math:`\psi(x)` can be found in the literature. An example is the following.
.. admonition:: Theorem (:cite:`Mortici11b`)
:class: thm-tme-emt
For :math:`x \geq 1`, we have
:math:`\displaystyle -\frac{1}{24x^2} + \frac{1}{12x^3} - \frac{337}{2280x^4} < \psi(x+1) + \log\left( e^{1/(x+1)} - 1 \right) < -\frac{1}{24x^2} + \frac{1}{12x^3} - \frac{337}{2280x^4} + \frac{97}{720x^5}`.
3. Bounds for the Polygamma functions :math:`\psi(x)', \psi(x)'', \psi(x)''' ...` for real :math:`x`
------------------------------------------------------------------------------------------------------
Let
.. raw:: html
$$
\displaystyle S_k(n,x) \ = \ \frac{(k-1)!}{x^k} + \frac{(k)!}{2x^{k+1}} + \sum\limits_{i = 1}^{n} B_{2i} \left( \prod\limits_{j = 1}^{k-1} (2i+j) \right) \frac{1}{x^{2i+k}}.
$$
:cite:`Alzer16`, proves the following result.
.. admonition:: Theorem (1997)
:class: thm-tme-emt
For :math:`x > 0, k \geq 1` and :math:`n \geq 0`, we have
:math:`S_k(2n,x) < (-1)^{k+1} \psi^{(k)}(x) < S_k(2n+1,x)`.
The first two cases of the theorem above are
.. raw:: html
$$
\displaystyle \frac{1}{x} - \frac{1}{2x^2} < \psi'(x) < \frac{1}{x} - \frac{1}{2x^2} + \frac{1}{6 x^3}.
$$
Similar inequalities were previously obtained by :cite:`Gordon94`. For :math:`x > 0`,
.. raw:: html
$$
\displaystyle \left. \begin{array}{l} \frac{1}{x} + \frac{1}{2x^2} + \frac{1}{6(x+1/14)^3} \\ \frac{1}{x} + \frac{1}{2x^2} + \frac{1}{6x^3} -\frac{1}{30x^5} \end{array} \right\} < \psi'(x) <\left\{ \begin{array}{l} \frac{1}{x} + \frac{1}{2x^2} + \frac{1}{6x^3} \\ \frac{1}{x} + \frac{1}{2x^2} + \frac{1}{6x^3} -\frac{1}{30(x+1/8)^5} \end{array} \right..
$$
Similar inequalities to those of :cite:`Alzer16`
were obtained in equation (3.4) of :cite:`Allassia-Giordano-Pecaric02`
.. admonition:: Theorem (2002)
:class: thm-tme-emt
For :math:`x \geq 1/2`, we have :math:`\displaystyle \frac{(n-1)!}{(x-\frac{1}{2})^n} + \sum\limits_{k = 1}^{2N+1} \frac{B_{2k}(1/2)}{(2k)!}\frac{(n+2k+1)!}{(x-\frac{1}{2})^{n+2k}} < (-1)^{(n+1)}\psi^{(n)}(x) < \sum\limits_{k = 1}^{2N} \frac{B_{2k}(1/2)}{(2k)!}\frac{(n+2k+1)!}{(x-\frac{1}{2})^{n+2k}}`.
The values :math:`B_{2k}(1/2)` in the theorem above are known in explicit form (:cite:`Allasia-Giordano-Pecaric02`)
.. raw:: html
$$
\displaystyle B_{2k}(1/2) \ = \ \left(\frac{1}{2^{2k-1}} - 1 \right) B_{2k}, \ \ k \geq 0.
$$
Several other inequalities for :math:`\psi^{(k)}(x)` can be obtained exploring the relations
between :math:`\psi^{(k)}(x)` and :math:`\psi(x)`. For instance, in
:cite:`Guo-Qi13`, one finds (among other things)
.. raw:: html
$$
\displaystyle e^{-\psi(x+1)} \ < \ \sqrt[n]{\frac{|\psi^{(n)}(x)|}{(n-1)!}} \ < \ e^{-\psi(x)}, \ k \geq 0, x > 0.
$$
4. Complex Stirling formula
---------------------------
The complex version of the Euler-maclaurin formula for the Gamma function (see, e.g., :cite:`Lang99`, p. 422) is
.. raw:: html
$$
\displaystyle \log(\Gamma(s)) \ = \ \left( s - \frac{1}{2} \right)\log(s) - s + \log(\sqrt{2\pi}) - \int\limits_{0}^{\infty} \frac{B_1(t-\lfloor t \rfloor)}{z+t} dt,
$$
which holds for all nonzero complex numbers :math:`s` which does not have negative real part. In the relation above, :math:`\log`
means the principal branch of the logarithm and :math:`B_1(x) = x - \frac{1}{2}` is the Bernoulli polynomial of degree one.
Using similar expressions with more terms of the Euler-Maclaurin formula, one might be able to deduce the complex version of Stirling's formula
(see :cite:`Gradshteyn-Ryshik07`, 8.344):
.. raw:: html
$$
\displaystyle \log \Gamma(s) \ = \ \left(s-\frac{1}{2}\right)\log(s) - s - \log(\sqrt{2\pi}) + \sum\limits_{j =1}^{n-1} \frac{B_{2j}}{2j(2j-1)x^{2j-1}} + R_n(z), n \geq 1,
$$
with
.. raw:: html
$$
\displaystyle |R_n(z)| \ \leq \ \frac{|B_{2n}|}{2n(2n-1)|s|^{2j-1}\cos^{2n-1}\left(\frac{1}{2}\arg(s)\right)}.
$$
A few other estimates can be found in Section 20.2 of :cite:`Ramare22`.
For :math:`0 < \delta < \pi` and :math:`s = |s|e^{i\phi}` with :math:`|\phi| \leq \pi - \delta`, the following holds
.. raw:: html
$$
\displaystyle \Gamma(s) \ = \ \sqrt{2\pi} e^{\log(s)(s-1/2)-s} e^{\xi_s}, \quad \mbox{with} \quad |\xi_s| \leq \frac{1}{12\sin^2(\delta/2) |s|}.
$$
For :math:`s = \sigma + it` with :math:`\sigma > 0`, we also have
.. raw:: html
$$
\displaystyle |\Gamma(s)| \ \leq \ \sqrt{2\pi} |s|^{\sigma - 1/2} e^{-\pi |t|/2} e^{1/(6|s|)}
$$
and
.. raw:: html
$$
\displaystyle |\Gamma(s)| \ \geq \ \sqrt{2\pi} |s|^{\sigma - 1/2} e^{-\pi |t|/2} e^{-\sigma^3/t^2}.
$$
4. Complex Stirling formula
---------------------------
The complex version of the Euler-maclaurin formula for the Gamma function (see, e.g., :cite:`Lang99`, p. 422) is
.. raw:: html
$$
\displaystyle \log(\Gamma(s)) \ = \ \left( s - \frac{1}{2} \right)\log(s) - s + \log(\sqrt{2\pi}) - \int\limits_{0}^{\infty} \frac{B_1(t-\lfloor t \rfloor)}{z+t} dt,
$$
which holds for all nonzero complex numbers :math:`s` which does not have negative real part. In the relation above, :math:`\log`
means the principal branch of the logarithm and :math:`B_1(x) = x - \frac{1}{2}` is the Bernoulli polynomial of degree one.
Using similar expressions with more terms of the Euler-Maclaurin formula, one might be able to deduce the complex version of Stirling's formula
(see :cite:`Gradshteyn-Ryshik07`, 8.344):
.. raw:: html
$$
\displaystyle \log \Gamma(s) \ = \ \left(s-\frac{1}{2}\right)\log(s) - s - \log(\sqrt{2\pi}) + \sum\limits_{j =1}^{n-1} \frac{B_{2j}}{2j(2j-1)x^{2j-1}} + R_n(z), n \geq 1,
$$
with
.. raw:: html
$$
\displaystyle |R_n(z)| \ \leq \ \frac{|B_{2n}|}{2n(2n-1)|s|^{2j-1}\cos^{2n-1}\left(\frac{1}{2}\arg(s)\right)}.
$$
A few other estimates can be found in Section 20.2 of :cite:`Ramare22`.
For :math:`0 < \delta < \pi` and :math:`s = |s|e^{i\phi}` with :math:`|\phi| \leq \pi - \delta`, the following holds
.. raw:: html
$$
\displaystyle \Gamma(s) \ = \ \sqrt{2\pi} e^{\log(s)(s-1/2)-s} e^{\xi_s}, \quad \mbox{with} \quad |\xi_s| \leq \frac{1}{12\sin^2(\delta/2) |s|}.
$$
For :math:`s = \sigma + it` with :math:`\sigma > 0`, we also have
.. raw:: html
$$
\displaystyle |\Gamma(s)| \ \leq \ \sqrt{2\pi} |s|^{\sigma - 1/2} e^{-\pi |t|/2} e^{1/(6|s|)}
$$
and
.. raw:: html
$$
\displaystyle |\Gamma(s)| \ \geq \ \sqrt{2\pi} |s|^{\sigma - 1/2} e^{-\pi |t|/2} e^{-\sigma^3/t^2}.
$$