{
  "tag": "CZWG27",
  "kind": "theorem",
  "slug": "stirling-approximation",
  "name": "Stirling's approximation",
  "aliases": [
    "Stirling's formula"
  ],
  "area": "foundations/asymptotic-analysis",
  "level": "core",
  "summary": "Gives n! asymptotically as sqrt(2 pi n) (n/e)^n, which yields the log n! = Theta(n log n) bound.",
  "prereqs": [
    "asymptotic-notation",
    "tilde-notation",
    "logarithms",
    "integral-bounds-for-sums"
  ],
  "sources": [
    {
      "url": "https://en.wikipedia.org/wiki/Stirling%27s_approximation",
      "locator": "sections History and Speed of convergence and error estimates"
    },
    {
      "book": "isbn:9780262046305",
      "title": "Cormen, Leiserson, Rivest and Stein, Introduction to Algorithms, fourth edition",
      "locator": "Section 3.3, Standard notations and common functions (factorials)"
    },
    {
      "book": "isbn:9780201896831",
      "title": "Donald E. Knuth, The Art of Computer Programming, Volume 1, third edition",
      "locator": "Section 1.2.11.2, Euler's summation formula (Stirling's approximation)"
    },
    {
      "book": "isbn:9780201558029",
      "title": "Graham, Knuth and Patashnik, Concrete Mathematics, second edition",
      "locator": "Chapter 9, Asymptotics (Stirling's approximation)"
    },
    {
      "book": "isbn:9780321573513",
      "title": "Robert Sedgewick and Kevin Wayne, Algorithms, fourth edition",
      "locator": "Section 1.4, Analysis of Algorithms (commonly encountered functions)"
    },
    {
      "paper": "Herbert Robbins, A remark on Stirling's formula, American Mathematical Monthly 62 (1955), pages 26 to 29",
      "locator": "the bounds 1/(12n+1) \u003c r_n \u003c 1/(12n)"
    }
  ],
  "see_also": [
    "comparison-sort-lower-bound",
    "merge-sort",
    "harmonic-series",
    "factorial",
    "binomial-coefficient-bounds",
    "common-growth-rates"
  ],
  "url": "https://algorithm.tamnd.com/stirling-approximation/",
  "path": "nodes/foundations/asymptotic-analysis/stirling-approximation",
  "status": {
    "slug": "stirling-approximation",
    "h": {
      "level": 1,
      "max": 3,
      "label": "H1",
      "name": "sketch",
      "next": [
        "a full proof of correctness"
      ]
    },
    "l": {
      "level": 0,
      "max": 4,
      "label": "L0",
      "name": "no Lean part",
      "next": [
        "name a Lean module in the lean field (07)"
      ]
    },
    "i": {},
    "v": {
      "level": 0,
      "max": 3,
      "label": "V0",
      "name": "none",
      "next": [
        "add viz/scene.ts or a figure (10)"
      ]
    },
    "w": {
      "level": 4,
      "max": 5,
      "label": "W4",
      "name": "complete",
      "next": [
        "a review of the text: no review record reviews/CZWG27/text.yaml"
      ]
    }
  },
  "proofs": [
    "stirling-formula"
  ],
  "scene": false
}
