{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Proof\n\nWe sort the derangements by the image of the last point and count each class by a bijection.\n\n1. Conjugating by a bijection between two sets with $m$ elements matches their [[derangements|0TH61JR04G]]. So by the [[bijection principle|0GV2573FP4]], $D_m$ depends only on $m$.\n2. Let $n$ be a natural number, let $X = \\set{1, \\dots, n + 2}$, let $z = n + 2$, and let $Y = X \\setminus \\set{z}$. So $|Y| = n + 1$.\n3. Let $\\sigma$ be a derangement of $X$. Then $\\sigma(z) \\ne z$, so $\\sigma(z) \\in Y$.\n4. Fix $i \\in Y$. Let $E_i$ be the set of derangements $\\sigma$ of $X$ with $\\sigma(z) = i$. Split $E_i$ into $E_i'$, where $\\sigma(i) = z$, and $E_i''$, where $\\sigma(i) \\ne z$.\n5. Count $E_i'$. Let $Z = X \\setminus \\set{i, z}$, a set with $n$ elements. For $\\sigma \\in E_i'$, $\\sigma$ maps $\\set{i, z}$ onto itself, so its restriction to $Z$ is a [[permutation|0BQMWCNS8S]] of $Z$.\n6. This restriction has no fixed point, since $\\sigma$ has none. Conversely, a derangement of $Z$ extended by $i \\mapsto z$ and $z \\mapsto i$ lies in $E_i'$.\n7. These two maps are inverse to each other. So $|E_i'| = D_n$.\n8. Count $E_i''$. For $\\sigma \\in E_i''$, let $j = \\sigma^{-1}(z)$. Then $j \\ne z$ because $\\sigma(z) = i \\ne z$, and $j \\ne i$ because $\\sigma(i) \\ne z$.\n9. Define $\\tau : Y \\to Y$ by $\\tau(j) = i$ and $\\tau(x) = \\sigma(x)$ for $x \\in Y \\setminus \\set{j}$. These values lie in $Y$, since only $j$ is sent to $z$ by $\\sigma$.\n10. The map $\\tau$ is a bijection of $Y$. Indeed, $\\sigma$ maps $Y \\setminus \\set{j}$ onto $X \\setminus \\set{z, i}$, since $\\sigma(j) = z$ and $\\sigma(z) = i$. Adding $\\tau(j) = i$ gives all of $Y$.\n11. The map $\\tau$ has no fixed point. For $x \\ne j$, $\\tau(x) = \\sigma(x) \\ne x$. Also $\\tau(j) = i \\ne j$ by step 8.\n12. Conversely, let $\\tau$ be a derangement of $Y$, and let $j = \\tau^{-1}(i)$. Define $\\sigma$ on $X$ by $\\sigma(z) = i$, $\\sigma(j) = z$, and $\\sigma(x) = \\tau(x)$ for the other $x$.\n13. This $\\sigma$ is a permutation of $X$, because $\\tau$ maps $Y \\setminus \\set{j}$ onto $Y \\setminus \\set{i}$, and $\\sigma$ adds $j \\mapsto z$ and $z \\mapsto i$. It has no fixed point: $\\sigma(z) = i \\ne z$, $\\sigma(j) = z \\ne j$, and $\\sigma(x) = \\tau(x) \\ne x$ otherwise.\n14. Moreover $\\sigma(i) \\ne z$. Otherwise $i = j$, so $\\tau(i) = i$, which is false for a derangement. Thus $\\sigma \\in E_i''$.\n15. The constructions of steps 9 and 12 are inverse to each other. Starting from $\\sigma$, we get $\\tau(j) = i$, so step 12 recovers the same $j$ and then $\\sigma$. Starting from $\\tau$, we get $\\sigma^{-1}(z) = j$, so step 9 recovers $\\tau$. Hence $|E_i''| = D_{n+1}$.\n16. By the [[rule of sum|0EE2V3CHFK]], $|E_i| = |E_i'| + |E_i''| = D_n + D_{n+1}$.\n17. By step 3, the derangements of $X$ are the disjoint union of the sets $E_i$ for the $n + 1$ elements $i \\in Y$.\n18. By the rule of sum, $D_{n+2} = (n + 1)(D_{n+1} + D_n)$.\n\n## Idea\n\nLook at where the last point $z$ goes, say to $i$. If $\\sigma$ also sends $i$ back to $z$, removing the swap leaves a derangement of $n$ points. Otherwise, short-circuiting $z$ out of $\\sigma$ leaves a derangement of $n + 1$ points.\n",
  "commit": "4a3290d299c8b2cd6493fce2296920ba7f82d942",
  "front": {
    "kind": "proof",
    "msc": [
      "05A05"
    ],
    "name": "Proof of the recurrence for derangements by the image of the last point",
    "proves": "0QRRYXG7V7",
    "sources": [
      {
        "locator": "Counting derangements",
        "url": "https://en.wikipedia.org/wiki/Derangement"
      }
    ],
    "tag": "G1ST9Y1DEP",
    "uses": [
      "0TH61JR04G",
      "0BQMWCNS8S",
      "0EE2V3CHFK",
      "0GV2573FP4"
    ]
  },
  "kind": "proof",
  "link": "https://math2.tamnd.com/node/G1ST9Y1DEP/",
  "links": [
    {
      "field": "proves",
      "target": "0QRRYXG7V7"
    },
    {
      "field": "uses",
      "target": "0TH61JR04G"
    },
    {
      "field": "uses",
      "target": "0BQMWCNS8S"
    },
    {
      "field": "uses",
      "target": "0EE2V3CHFK"
    },
    {
      "field": "uses",
      "target": "0GV2573FP4"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/G1ST9Y1DEP.md",
  "msc": [
    "05A05"
  ],
  "name": "Proof of the recurrence for derangements by the image of the last point",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/G1S/G1ST9Y1DEP.md",
  "status": null,
  "tag": "G1ST9Y1DEP",
  "uri": "m2://G1ST9Y1DEP",
  "url": "https://math2.tamnd.com/wiki/proof-of-the-recurrence-for-derangements-by-the-image-of-the-last-point/",
  "writing": {
    "tag": "G1ST9Y1DEP",
    "kind": "proof",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      }
    ]
  }
}
