Where are are the errors in my inductive proof?

217 Views Asked by At

I was asked the following question on an exam and it was only marked wrong with no other marks on it. I went to see the TA who marked it and he could only tell me that it was wrong. I suspect that he did not have the time to explain it to me. This is worrying because I must not have as good of an understanding of induction as I thought I did. Any help would be greatly appreciated as this will not be the last time I will being seeing induction.

Question:

For a proper binary tree, prove e = i + 1, where e is the number of leaves (external nodes) in the tree, and i is the number of internal nodes in the tree.

My best attempt at a proof:

Base Case: there is one node in the tree that is external.

i = 0

e = i + 1 = 1

Assume: e = i + 1

if we add a node, the node (parent) will become an internal node and the number of external nodes stays the same. Now we have e = i. However, for the tree to be a proper binary tree, we must add one more child so e = i + 1.

1

There are 1 best solutions below

0
On

As described on Wikipedia page, induction proof consists of two steps base case and induction step. You started with good base case. It seems to me that you are not clear what n means in the proof, so it is not clear how to do induction step.

Here are two proofs by induction of the proposition, where base case is as you stated. First to be clear, lets recall definition of proper binary tree, itis a binary tree where each inner node has exactly two children.

1. n is number of internal nodes

To create tree with n+1 internal nodes, we have to take a tree with n internal nodes and change some leave with internal node. That new internal node has to have two children which are leaves. That means new tree has one more internal node and one more leave than tree it is created from. Since property (e=i+1) holds for initial tree it also holds (e+1=i+1+1) for new tree.

2. n is depth of a tree

Lets take a tree (T) of depth n+1. It consists of a root and it's two children trees. Each children tree is of depth <= n, and for both of then property hold (e_1=i_1+1, e_2=i_2+1). So number of external nodes in T is e = e_1 + e_2. Number of internal nodes in T is i = (i_1+1) + (i_2+1) + 1. It is easy to se that e = i + 1.