Suppose you had the strange urge to eat a flavored gelatin every day of the month of May, day 1 went to the market and bought all the gelatines you found, but coming home, despite the many gelatines of each flavor, the variety of flavors was just raspberry, strawberry, grape, pineapple and lemon. What to do in a situation like this? Get in the car and keep wandering around the world looking for new flavors of gelatin, or, solving your problem with a little permutation?
Until you decide, let’s make the gelatines of the flavors we have:
Day 1 – Raspberry;
Day 2 – Strawberry;
Day 3 – Grape;
Day 4 – Pineapple;
Day 5 – Lemon.
But now, after thinking for 5 days, we already know how to solve this problem and our crazy desire for gelatin:
Day 6 – Raspberry-Strawberry;
Day 7 – Raspberry-Grape;
Day 8 – Raspberry-Pineapple;
Day 9 – Raspberry-Lemon;
Day 10 – Strawberry-Grape;
Day 11 – Strawberry-Pineapple;
Day 12 – Strawberry-Lemon;
Day 13 – Grape-Pineapple;
Day 14 – Lemon Grape;
Day 15 – Pineapple-Lemon.
But if we did it with two flavors, we can do it with one more flavor:
Day 16 – Raspberry-Strawberry-Grape;
Day 17 – Raspberry-Strawberry-Pineapple;
Day 18 – Raspberry-Strawberry-Lemon;
Day 19 – Raspberry-Grape-Pineapple;
Day 20 – Raspberry-Grape-Lemon;
Day 21 – Raspberry-Pineapple-Lemon;
Day 22 – Strawberry-Grape-Pineapple;
Day 23 – Strawberry-Grape-Lemon;
Day 24 – Strawberry-Pineapple-Lemon;
Day 25 – Grape-Pineapple-Lemon.
We can mix some more flavors, and we will have:
Day 26 – Raspberry-Strawberry-Grape-Pineapple;
Day 27 – Raspberry-Strawberry-Grape-Lemon;
Day 28 – Raspberry-Strawberry-Pineapple-Lemon;
Day 29 – Raspberry-Grape-Pineapple-Lemon;
Day 30 – Strawberry-Grape-Pineapple-Lemon.
With only one day left to close the month with a different flavor each day, we go to the grand finale:
Day 31 – Raspberry-Strawberry-Grape-Pineapple-Lemon.
There, with only 5 types of gelatine, 31 recipes for you to delight in every month of May. But beauty, what does this have to do with mathematics? Or did I eat too much gelatine and now I’m varying my ideas (in fact I love gelatine and I don’t believe there is “too much gelatine”).
Before starting this post, I was making gelatin and thinking, how many ways can we combine these little packages? This is a permutation problem in which order does not matter, that is, if I mix Pineapple with Lemon, it is the same thing as mixing Lemon with Pineapple.
In this case, this is a problem that can be easily solved with the mathematical tool called “X chooses Y”. That is, we have a set with X elements, an amount Y to be chosen, such that Y is less than X. I will give an example:
I have 5 flavors of gelatin and I need to choose 1.
The solution seems “obvious” and in fact it is obvious … but let’s see how to write it in terms of permutation.
The tool “X chooses Y” can be represented as the factorial of X, divided by the factorials of Y and (X – Y). In the example above, 5 chooses 1, we would write as:
This is equal to 120/(24*1) = 5. It was in fact a very simple case of finding the answer even without this tool.
Now, if we think about the question of 2 combined flavors, we have again the problem of “X chooses Y”, in these examples X will always be equal to 5, since it represents the total of available flavors in our problem. What will change is Y, which represents here the amount of flavors we want to mix, which in this case will be 2.
This is equal to 120/(6*2) = 10. It was no longer such an easy result to discover, but let’s see how this concept is very convenient for the next calculations.
Now with 3 flavors, we don’t even need to do the math, because Y will be 3, but from the definition of “X chooses Y”, we have 5! will be divided by Y! and by (X – Y) !. In this case, Y will be 3, and (X – Y) will be 2. That is 5!/(2!3!). But since the order of the factors does not change the product when multiplying real numbers, we have 5!/(3!2!) = 5!/(2!3!), Which we already know the answer, is worth 10.
The same tells us that for 4 flavors, we will have 5!/(1!4!) = 5!/(4!1!) = 5.
Finally, the last combination, 5 flavors of 5 options: 5!/(5!0!) = 1. Remembering, of course, that 0! is worth 1, because it represents the number of ways that we can combine 0 objects, and although it seems counterintuitive, we can combine 0 objects in 1 way.
Adding the results, we arrived at our beloved 31 gelatin recipes 🙂