{
  "aliases": [
    "gamblers-ruin-problem"
  ],
  "backlinks": null,
  "body": "\n## Problem\n\nA gambler starts with $k$ units of money, where $0 \\le k \\le N$ for an integer $N \\ge 1$. In each round, the gambler wins one unit with probability $p \\in (0, 1)$ and loses one unit with probability $q = 1 - p$. The rounds are independent.\nThe game stops when the fortune reaches $0$ (ruin) or $N$ (the target).\nFind the probability $P_k$ that the gambler reaches $N$ before $0$.\n\n## Remarks\n\nThe fortune is a [[random walk|0C08YMV95H]] on $\\{0, 1, \\dots, N\\}$ that stops at $0$ and $N$. By the [[law of total probability|0E5G5FMT2R]] for the first round, $P_k = p P_{k+1} + q P_{k-1}$ for $0 \u003c k \u003c N$, with $P_0 = 0$ and $P_N = 1$.\nFor a fair game, $p = q = 1/2$, the solution is $P_k = k/N$.\nFor $p \\ne q$, the solution is $P_k = \\dfrac{1 - (q/p)^k}{1 - (q/p)^N}$.\nIn a fair game against an opponent with unlimited money ($N \\to \\infty$), the gambler is ruined with probability $1$.\n\n## History\n\nAn early form of the problem appears in a letter of Blaise Pascal to Pierre de Fermat in 1656.\n\n## Explanations\n\n### L1 human\n\nA gambler who plays a fair game against a much richer opponent will almost surely lose everything in the end.\nWith $10$ units and a target of $100$ in a fair game, the chance to reach the target is only $10/100 = 0.1$.\n",
  "commit": "6ac761d40018146541484a9e8b9eafd6ecc303dc",
  "front": {
    "aliases": [
      "gamblers-ruin-problem"
    ],
    "kind": "problem",
    "msc": [
      "60G50",
      "60G40"
    ],
    "name": "Gambler's ruin",
    "same_as": {
      "wikidata": "Q660446",
      "wikipedia": "Gambler's ruin"
    },
    "sources": [
      {
        "locator": "Fair coin flipping",
        "url": "https://en.wikipedia.org/wiki/Gambler's_ruin"
      },
      {
        "locator": "Unfair coin flipping",
        "url": "https://en.wikipedia.org/wiki/Gambler's_ruin"
      }
    ],
    "tag": "0WFMKK7DFZ",
    "uses": [
      "0C08YMV95H",
      "0E5G5FMT2R"
    ]
  },
  "kind": "problem",
  "link": "https://math2.tamnd.com/node/0WFMKK7DFZ/",
  "links": [
    {
      "field": "uses",
      "target": "0C08YMV95H"
    },
    {
      "field": "uses",
      "target": "0E5G5FMT2R"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/0WFMKK7DFZ.md",
  "msc": [
    "60G50",
    "60G40"
  ],
  "name": "Gambler's ruin",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/0WF/0WFMKK7DFZ.md",
  "status": null,
  "tag": "0WFMKK7DFZ",
  "uri": "m2://0WFMKK7DFZ",
  "url": "https://math2.tamnd.com/wiki/gamblers-ruin/",
  "writing": {
    "tag": "0WFMKK7DFZ",
    "kind": "problem",
    "level": "W1",
    "next": [
      {
        "what": "edge bounds both",
        "have": 0,
        "want": 1
      }
    ]
  }
}
