{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Statement\n\nLet $\\Gamma$ be the [[gamma function|0V3FZMVB4K]], let $\\operatorname{Log}$ be the principal [[complex logarithm|02QGGD5G87]], and for $z \\in \\C \\setminus (-\\infty, 0]$ let $z^{z - 1/2} = e^{(z - 1/2)\\operatorname{Log} z}$.\nFix $\\delta$ with $0 \u003c \\delta \u003c \\pi$.\nThen, as $\\abs{z} \\to \\infty$ with $\\abs{\\arg z} \\le \\pi - \\delta$,\n$$\\Gamma(z) = \\sqrt{2\\pi}\\; z^{z - 1/2} \\, e^{-z} \\left(1 + O\\!\\left(\\frac{1}{\\abs{z}}\\right)\\right),$$\nwhere the constant in $O$ depends only on $\\delta$.\nIn particular $\\Gamma(z)$ is [[asymptotically equivalent|0QR92XBV6H]] to $\\sqrt{2\\pi}\\, z^{z - 1/2} e^{-z}$ in this sector.\n\n## Remarks\n\nThe proof starts from [[Binet's formula|AGBWPB994F]], which writes $\\operatorname{Log}\\Gamma(z) - (z - \\tfrac12)\\operatorname{Log} z + z - \\tfrac12\\ln(2\\pi)$ as an integral that is $O(1/\\abs{z})$ for $\\operatorname{Re} z \u003e 0$; rotating the line of integration extends this bound to the whole sector.\nAnother route is Laplace's method applied to Euler's integral $\\Gamma(x + 1) = \\int_0^\\infty e^{x \\ln t - t}\\,dt$, whose integrand peaks at $t = x$.\nFor real $x \\to \\infty$ it gives $\\Gamma(x + 1) \\sim \\sqrt{2\\pi x}\\,(x/e)^x$; at integers this is [[Stirling's formula|0KC0F51T6A]] for $n!$.\nThe sector condition is needed: on the negative real axis $\\Gamma$ has poles, so no such estimate holds near it.\nThe full asymptotic series for $\\operatorname{Log}\\Gamma(z)$ is [[Stirling's series|K29QYWB6A5]].\n\n## Explanations\n\n### L1 human\n\nStirling's formula tells how big $\\Gamma(z)$ is when $z$ is large.\nIt extends the classical estimate $n! \\approx \\sqrt{2\\pi n}\\,(n/e)^n$ from whole numbers to real and complex arguments.\n\n### L2 human\n\nThe complex form gives the decay of $\\Gamma$ on vertical lines: for fixed real $x$, $\\abs{\\Gamma(x + iy)} \\sim \\sqrt{2\\pi}\\,\\abs{y}^{x - 1/2} e^{-\\pi\\abs{y}/2}$ as $\\abs{y} \\to \\infty$.\nThis decay is what makes Mellin–Barnes integrals and the inverse Mellin transform converge, and it is used to estimate the Riemann zeta function through its functional equation.\nDividing two instances gives $\\Gamma(x + a)/\\Gamma(x) \\sim x^a$ as $x \\to \\infty$.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "about": [
      "0H5SYBSED9"
    ],
    "kind": "statement",
    "msc": [
      "33B15",
      "41A60"
    ],
    "name": "Stirling's formula for the gamma function",
    "role": "theorem",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Stirling%27s_approximation"
      }
    ],
    "tag": "53750WSJ6K",
    "uses": [
      "0V3FZMVB4K",
      "02QGGD5G87",
      "0QR92XBV6H"
    ]
  },
  "kind": "statement",
  "link": "https://tamnd.github.io/math2/node/53750WSJ6K/",
  "links": [
    {
      "field": "about",
      "target": "0H5SYBSED9"
    },
    {
      "field": "uses",
      "target": "0V3FZMVB4K"
    },
    {
      "field": "uses",
      "target": "02QGGD5G87"
    },
    {
      "field": "uses",
      "target": "0QR92XBV6H"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/53750WSJ6K.md",
  "msc": [
    "33B15",
    "41A60"
  ],
  "name": "Stirling's formula for the gamma function",
  "prov": null,
  "role": "theorem",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/537/53750WSJ6K.md",
  "status": null,
  "tag": "53750WSJ6K",
  "uri": "m2://53750WSJ6K",
  "url": "https://tamnd.github.io/math2/wiki/stirlings-formula-for-the-gamma-function/",
  "writing": {
    "tag": "53750WSJ6K",
    "kind": "statement",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      },
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
