# Real and imaginary part of Gamma function

Is there a way to separate the real and imgainary part of the gamma function

$$\Gamma (a+ib)$$

I thought of using the formula

$$\zeta(z) \Gamma(z) = \int^{\infty}_0\frac{t^{z-1}}{e^t-1}\, dt$$

then use the series of zeta function to extract the real and imaginary part .But the thing is that integral representation only work out for $\Re(z)>1$ . Actually I am working on something like

$$\lim_{s \to 0}\, \Gamma \left(\frac{1+s}{2}+ a i \right)$$

Mainly values of Gamma function that are on or very close to the critical line $\Re(z) = \frac{1}{2}$

Any better ideas ?

• Have you considered using the usual integral representation of the gamma function and Euler's formula? – Antonio Vargas Jul 30 '13 at 1:31
• What about $$\Gamma(z)\Gamma(1-z)=\frac{\pi}{\sin(\pi z)}\implies\Gamma({1\over 2}+it)\Gamma({1 \over 2}-it)=\frac{\pi}{\cosh(\pi t)}$$ – Kunnysan Jul 30 '13 at 6:17
• @kunnysan I already thought of that , but how that helps us ? – Zaid Alyafeai Jul 30 '13 at 8:55
• @ZaidAlyafeai: well kunnysan's answer gave you at least $$\left|\Gamma\left(\frac 12+it\right)\right|=\sqrt{\frac{\pi}{\cosh(\pi t)}}$$ Note that another argument is well known and rather more useful to study $\zeta$ in the critical strip : the Riemann-Siegel theta function (this return minus the argument of $\zeta$ in the critical strip). – Raymond Manzoni Jul 30 '13 at 10:01
• I think this is due to $\Gamma (\bar {z}) = \overline {\Gamma (z)}$ – Zaid Alyafeai Jul 30 '13 at 10:08

Updated
Here we will study $\Gamma$ directly since its behavior is much more regular than $\zeta$ in the critical strip.

Since $\;\overline{\Gamma (z)}=\Gamma (\overline{z})\;$ a first idea is to use any formula for $\;\Gamma(z)\,$ and transform it with : $$\Re\;\Gamma(z)=\frac{\Gamma(z)+\Gamma(\overline{z})}2,\quad\Im\;\Gamma(z)=\frac{\Gamma(z)-\Gamma(\overline{z})}{2\,i}$$

Let's apply this to some integral formulae like the definition $\;\displaystyle\Gamma(z):=\int_0^\infty e^{-t}\,t^{z-1}\,dt$ :

\begin{align} \Re\;\Gamma(x+iy)&=\int_0^\infty e^{-t}\,\frac{t^{x+iy-1}+t^{x-iy-1}}2\,dt\\ &=\int_0^\infty e^{-t}\,t^{x-1}\,\frac{e^{iy\ln(t)}+e^{-iy\ln(t)}}2\,dt\\ &\tag{1}=\int_0^\infty e^{-t}\,t^{x-1}\,\cos(y\;\ln\,t)\;dt\\ \\\\ \Im\;\Gamma(x+iy)&=\int_0^\infty e^{-t}\,\frac{t^{x+iy-1}-t^{x-iy-1}}{2\,i}\,dt\\ \tag{2}&=\int_0^\infty e^{-t}\,t^{x-1}\,\sin(y\;\ln\,t)\;dt\\ \end{align}

The variant $\;\displaystyle\Gamma(z)=2\int_0^\infty e^{-t^2}\,t^{2z-1}\,dt\;$ returned :

\begin{align} \tag{3}\Re\;\Gamma(x+iy)&=2\int_0^\infty e^{-t^2}\,t^{2x-1}\,\cos(2\,y\;\ln\,t)\;dt\\ \tag{4}\Im\;\Gamma(x+iy)&=2\int_0^\infty e^{-t^2}\,t^{2x-1}\,\sin(2\,y\;\ln\,t)\;dt\\ \end{align} with faster convergence and the power of $t$ disappearing for $x=\frac 12$.

While the finite integral $\Gamma(z)=\int_0^1 (-\ln\,t)^{z-1}\,dt\;$ gives : \begin{align} \tag{5}\Re\;\Gamma(x+iy)&=\int_0^1 (-\ln\,t)^{x-1}\,\cos(y\;\ln(-\ln(t)))\;dt\\ \tag{6}\Im\;\Gamma(x+iy)&=\int_0^1 (-\ln\,t)^{x-1}\,\sin(y\;\ln(-\ln(t)))\;dt\\ \end{align}

We could try the same idea with infinite series and products from Abramowitz and Stegun but let's experiment another idea.

We may use $\;\displaystyle\Gamma(z)=|\Gamma(z)|\;e^{i\arg \Gamma(z)}\;$ to get : \begin{align} \Re\;\Gamma(z)&=\left|\Gamma(z)\right|\;\cos(\arg\;\Gamma(z))\\ \Im\;\Gamma(z)&=\left|\Gamma(z)\right|\;\sin(\arg\;\Gamma(z))\\ \end{align}

Let's obtain some moduli (absolute values) first :

As proposed by Kunnysan we may consider $\;\displaystyle\Gamma(z)\,\Gamma(1-z)=\frac{\pi}{\sin(\pi z)}\,$ applied to $z=\frac 12+iy\;$ and conclude using $\;\Gamma(\overline{z})=\overline{\Gamma (z)}\;$ that : $$\tag{7}\left|\Gamma\left(\frac 12+iy\right)\right|=\sqrt{\frac{\pi}{\cosh(\pi\,y)}}$$ A more general formula from Mathias Lerch (but without explicit $\lambda(y)$) is for $0\le x\le 1$ : $$\left|\Gamma\left(x+iy\right)\right|=\lambda(y)\frac{\Gamma(1+x)}{\sqrt{x^2+y^2}}\sqrt{\frac{\pi\;y}{\sin(\pi\,y)}}\quad\text{with}\ \ 1\le\lambda(y)\le\sqrt{1+y^2}$$ From A&S $6.1.25$ we have too : $$\tag{8}\left|\Gamma\left(x+iy\right)\right|=\frac {\left|\Gamma(x)\right|}{\sqrt{\prod\limits_{n=0}^\infty 1+\frac {y^2}{(x+n)^2}}}$$

