{
  "aliases": [
    "stirling-approximation"
  ],
  "backlinks": null,
  "body": "\n## Statement\n\nAs $n \\to \\infty$,\n$$n! \\sim \\sqrt{2 \\pi n} \\left( \\frac{n}{e} \\right)^n.$$\nThat is, the ratio $\\frac{n!}{\\sqrt{2 \\pi n} \\, (n/e)^n}$ tends to $1$.\n\n## Remarks\n\nThe relation $\\sim$ is [[asymptotic equivalence|00SB5EA3VW]]. The absolute error grows, but the relative error tends to $0$.\nComparing $\\ln n! = \\sum_{k \\le n} \\ln k$ with $\\int_1^n \\ln x \\, dx$ gives the form $n! \\sim C \\sqrt{n} (n/e)^n$. The [[Wallis product|0XCYA4YERS]] gives $C = \\sqrt{2\\pi}$.\nA sharper form is $n! = \\sqrt{2 \\pi n} (n/e)^n \\big(1 + \\frac{1}{12 n} + O(n^{-2})\\big)$. Mathlib states the limit as `Stirling.tendsto_stirlingSeq_sqrt_pi`.\n\n## History\n\nAbraham de Moivre first stated a less precise form of the result.\nIn 1730, James Stirling showed that the constant is $\\sqrt{2\\pi}$.\n\n## Explanations\n\n### L1 human\n\nStirling's formula gives the size of $n!$ for large $n$.\nFor example, it gives $10! \\approx 3.599 \\times 10^6$, while $10! = 3628800$.\n",
  "commit": "f591989ed15704e9d8755a7a5a6426d73de7a3ae",
  "front": {
    "aliases": [
      "stirling-approximation"
    ],
    "kind": "statement",
    "msc": [
      "41A60",
      "05A10"
    ],
    "name": "Stirling's formula",
    "role": "theorem",
    "same_as": {
      "wikidata": "Q470877",
      "wikipedia": "Stirling's approximation"
    },
    "sources": [
      {
        "locator": "Derivation",
        "url": "https://en.wikipedia.org/wiki/Stirling%27s_approximation"
      }
    ],
    "tag": "0KC0F51T6A",
    "uses": [
      "00SB5EA3VW",
      "0MVCFMW7S4",
      "0C1VYVNV2N",
      "0XCYA4YERS"
    ]
  },
  "kind": "statement",
  "link": "https://math2.tamnd.com/node/0KC0F51T6A/",
  "links": [
    {
      "field": "uses",
      "target": "00SB5EA3VW"
    },
    {
      "field": "uses",
      "target": "0MVCFMW7S4"
    },
    {
      "field": "uses",
      "target": "0C1VYVNV2N"
    },
    {
      "field": "uses",
      "target": "0XCYA4YERS"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/0KC0F51T6A.md",
  "msc": [
    "41A60",
    "05A10"
  ],
  "name": "Stirling's formula",
  "prov": null,
  "role": "theorem",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/0KC/0KC0F51T6A.md",
  "status": null,
  "tag": "0KC0F51T6A",
  "uri": "m2://0KC0F51T6A",
  "url": "https://math2.tamnd.com/wiki/stirlings-formula/",
  "writing": {
    "tag": "0KC0F51T6A",
    "kind": "statement",
    "level": "W1",
    "next": [
      {
        "what": "edge about out",
        "note": "the concepts that the statement is about",
        "have": 0,
        "want": 1
      },
      {
        "what": "edge proves in",
        "note": "at least one proof node",
        "have": 0,
        "want": 1
      },
      {
        "what": "edge instance_of or illustrates in",
        "note": "one example that shows the statement at work",
        "have": 0,
        "want": 1
      },
      {
        "what": "explanation L2",
        "have": 0,
        "want": 1
      }
    ]
  }
}
