# How to show that $\left| \Gamma \left(x + iy \right) \right|^{2} \approx (\pi y^{(2x - 1)}) /(\cosh(\pi y))$?

I found the approximation: $$\left| \Gamma \left(x + iy \right) \right|^{2} \approx \frac{\pi y^{(2x - 1)}}{\cosh(\pi y)}$$ for $$y \gt 2$$, within an answer for another question, but I could not figure out where it comes from, nor find it anywhere else. How is this approximation derived and what is the error in the approximation?

From the context in which the approximation was used, $$0\leq x\leq 1$$ and $$y>2$$. I will assume that $$y\gg x$$ and, therefore, $$y \gg 1$$.

From the Stirling approximation, $$\Gamma(z) \approx \sqrt{\frac{2\pi}{z}} \left(\frac{z}{e}\right)^{z},$$ Since $$\Gamma(z)$$ is a holomorphic function for $$\mathrm{Re}(z)>0$$, $$\Gamma(\bar{z})=\overline{\Gamma(z)}$$. Therefore, $$|\Gamma(z)|^2 = \Gamma(z) \Gamma(\bar{z}) \approx \frac{2\pi}{\sqrt{z \bar{z}}}\left(\frac{z}{e}\right)^{z} \left(\frac{\bar{z}}{e}\right)^{\bar{z}}=\frac{2\pi}{|z|}\left(\frac{z}{e}\right)^{z} \left(\frac{\bar{z}}{e}\right)^{\bar{z}}.$$ Using $$z=re^{i\theta}$$, $$|\Gamma(z)|^2 \approx \frac{2\pi}{r} (r e^{-1+i\theta})^{z} (re^{-1-i\theta})^{\bar{z}} = 2\pi r^{z+\bar{z}-1} \exp(z(-1+i\theta)-\bar{z}(1+i\theta)).$$ Using $$z + \bar{z} = 2x$$, $$z-\bar{z}=2iy$$ and $$r^2=x^2+y^2$$, we get $$|\Gamma(z)|^2 \approx 2\pi (x^2+y^2)^{(2x-1)/2} \exp(-2x -2y\theta).$$ Assuming $$y \gg x$$ and $$y \gg 1$$, $$x^2+y^2 \approx y^2$$ and $$\theta \approx \pi/2$$, leading to $$|\Gamma(z)|^2 \approx 2\pi y^{2x-1} \exp(-\pi y),$$ in which the term $$2x$$ in the argument of the exponential vanished because it's negligible compared to $$\pi y$$. Since $$2\cosh y = e^y + e^{-y} \approx e^y$$ for large $$y$$, we have finally $$|\Gamma(x+iy)|^2 \approx \frac{\pi y^{2x-1}}{\cosh(\pi y)}.$$ The plot below shows the accuracy of the approximation as function of $$y$$ for $$x=0$$ and $$x=1$$.

The plot below shows the error, defined as $$\left| |\Gamma|^2_{exact}-|\Gamma|^2_{approx.} \right|/|\Gamma|^2_{exact}$$. For $$x=1/2$$ the formula is exact; the error as function of $$y$$ seems to be identical for $$x=0$$ and $$x=1$$. The error here is plotted for $$x=0.1$$, $$x=0.6$$ and $$x=1$$.

For $$x=1$$, the error is lesser than $$1\times 10^{-5}$$ ($$0.001 \%$$) for $$y>2$$, agreeing with the original claim on the approximation. For smaller $$x$$ the error is larger. Suggestions regarding the estimation of the error analytically will be appreciated.

• Thank you @rafa11111 ! This is exactly what I was looking for! Next step would be just as you suggest regarding the error estimation. – Steven Graham Dec 5 '18 at 15:29
• Out of curiosity, say $\left| |\Gamma|^2_{exact}-|\Gamma|^2_{approx.} \right|/|\Gamma|^2_{exact}$ could be estimated analytically, would this suffice as the error or do the error bounds for the Stirling approximation have to be accounted for too? I was thinking that if the partial derivative of the error w.r.t $y$ could be shown to be negative for all $y$ values above say $y = y_{0}$, then the error could just be calculate for $y_{0}$ and then the error for all $y \gt y_{0}$ would be less than the calculated error. For $x$ I imagine the maximum error could just be found for $x \in (0, 1)$. – Steven Graham Dec 6 '18 at 2:30

I had a go at answering the approximation part of my own question, as an extension to @rafa11111's answer.

From the approximation (where $$z=x +iy$$):

$$\left| \Gamma(z) \right|^{2} \approx \frac{\pi y^{2x-1}}{\cosh(\pi y)}$$

for $$0 \leq x \leq 1$$ and $$y>>1$$, define the error in the approximation as:

$$\delta = \left| \left| \Gamma(z) \right|^{2} - \frac{\pi y^{2x-1}}{\cosh(\pi y)} \right| \cdot \frac{1}{\left| \Gamma(z) \right|^{2}}$$

First to find the maximum error w.r.t $$x$$:

