Calculating Stirling Numbers

in

Don’t worry if you don’t know what those are, because I’m here to break it down for ya in a way that won’t put you to sleep (hopefully).

Before anything else: what exactly are these “Stirling numbers” we keep hearing about? Well, they’re basically just fancy math terms used to describe how many ways you can arrange a set of objects. For example, if you have 5 people and want to know how many different groups of 3 you could make (without repeating anyone), the answer would be:

{5 choose 3} = {120}

That’s just one way to write it there are actually a few different notations for Stirling numbers.

So here’s the deal: if you want to find out how many ways there are to arrange n objects in k groups of size r each (without repeating anyone), you need to use a formula called Stirling numbers of the second kind. It looks like this:

{n choose k} = {1 over k!} * sum from j=k to n of {n choose j} * {j choose k} * (-1)^(j-k) * (j-k)! / r^(j-k)

Now, I know that looks like a bunch of gibberish, but trust me it’s actually pretty simple once you break it down. Let’s go through each part step by step:

1. {n choose k} = the number of ways to arrange n objects in k groups (without repeating anyone)
2. 1 over k! = this is just a way to make sure we don’t count any duplicates when calculating our answer it basically means “divide by the factorial of k”
3. sum from j=k to n: this part tells us that we want to add up all the possible values for j (starting at k and going up to n)
4. {n choose j} * {j choose k}: this is just a way to calculate how many ways there are to arrange n objects in j groups, with k of those groups being specifically arranged in a certain order (without repeating anyone). The first part ({n choose j}) tells us how many different arrangements we can make for all j groups, while the second part ({j choose k}) tells us how many different ways there are to arrange just the k groups that interest us.
5. (-1)^(j-k): this is a fancy way of saying “multiply by -1 if j is greater than k” (which we do because we want to make sure our answer includes both cases where some people end up in smaller groups, and others where they’re all grouped together).
6. (j-k)!: this part tells us how many different ways there are to arrange the remaining r objects after we’ve already arranged k of them into their own specific groups. The exclamation point (!) is just a way to indicate that we want to calculate the factorial of j-k which basically means “multiply all the numbers from 1 up to (j-k)”
7. r^(j-k): this part tells us how many different ways there are to arrange the remaining r objects after we’ve already arranged k of them into their own specific groups, but now we want to make sure that each group has exactly one person in it (which is why we divide by r).

Of course, if you’re still feeling confused or overwhelmed, don’t hesitate to reach out and ask me any questions! I’m always here to help.

SICORPS