{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Statement\n\nLet $n$ be a natural number, and let $D_m$ be the number of [[derangements|0TH61JR04G]] of an $m$-element set.\nThen\n$$D_{n+2} = (n + 1)\\,(D_{n+1} + D_n).$$\n\n## Remarks\n\nTogether with $D_0 = 1$ and $D_1 = 0$, the recurrence gives all values: $1, 0, 1, 2, 9, 44, 265, \\dots$\nA proof looks at a derangement $\\sigma$ of $\\{1, \\dots, n + 2\\}$ and the value $i = \\sigma(n+2)$. There are $n + 1$ choices of $i$. The case $\\sigma(i) = n + 2$ gives $D_n$ derangements, and the other case gives $D_{n+1}$.\nAnother recurrence is $D_{n+1} = (n + 1) D_n + (-1)^{n+1}$.\n\n## Explanations\n\n### L1 human\n\nLook at where the last element goes, say to position $i$.\nEither $i$ goes back to the last position, and the other $n$ elements form a derangement. Or it does not, and this acts like a derangement of $n + 1$ elements.\n",
  "commit": "6ac761d40018146541484a9e8b9eafd6ecc303dc",
  "front": {
    "kind": "statement",
    "msc": [
      "05A05"
    ],
    "name": "Recurrence for derangements",
    "role": "theorem",
    "sources": [
      {
        "locator": "Counting derangements",
        "url": "https://en.wikipedia.org/wiki/Derangement"
      }
    ],
    "tag": "0QRRYXG7V7",
    "uses": [
      "0TH61JR04G",
      "03WY4HHMT1"
    ]
  },
  "kind": "statement",
  "link": "https://math2.tamnd.com/node/0QRRYXG7V7/",
  "links": [
    {
      "field": "uses",
      "target": "0TH61JR04G"
    },
    {
      "field": "uses",
      "target": "03WY4HHMT1"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/0QRRYXG7V7.md",
  "msc": [
    "05A05"
  ],
  "name": "Recurrence for derangements",
  "prov": null,
  "role": "theorem",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/0QR/0QRRYXG7V7.md",
  "status": null,
  "tag": "0QRRYXG7V7",
  "uri": "m2://0QRRYXG7V7",
  "url": "https://math2.tamnd.com/wiki/recurrence-for-derangements/",
  "writing": {
    "tag": "0QRRYXG7V7",
    "kind": "statement",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      }
    ]
  }
}
