Stirling Numbers (of the first and second kind) are famous in combinatorics. There are well known recursive formulas for them, and they can be expressed through generating functions. Below we mention and explain the recursive definitions of the Stirling numbers through combinatorial ideas.

Since the Stirling numbers of the second kind are more intuitive, we will start with them.

## Stirling Numbers of the Second Kind

Suppose you have different objects labeled . You also have identical boxes so you cannot order them, or differentiate between them. The question is: in how many ways can you put these different objects into these identical boxes? You cannot leave an empty box. Let’s say the solution is . What are the values of for different and ? These numbers, namely , are called the Stirling numbers of the second kind.

Now think about it. Lets start by observing the object. No matter how you throw different objects into identical boxes, you will end up in one of the two following scenarios:

(1) The object is all alone in some box.

(2) The box containing the object also contains one or more objects.

Consider case (1). If we delete the object along with the box, it is evident that the rest of the objects (there are of them) were arranged in the rest of the boxes (there are of them). In other words, number of ways we could end up in case (1) is .

Now consider case (2). This time, let’s delete only the object but leave the box and the neighbors as they were. If we want to put the deleted object back into the mix, where do we put it? Boxes are identical and each contains at least one of the elements . Looks like we could put the object back into any of the boxes and the resulting configuration will still be in case (2). Since there are exactly ways of putting the object back into any of the boxes, number of ways of generating a configuration of case (2) is .

Since there are no other cases, we have

The numbers are called the Stirling numbers of the second kind, which essentially tells us (now you see) the number of ways different objects can be arranged into identical boxes such that no box is left empty.

You can see Wikipedia for closed form solution and other properties of the Stirling number of the second kind.

## Stirling Numbers of the First Kind

The combinatorial idea of the Stirling numbers of the first kind is similar to the previous case, except that now the ordering of the objects inside each box matters.

Suppose you have numbers . Let us consider the following permutation of these numbers when :

value: | 3 | 1 | 5 | 6 | 7 | 4 | 2 | 8| 9 | ---------------------------------------------- position:| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8| 9 |

Now let’s find cycles. We observe that

— position 1 contains 3

position 3 contains 5,

position 5 contains 7,

position 7 contains 2,

position 2 contains 1 (cycle of length 5)

— position 4 contains 6,

position 6 contains 4 (cycle of length 2)

— position 8 contains 8 (cycle of length 1)

— position 9 contains 9 (cycle of length 1)

In other words, there are 4 cycles in the above permutation:

(35721)(64)(8) (9)

Now we are ready to ask the following question: in how many ways can you arrange the numbers so that you end up with exactly cycles? Suppose the answer to this question is . What are the values of for different and ? As you have guessed it, the numbers are indeed the Stirling numbers of the first kind.

So how can we derive a recursive relation for it? We will go back to our objects-and-boxes analogy. We want to throw different objects into exactly identical boxes such that elements inside any given box form a cycle. How many ways to do it? Like before, all admissible permutations of objects fall into one of two cases:

(1) The number is forms a cycle by itself.

(2) The number is part of a larger cycle.

In case (1), the number of ways we can end up here is the same as arranging the rest numbers “properly” into cycles. Therefore, there are different ways of arranging numbers into cycles so that they all fall in case (1).

In case (2), once again we delete the number without touching other elements in its cycle. After we deleted , observe that the rest of the numbers are already arranged in cycles, which can be done in ways. So how many ways could we have deleted ? Observe that this number, , could have appreared before any of the existing numbers, so there were ways we could have deleted from the permutation. Therefore, there are different ways of arranging numbers into cycles so that they all fall in case (2).

Since there are no other cases, we have

The numbers are called the Stirling numbers of the second kind, which essentially tell us (now you see) the number of partitions of integer , each having exactly cycles.

You can see Wikipedia for closed form solution and other properties of the Stirling numbers of the second kind.