{
  "aliases": [
    "coupon-collector-problem"
  ],
  "backlinks": null,
  "body": "\n## Problem\n\nThere are $n \\ge 1$ different types of coupons. Each draw gives a coupon of a uniform random type, independently of the other draws.\nLet $T$ be the number of draws needed to collect all $n$ types. Find $E[T]$.\n\n## Remarks\n\nSolution: write $T = t_1 + \\dots + t_n$, where $t_i$ is the number of draws to get a new type when $i - 1$ types are known.\nEach $t_i$ counts trials up to the first success, with success probability $p_i = (n - i + 1)/n$. So $E[t_i] = 1/p_i$ by the [[mean of the geometric distribution|0DB0R4N5XX]].\nBy [[linearity of expectation|0P7PTC8DDE]], $E[T] = n \\left(\\frac{1}{1} + \\frac{1}{2} + \\dots + \\frac{1}{n}\\right) = n H_n$, where $H_n$ is the $n$-th harmonic number. So $E[T] = n \\ln n + \\gamma n + \\frac{1}{2} + o(1)$, with the Euler–Mascheroni constant $\\gamma \\approx 0.5772$.\nThe $t_i$ are independent, so $\\operatorname{Var}(T) = \\sum_i (1 - p_i)/p_i^2 \u003c \\pi^2 n^2 / 6$.\n\n## Explanations\n\n### L1 human\n\nTo collect all $n$ pictures of a series, you need about $n \\ln n$ purchases, not $n$.\nThe last pictures are the slow ones: when only one type is missing, you wait on average $n$ draws for it. For $n = 50$, $E[T] = 50 H_{50} \\approx 225$.\n",
  "commit": "6ac761d40018146541484a9e8b9eafd6ecc303dc",
  "front": {
    "aliases": [
      "coupon-collector-problem"
    ],
    "kind": "problem",
    "msc": [
      "60C05"
    ],
    "name": "Coupon collector's problem",
    "same_as": {
      "wikidata": "Q1148012",
      "wikipedia": "Coupon collector's problem"
    },
    "sources": [
      {
        "locator": "Calculating the expectation",
        "url": "https://en.wikipedia.org/wiki/Coupon_collector's_problem"
      },
      {
        "locator": "Calculating the variance",
        "url": "https://en.wikipedia.org/wiki/Coupon_collector's_problem"
      }
    ],
    "tag": "0MXCP7MXWJ",
    "uses": [
      "0XCVV5Q500",
      "0P7PTC8DDE",
      "0DB0R4N5XX",
      "0V0778DCW9"
    ]
  },
  "kind": "problem",
  "link": "https://math2.tamnd.com/node/0MXCP7MXWJ/",
  "links": [
    {
      "field": "uses",
      "target": "0XCVV5Q500"
    },
    {
      "field": "uses",
      "target": "0P7PTC8DDE"
    },
    {
      "field": "uses",
      "target": "0DB0R4N5XX"
    },
    {
      "field": "uses",
      "target": "0V0778DCW9"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/0MXCP7MXWJ.md",
  "msc": [
    "60C05"
  ],
  "name": "Coupon collector's problem",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/0MX/0MXCP7MXWJ.md",
  "status": null,
  "tag": "0MXCP7MXWJ",
  "uri": "m2://0MXCP7MXWJ",
  "url": "https://math2.tamnd.com/wiki/coupon-collectors-problem/",
  "writing": {
    "tag": "0MXCP7MXWJ",
    "kind": "problem",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      }
    ]
  }
}
