section_path: Role and characterizations in mathematics/The gamma function and Stirling's approximation
section_name: The gamma function and Stirling's approximation
paragraph_text: The gamma function and Stirling's approximation
  
  The factorial function n ! {\displaystyle n!} is the product of all of the positive integers through n. The gamma function extends the concept of factorial (normally defined only for non-negative integers) to all complex numbers, except the negative real integers, with the identity Γ (n) = (n − 1) ! {\displaystyle \Gamma (n)=(n-1)!}. When the gamma function is evaluated at half-integers, the result contains π. For example, Γ (1 / 2) = π {\displaystyle \Gamma (1/2)={\sqrt {\pi }}} and Γ (5 / 2) = 3 π 4 {\textstyle \Gamma (5/2)={\frac {3{\sqrt {\pi }}}{4}}}.
  
  The gamma function is defined by its Weierstrass product development: Γ (z) = e − γ z z ∏ n = 1 ∞ e z / n 1 + z / n {\displaystyle \Gamma (z)={\frac {e^{-\gamma z}}{z}}\prod _{n=1}^{\infty }{\frac {e^{z/n}}{1+z/n}}} where γ is the Euler–Mascheroni constant. Evaluated at z = 1/2 and squared, the equation Γ(1/2) = π reduces to the Wallis product formula. The gamma function is also connected to the Riemann zeta function and identities for the functional determinant, in which the constant π plays an important role.
  
  The gamma function is used to calculate the volume V (r) of the n -dimensional ball of radius r in Euclidean n -dimensional space, and the surface area S (r) of its boundary, the (n −1)-dimensional sphere: V n (r) = π n / 2 Γ (n 2 + 1) r n, {\displaystyle V_{n}(r)={\frac {\pi ^{n/2}}{\Gamma \left({\frac {n}{2}}+1\right)}}r^{n},} S n − 1 (r) = n π n / 2 Γ (n 2 + 1) r n − 1. {\displaystyle S_{n-1}(r)={\frac {n\pi ^{n/2}}{\Gamma \left({\frac {n}{2}}+1\right)}}r^{n-1}.}
  
  Further, it follows from the functional equation that 2 π r = S n + 1 (r) V n (r). {\displaystyle 2\pi r={\frac {S_{n+1}(r)}{V_{n}(r)}}.}
  
  The gamma function can be used to create a simple approximation to the factorial function n ! for large n: n ! ∼ 2 π n (n e) n {\textstyle n!\sim {\sqrt {2\pi n}}\left({\frac {n}{e}}\right)^{n}} which is known as Stirling's approximation. Equivalently, π = lim n → ∞ e 2 n n ! 2 2 n 2 n + 1. {\displaystyle \pi =\lim _{n\to \infty }{\frac {e^{2n}n!^{2}}{2n^{2n+1}}}.}
  
  As a geometrical application of Stirling's approximation, let Δ denote the standard simplex in n -dimensional Euclidean space, and (n + 1)Δ denote the simplex having all of its sides scaled up by a factor of n + 1. Then Vol ((n + 1) Δ n) = (n + 1) n n ! ∼ e n + 1 2 π n. {\displaystyle \operatorname {Vol} ((n+1)\Delta _{n})={\frac {(n+1)^{n}}{n!}}\sim {\frac {e^{n+1}}{\sqrt {2\pi n}}}.}
  
  Ehrhart's volume conjecture is that this is the (optimal) upper bound on the volume of a convex body containing only one lattice point.