Example: Proof by induction with trees
Prove by induction that, for every positive integer , every full binary tree of height has leaves.
: the number of leaves of any full binary tree of height is
Basis Step
We need to prove that:
: the number of leaves of any full bunary tree of height is .
A full binary tree of height is either of height or .
- A full binary tree of height is just a root, so it has leaf and
- A full binary tree of height consists of a root and its two children, so it has leaves and
Inductive Step
We need to show that for any positive integer , if holds then holds as well.
Assume for some positive integer , the number of leaves in any full binary tree of height is . We need to show that the nubmer of leaves in any full binary tree of height is . Let be an arbitrary full binary tree of height .
- Take the two children of the root of , say and .
- Let denote the subtree with root .
- Let denote the subtree with root .
- Then both and are full binary trees of height .
Hence by the IH, has leaves and has leaves as well.
As the leaves of consists of all the leaves in and all the leaves in , has leaves, as required.