Concept

How can induction prove that a perfect binary tree has one more leaf than internal node?

Stephen Davies, Ph.D. Version 2.2.2 Through Discrete Mathematics A Cool Brisk Walk / Chapter 1

"Let P(n) be the proposition that a perfect binary tree of height n has one more leaf than internal node. That is, if lₖ is the number of leaves in a tree of height k, and iₖ is the number of internal nodes in a tree of height k, let P(n) be the proposition that lₙ = iₙ + 1.\n\n1. base case. We prove that P(0) is true simply by inspection. If we have a tree of height 0, then it has only one node (the root). This sole node is a leaf, and is not an internal node. So this tree has 1 leaf, and 0 internal nodes, and so l₀ = i₀ + 1.\n\n2. inductive step. We now must prove that P(k) ⇒ P(k + 1). Put another way, we assume P(k) is true, and then use that assumption to prove that P(k + 1) is also true.\n\nLet’s be crystal clear where we’re going with this. Assuming that P(k) is true means we can count on the fact that lₖ = iₖ + 1. What we need to do, then, is prove that P(k + 1) is true, which amounts to proving that lₖ₊₁ = iₖ₊₁ + 1. We begin by noting that the number of nodes on level k of a perfect binary tree is 2ᵏ. This is because the root is only one node, it has two children (giving 2 nodes on level 1), both those children have two children (giving 4 nodes on level 2), all four of those children have two children (giving 8 nodes on level 3), etc. Therefore, lₖ = 2ᵏ, and lₖ₊₁ = 2ᵏ⁺¹. Further, we observe that iₖ₊₁ = iₖ + lₖ: this is just how trees work. In words, suppose we have a perfect binary tree of height k, and we add another level of nodes to it, making it a perfect binary tree of height k + 1. Then all of the first tree’s nodes (whether internal or leaves) become internal nodes of bigger tree. Combining these two facts, we have iₖ₊₁ = iₖ + 2ᵏ. By the inductive hypothesis, we assume that 2ᵏ = iₖ + 1, and we now must prove that 2ᵏ⁺¹ = iₖ₊₁ + 1. Here goes:\n\niₖ₊₁ = iₖ + 2ᵏ (property of trees)\n\niₖ₊₁ = 2ᵏ − 1 + 2ᵏ (using inductive hypothesis)\n\niₖ₊₁ + 1 = 2ᵏ + 2ᵏ\n\niₖ₊₁ + 1 = 2(2ᵏ)\n\niₖ₊₁ + 1 = 2ᵏ⁺¹.\n\n3. conclusion. Therefore, ∀ n ≥ 0 P(n)."

Related Ideas

How can induction prove that a perfect binary tree has one more leaf than internal node? | Stephen Davies, Ph.D. Version 2.2.2 Through Discrete Mathematics A Cool Brisk Walk | Bifalgorithm | Bifalgorithm