$$\frac{\partial \delta}{\partial x} = sgn(\delta)\frac{\left[ 2 \ln(y) \pi y^{2x-1} \left| \Gamma(z) \right|^{2} \cosh(\pi y) - 2 \pi y^{2x-1} \left| \Gamma(z) \right| \frac{\partial \left| \Gamma(z) \right|}{\partial x} \cosh(\pi y)\right]}{\left| \Gamma(z) \right|^{4} \cosh^{2}(\pi y)}$$ $$= \frac{\pi y^{2x-1}}{\left| \Gamma(z) \right|^{2} \cosh(\pi y )}\left[ 2\ln(y) -2\frac{\Re(\Gamma(z) \overline{\Gamma'(z)})}{\left| \Gamma(z) \right|} \right]$$ $$= \frac{\pi y^{2x-1}}{\left| \Gamma(z) \right|^{2} \cosh(\pi y )}\left[ 2\ln(y) -2 \Re(\psi(z)) \right]$$

where $$sgn$$ is the Sign Function (which is $$=+1$$ here) and $$\psi(z)$$ is the Digamma Function. For the derivative of the modulus of a complex function I looked here. Next equate with zero to find the maximum which occurs when:

$$\Re(\psi(z)) = \ln(y)$$

which can be numerically calculated and returns $$x \approx 0.7885$$.

Second is to find the derivative of the error w.r.t $$y$$:

$$\frac{\partial \delta}{\partial y} = sgn(\delta)\frac{\left[ (2x-1) \pi y^{2x-2} \left| \Gamma(z) \right|^{2} \cosh(\pi y) - \frac{\partial}{\partial y}\left( \pi y^{2x-1} \left| \Gamma(z) \right|^{2} \cosh(\pi y) \right)\right]}{\left| \Gamma(z) \right|^{4} \cosh^{2}(\pi y)}$$ $$= \frac{\pi y^{2x-1}}{\left| \Gamma(z) \right|^{2} \cosh(\pi y )}\left[ \frac{2x-1}{y} -2\frac{\Re(-i \Gamma(z) \overline{\Gamma'(z)})}{\left| \Gamma(z) \right|} - \pi \tanh(\pi y) \right]$$ $$= \frac{\pi y^{2x-1}}{\left| \Gamma(z) \right|^{2} \cosh(\pi y )}\left[ \frac{2x-1}{y} -2 \Im(\psi(z)) -\pi \tanh(\pi y) \right]$$

For this to be negative we need:

$$\frac{2x-1}{y} \lt 2 \Im(\psi(z)) + \pi \tanh(\pi y)$$ $$y \gt \frac{2x-1}{2 \Im(\psi(z)) + \pi \tanh(\pi y)}$$

which for $$y \gt \gt 1$$ approximates further to:

$$y \gt \frac{2x-1}{2 \Im(\psi(z)) + \pi }$$

Of which $$\Im(\psi(z))$$ has the same sign as $$y$$ and so, for $$y \gt \gt 1$$ , the RHS is either small (compared to $$y$$) and positive for $$0.5 \gt x \geq 1$$, zero for $$x=0.5$$, or negative for $$0 \geq x \gt 0.5$$. Therefore:

$$\frac{\partial \delta}{\partial y} \lt 0$$

for $$y \gt \gt 1$$.

So, if we take $$x = 0.7885$$ and $$y=2$$ we get $$\delta = 0.0042$$ which could be taken as the upper bound of the error for which the approximations hold. Then as $$y \rightarrow \infty$$, $$\delta \rightarrow 0$$ and the approximation becomes more accurate.

NB: I am a little unsure on the partial derivative of $$\Gamma(z)$$ w.r.t $$x$$ or $$y$$. I reasoned that as:

$$\frac{d \Gamma(z) }{dz} = \int_{0}^{\infty} t^{z-1} \ln(t) e^{-t} dt = \Gamma'(z)$$

then

$$\frac{\partial \Gamma(z) }{\partial x} = \int_{0}^{\infty} t^{z-1} \ln(t) e^{-t} dt = \Gamma'(z)$$

and

$$\frac{\partial \Gamma(z)}{\partial y} = i \int_{0}^{\infty} t^{z-1} \ln(t) e^{-t} dt = i\Gamma'(z)$$

• I think that complex derivatives are a bit trickier, but I can't tell if you did alright; the remaining of the analysis seems to be alright! Yesterday I tried to use the error estimation of Stirling's approximation alongside with the errors introduced at each approximation in my derivation, but I'm not used with big-O notation and I gave up. It may be useful to know, however, that $$\Gamma(z) = \sqrt{\frac{2\pi}{z}} \left(\frac{z}{e}\right)^z \left(1+O\left(\frac{1}{z}\right) \right)$$ – rafa11111 Dec 6 '18 at 11:45
• I am not sure either. If anybody is able to check my maths and either confirm its accuracy, or correct it if it is wrong, then that would be greatly appreciated! In terms of the errors, I think your original error estimation is all that is needed as it compares the approximation to the original Gamma Function. I think the error in the Stirling Approximation would only have to be incorporated if the new approximation were compared to the Stirling Approximation instead of the Gamma Function. – Steven Graham Dec 6 '18 at 12:14
• The one thing that concerns me about my derivation is the value of the derivatives for when $x = 0.5$. Since the error reduces to zero at $x = 0.5$, then surely the derivatives should be zero also. For this to be true then it would need to be confirmed that $\Re(\psi(1/2 + iy)) = 2 \ln(y)$ for the $x$ derivative, and $2 \Im(\psi(1/2 + iy)) = \pi \tanh(\pi y)$ for the $y$ derivative. If this isn't true, then it may suggest I made an error somewhere. – Steven Graham Dec 6 '18 at 12:23