## Posts Tagged ‘**Proofs**’

## One tree many possibilities: Part 3

### Introduction

When I first began publishing content on this blog, I wrote a couple of posts entitled *One tree many possibilities* that covered how to enumerate the sets produced by different counting techniques. You can catch up on the idea in part one and the C# implementation in part two. In this post I’m going to cover how to take the knowledge from the first two posts and derive closed form solutions to each of the counting techniques through analysis of their respective recurrence relations.

### Preliminaries

The basic idea is that that the set and each of its elements, , are supplied to a binary operation, , that maps to a subset of . This process is performed iteratively on until the process has been applied to a depth of or the resulting subset becomes the empty set.

Since we can have a variety of conceivable sets, we need to map sets of a given cardinality to a common set of the same cardinality. Let be a bijective function that maps a set to the set of positive integers from 1 to .

### k-ary Cartesian Product

The k-ary cartesian product is the way of selecting items from a set where the order of the selection is important and items can be placed back into the set after selection.

The process uses where is an identity function. As an example, here is a graph of the process applied to with :

To count the number of elements, we need to count the number of nodes at depth . We will write this using the following recurrence relation:

If we think of the tree having a height of , then we can label each layer from (at the root) to zero. As a consequence, we can interpret the first statement as a node at depth zero will be considered a leaf node and should be counted once. The second statement says that for each element in we will add up whatever number of leaf nodes were counted in the layer beneath the current layer .

Rearranging the second statement leads to . Reducing further times leads to .

### k-Permutations

The permutation and k-permutation is a way of selecting items () from a list where the order of the selection is important but items cannot be placed back into the set after selection.

The process uses where is the set difference operator. We use the set difference because the item is removed from the set upon each selection. As before, here is a graph of the process applied to with :

To count the number of elements, we need to count the number of nodes at depth . (The regular permutation can be counted when .) We will write this using the following recurrence relation:

Using the same labeling scheme as in the k-ary cartesian product, we can interpret the first statement as any node at depth zero will be considered a leaf node and counted once. The second statement says that for each element in we will add up whatever number of leaf nodes were counted in the layer beneath the current layer for the set . We use since we removed an element from .

Rearranging the second statement leads to . Taking times leads to .

### Power Set

The power set is the way of selecting zero items to the cardinality of the set items from a set where the order of the selection is not important and items are not placed back into the set after selection.

The process uses where . As before, here is a graph of the process applied to :

To count the number of elements, we need to count the number of nodes in the tree. We will write this using the following recurrence relation:

The first statement says for any node a depth zero we will count it once. The second statement states that for each element in we will add up the result from to . Starting at is a way of encoding that all nodes should be counted. We go up to because there are elements in less than .

Rearranging the second statement leads to . Taking the expression to zero leads to .

### k-Combinations

The k-combination is the way of selecting a fixed number of items from a set where the order of the selection is not important and items are not placed back into the set after selection.

The process is identical to the power set.

To count the number of elements, we need to count the number of nodes at depth in the tree. We will write this using the following recurrence relation:

The first statement says for depth zero we will count once, the second statement states that we will add up whatever sum was produced by iterating over from one to and reducing the depth by one. To find the closed form solution, we’ll approach the recurrence relation inductively:

Important to notice that for that we have the unit, for we have the natural numbers, for we have the triangle numbers, for we have the tetrahedral numbers and so on. The generalized sequence is the Figurate number– these numbers constitute Pascal’s Triangle which is one method of calculating combinations.