# Is my proof that, the number of full nodes plus one is equal to the number of leaves in a nonempty binary tree, correct?

A full node is a node with two children. Prove that the number of full nodes plus one is equal to the number of leaves in a nonempty binary tree.

I am not sure of how to prove this, but I have included my best attempt below:

Theorem. The number of full nodes plus one is equal to the number of leaves in a nonempty binary tree.

Proof. We use proof by induction. $\forall k \in \mathbb{N}$ let $P(k)$ be the proposition that a binary tree with $k$ nodes has $n$ full nodes and $n + 1$ leaves.

Base cases:

Let $k = 1$, then, $P(1) = 0 + 1 = 1$

A binary tree with only $1$ node has $0$ full nodes and $1$ leaf (the node itself is the leaf), so $P(1)$ is true.

Inductive Step: $\forall k \in \mathbb{N}$, we must show that $P(k)\Rightarrow P(k+1)$

We assume $P(k)$ is true for purposes of induction, and we must show that $P(k + 1)$ is true. We have two cases:

Case 1:

If we add a node to an existing leaf, then both, the number of full nodes in the binary tree and the number of leaves in the binary tree do not change.

Case 2:

Enlarging a binary tree by adding a node to an existing node that has $1$ child, makes an initial binary tree with $n$ full nodes now have $n + 1$ full nodes. Since, the parent node becomes a full node, then the number of leaves in the binary tree increases by $1$. So, the number of leaves in the binary tree becomes $(n + 1) + 1 = n + 2$

Thus, the number of full nodes we start with is exactly one less than the number of leaves, and adding a node to the binary tree either changes neither number, or increases both by exactly one, so the difference between the number of full nodes, and the number of leaves will always be $1$. So, $P(k + 1)$ is true.

Since $P(k + 1)$ is true, we can conclude that $P(k)\Rightarrow P(k+1)$ is true.

Therefore, the number of full nodes plus one is equal to the number of leaves in a nonempty binary tree.

Q.E.D

This is correct, though in case 2 you basically repeat the same thing three times. Certainly the first paragraph isn't necessary, and the things you say in the third that are new can be reduced to a single equation ($(n+2)-(n+1)=1$) and tacked on to the end of the second paragraph.
• First off, thank you for taking the time to review my proof. I deleted the first paragraph in case $2$. I was able to see how it was basically the same exact argument that I use in the second paragraph of case $2$. In regards to the third paragraph: I am new to proof writing, so I prefer to write everything out just to make sure that the argument I formulated in my head is the exact argument I end up writing down. With that being said, is it ok to leave the 3rd paragraph as is, or would it make my proof incorrect? Perhaps I can just tack on that equation you wrote up to the end of it? Mar 21 '17 at 17:35
• @Cherry_Developer it's not so much logical wrong, as a little confusing to read. I would write the case like this (your words in the first paragraph fill out the ellipsis): "Enlarging a binary tree... becomes $(n+1)+1=n+2$. Therefore the number of leaves minus the number of full nodes is given by $(n+2)-(n+1)=1$ as desired, and so by induction the theorem is true for all values of $n$." Mar 21 '17 at 17:42