3 + 3 = 3! (What is the factorial function and what are its uses in Maths?)
Imagine you have a box of 9 chocolates (the fancy ones where each is different), you eat one: there is 8 left, you eat another: 7 left, and so on until you have one last one, and of course, you eat that too. Now think about the way you ate the chocolates, maybe you ate the one with the caramel filling first and left the dark chocolate (the best one) until last. What if you ate them in a different order, how many different ways can you eat the 9 chocolates? That is put simply what permutations are, changing the order of the set, e.g. “A B C” can also be “B A C” and so on.
Now think back to the chocolates, you start with 9, you eat 1 and have 8, and then 7 and 6…… For each new chocolate you have 1 less options to pick one. This means that there is a total of 9*8*7*6*5*4*3*2*1 ways to eat the 9 chocolates. (Think of a tree diagram with each branch being another chocolate chosen at its turn). Another way of writing that multiplication is just to write 9! (9 factorial). The factorial function multiplies all natural numbers (counting numbers) together until and including the one before the exclamation mark. 7! = 7*6*5*4*3*2*1 3!=3*2*1 and so on
Hence the factorial function can be written as:
n! = n*(n-1)*n(n-2)*…*2*1
As another thought experiment, think of a set of boxes, ones numbered from 1 to n. This way, the size of the set of elements you have is n. (In other words, you have n boxes). This means that there are n! ways of rearranging the boxes according to what the factorial does. If you then pick a number of boxes from the ones you have, let’s say you pick k boxes out. There will be (n-k)! ways of rearranging the boxes you have left and subsequently k! ways of rearranging the boxes you have picked out.
General statement: you now have a set of n size and a subset of k size.
To find out how many subsets of size k you can pick out from a set of size n you can use the following function. If there are n! permutations of the boxes and k! permutations of the boxes picked. To find the number of different combinations of k boxes from n boxes, divide the total number of permutations (n!) by the permutations of the set left after picking out the boxes ((n-k)!) as you no longer care about them and also by the distinct permutations of the subset itself (k!) because you don’t care about the order inside of the subset. Finally we have an expression for the amount of subsets of k size from a set of n elements, known as the “choose” function: n!/(k!(n-k)!).
To apply this, think of the chocolates again, 9 chocolates and you want to pick out 3 to eat. How many different combinations of chocolates can you have as your 3? Well 9! Divided by (3!(9-3)!) is 9*8*7 divided by 6, so 84 different combinations of the chocolates you can pick. There too exists a “pick” function where you do care about the order of the (for example) 3 chocolates in which case you just don’t divide by the 3 or the k factorial.
This was a very brief introduction to combinatorics, a branch in statistics which is very difficult, I’m not going to lie, but also very interesting and has numerous applications in the real world.
- Wiktor Podlewski
Now think back to the chocolates, you start with 9, you eat 1 and have 8, and then 7 and 6…… For each new chocolate you have 1 less options to pick one. This means that there is a total of 9*8*7*6*5*4*3*2*1 ways to eat the 9 chocolates. (Think of a tree diagram with each branch being another chocolate chosen at its turn). Another way of writing that multiplication is just to write 9! (9 factorial). The factorial function multiplies all natural numbers (counting numbers) together until and including the one before the exclamation mark. 7! = 7*6*5*4*3*2*1 3!=3*2*1 and so on
Hence the factorial function can be written as:
n! = n*(n-1)*n(n-2)*…*2*1
As another thought experiment, think of a set of boxes, ones numbered from 1 to n. This way, the size of the set of elements you have is n. (In other words, you have n boxes). This means that there are n! ways of rearranging the boxes according to what the factorial does. If you then pick a number of boxes from the ones you have, let’s say you pick k boxes out. There will be (n-k)! ways of rearranging the boxes you have left and subsequently k! ways of rearranging the boxes you have picked out.
General statement: you now have a set of n size and a subset of k size.
To find out how many subsets of size k you can pick out from a set of size n you can use the following function. If there are n! permutations of the boxes and k! permutations of the boxes picked. To find the number of different combinations of k boxes from n boxes, divide the total number of permutations (n!) by the permutations of the set left after picking out the boxes ((n-k)!) as you no longer care about them and also by the distinct permutations of the subset itself (k!) because you don’t care about the order inside of the subset. Finally we have an expression for the amount of subsets of k size from a set of n elements, known as the “choose” function: n!/(k!(n-k)!).
To apply this, think of the chocolates again, 9 chocolates and you want to pick out 3 to eat. How many different combinations of chocolates can you have as your 3? Well 9! Divided by (3!(9-3)!) is 9*8*7 divided by 6, so 84 different combinations of the chocolates you can pick. There too exists a “pick” function where you do care about the order of the (for example) 3 chocolates in which case you just don’t divide by the 3 or the k factorial.
This was a very brief introduction to combinatorics, a branch in statistics which is very difficult, I’m not going to lie, but also very interesting and has numerous applications in the real world.
- Wiktor Podlewski