For numerical evaluation Stirling approximation may be useful :

$$\tag{9}\left|\Gamma\left(x+iy\right)\right|=\sqrt{2\pi}\,e^{-\pi|y|/2}\,|y|^{x-1/2}[1+r(x,y)]$$ with $|r(x,y)|\to 0$ uniformly for $x<K$ as $|y|\to\infty$.
(the error is around $1$% for $y=1$ and quickly decreasing with $y$ ; we will derive a similar but more precise formula in a moment)

While the argument of $\;\Gamma(x+iy)$ is given by A&S $6.1.27$ (if $\;x+iy\neq 0,-1,-2,\cdots$) : $$\tag{10}\arg\;\Gamma(x+iy)=y\;\psi(x)+\sum_{n=0}^\infty\left[\frac y{x+n}-\arctan\frac y{x+n}\right]$$ with $\psi(x)=\dfrac{\Gamma'(x)}{\Gamma(x)}$ the psi or digamma function.

Observing that the argument is simply the imaginary part of $\,\ln\;\Gamma(z)\,$ we may use the asymptotic expansion $\ 6,1,40\,$ as $z\to\infty\,$ valid for $\,|\arg\;z|<\pi\,$ and with $B_n$ the Bernoulli numbers : \begin{align} \arg\,\Gamma(z)&\sim \Im\left[\left(z-\frac 12\right)\ln(z)-z+\frac 12\ln(2\pi)+\sum\limits_{m=1}^\infty \frac{B_{2m}}{2m\,(2m-1)}z^{1-2m}\right]\quad(11)\\ &\sim \Im\left(z-\frac 12\right)\Re\;\ln(z)+\Re\left(z-\frac 12\right)\Im\;\ln(z)-\Im\;z+\sum\limits_{m=1}^\infty \frac{B_{2m}}{2m\,(2m-1)}\Im\;{z^{1-2m}}\\ &\sim \frac{y\;\ln\bigl(x^2+y^2\bigr)}2+\left(x-\frac 12\right)\arg(x+iy)-y-\frac 1{12}\frac y{x^2+y^2}+\frac 1{360}\frac{3x^2y-y^3}{(x^2+y^2)^3}+\cdots\\ \end{align} (for $\,\Re(x)>0$ you may replace $\,\arg(x+iy)\,$ by $\,\arctan\dfrac yx\,$ ; see arg for other quadrants)

The corresponding modulus is given by : \begin{align} |\Gamma(z)|&\sim \exp\;\Re\left[\left(z-\frac 12\right)\ln(z)-z+\frac 12\ln(2\pi)+\sum\limits_{m=1}^\infty \frac{B_{2m}\;z^{1-2m}}{2m\,(2m-1)}\right]\\ &\sim \sqrt{2\pi}\,\exp\left[\Re\left(z-\frac 12\right)\Re\;\ln(z)-\Im\left(z-\frac 12\right)\Im\;\ln(z)-\Re\;z+\sum\limits_{m=1}^\infty \frac{B_{2m}\;\Re\;{z^{1-2m}}}{2m\,(2m-1)}\right]\\ &\sim \sqrt{2\pi}\,\exp\left[\frac{\left(x-\frac 12\right)\;\ln\bigl(x^2+y^2\bigr)}2-y\;\arg(x+iy)-x+\sum\limits_{m=1}^\infty \frac{B_{2m}\;\Re\;{z^{1-2m}}}{2m\,(2m-1)}\right]\\ &\sim \sqrt{2\pi}\,\bigl(x^2+y^2\bigr)^{\frac x2-\frac 14}\exp\left[-x-y\,\arg(x+iy)+\frac 1{12}\frac x{x^2+y^2}-\frac 1{360}\frac{x^3-3xy^2}{(x^2+y^2)^3}+\cdots\right]\\ \end{align}

Combining these two formulas should provide accurate real and imaginary parts except near the negative axis.

Let's add that approximations for the $\Gamma$ function is a rather well studied subject and that the Lanczos approximation for example was often used in the critical strip.

Some illustrations to conclude :

The real part of $\Gamma$

The imaginary part of $\Gamma$

The modulus of $\Gamma$ (note the regularity of the surface at the right of the pole at $0$)

• Crosslink: asymptotic formula for $r$ : $\ \displaystyle r(x,y)\sim \dfrac{2\,x^3-3\,x^2+x}{12\,y^2}+O\left(\frac 1{y^4}\right)$ – Raymond Manzoni Aug 5 '16 at 10:18
• I always link pictures (and pink + purple looks nice) – Simply Beautiful Art Nov 29 '16 at 0:46
• Thanks @Simple Art ! Nicer (and more recent) tools exist for 2D but I still enjoy the old Mupad (Mathlab's engine) for 3D. Excellent continuation, – Raymond Manzoni Nov 29 '16 at 22:37
• @Raymond Manzoni - Did you use Mathematica? What surface style did you use? It looks very beautiful. – dtn May 29 '20 at 9:29
• Thanks @dtn: In fact this is MuPad at work. More exactly an older version since it was later integrated in Mathlab (replacing Maple). Another example. Cheers, – Raymond Manzoni May 29 '20 at 9:41