{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Proof\n\nWe argue by induction on $n$.\n\n1. A [[tree|0MJ0JS72DZ]] is [[connected|0FFAYNMAJZ]], so it has at least one vertex. Thus $n \\ge 1$.\n2. Base case $n = 1$. An edge is a $2$-element set of vertices, and a $1$-element vertex set has no such subset. So $T$ has $0 = n - 1$ [[edges|0WNGQBPPQX]].\n3. Induction step. Let $n \\ge 2$, and assume that every tree with $n - 1$ vertices has $n - 2$ edges. Let $T$ have $n$ vertices.\n4. By the [[leaf lemma|0H8Q4MANBD]], $T$ has a vertex $\\ell$ of degree $1$. Let $\\ell a$ be its only edge.\n5. Let $T'$ be the graph $T$ with the vertex $\\ell$ and the edge $\\ell a$ removed. It has $n - 1$ vertices and one edge fewer than $T$.\n6. $T'$ is acyclic: it is a [[subgraph|0P11X5HKAX]] of $T$, so each cycle of $T'$ is a cycle of $T$, and $T$ is [[acyclic|0XNN9Z8E5A]].\n7. $T'$ has a vertex, namely $a$. Let $x, y$ be vertices of $T'$.\n8. Since $T$ is connected, it has a walk from $x$ to $y$. By [[every walk contains a path|09VZBHB33V]], $T$ has a [[path|0JDE56HWQ8]] $(p_0, \\dots, p_m)$ from $x$ to $y$.\n9. The vertex $\\ell$ is not $p_0 = x$ or $p_m = y$. If $\\ell = p_i$ with $0 \u003c i \u003c m$, then $p_{i-1}$ and $p_{i+1}$ are two distinct neighbours of $\\ell$, which contradicts $\\deg(\\ell) = 1$.\n10. So the path avoids $\\ell$, and hence also the edge $\\ell a$. It is a walk in $T'$ from $x$ to $y$. Thus $T'$ is connected.\n11. By steps 6 and 10, $T'$ is a tree with $n - 1$ vertices. By the induction hypothesis it has $n - 2$ edges.\n12. By step 5, $T$ has $(n - 2) + 1 = n - 1$ edges. This completes the induction.\n\n## Idea\n\nRemoving a leaf removes exactly one vertex and one edge, and what is left is still a tree. Repeating this shrinks the tree down to a single vertex with no edges.\n",
  "commit": "4a3290d299c8b2cd6493fce2296920ba7f82d942",
  "front": {
    "kind": "proof",
    "msc": [
      "05C05"
    ],
    "name": "Proof that a tree on n vertices has n − 1 edges, by removing a leaf",
    "proves": "0VSNHTHK8T",
    "sources": [
      {
        "url": "https://github.com/oscarlevin/discrete-book/blob/a8e4949bc45daf100930c1182983778f56ab689f/ptx/sec_gt-trees.ptx#L245"
      }
    ],
    "tag": "VSE60M6HHT",
    "uses": [
      "0MJ0JS72DZ",
      "0FFAYNMAJZ",
      "0XNN9Z8E5A",
      "0WNGQBPPQX",
      "0H8Q4MANBD",
      "09VZBHB33V",
      "0JDE56HWQ8",
      "0P11X5HKAX"
    ]
  },
  "kind": "proof",
  "link": "https://math2.tamnd.com/node/VSE60M6HHT/",
  "links": [
    {
      "field": "proves",
      "target": "0VSNHTHK8T"
    },
    {
      "field": "uses",
      "target": "0MJ0JS72DZ"
    },
    {
      "field": "uses",
      "target": "0FFAYNMAJZ"
    },
    {
      "field": "uses",
      "target": "0XNN9Z8E5A"
    },
    {
      "field": "uses",
      "target": "0WNGQBPPQX"
    },
    {
      "field": "uses",
      "target": "0H8Q4MANBD"
    },
    {
      "field": "uses",
      "target": "09VZBHB33V"
    },
    {
      "field": "uses",
      "target": "0JDE56HWQ8"
    },
    {
      "field": "uses",
      "target": "0P11X5HKAX"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/VSE60M6HHT.md",
  "msc": [
    "05C05"
  ],
  "name": "Proof that a tree on n vertices has n − 1 edges, by removing a leaf",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/VSE/VSE60M6HHT.md",
  "status": null,
  "tag": "VSE60M6HHT",
  "uri": "m2://VSE60M6HHT",
  "url": "https://math2.tamnd.com/wiki/proof-that-a-tree-on-n-vertices-has-n-1-edges-by-removing-a-leaf/",
  "writing": {
    "tag": "VSE60M6HHT",
    "kind": "proof",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      },
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
