Get the context by watching the video:


A scene from The Dragon Prince

As seen in the video, Ezran (the little kid) presses a bunch of stones on a wall, while calling it a Stone or a Rock (what's the difference anyway, though?). Don't call me acerbic, but I must say, it is amusing to watch him be intelligent enough to remember that combination along with stone/rock, but not smart or hygienic enough to wipe off or AT LEAST lick off the jelly on his hands. UGH!
Coming back to the story, we see Rayla (the elf) effortlessly cracking the combination, allegedly by "pressing all the stones with jelly handprints". If that's so, then there are only two explanations: (i) The security to that secret chamber is compromised as hell, which is unlikely, or (ii) Rayla got handsomely lucky (or beautifully lucky, in her case).


Here's why:

The lock consisted of pressing 9 rocks, in a specific series, while calling it with a specific name: Rock or Stone. Since Rayla was very clear that she pressed the stones with jelly handprints, she knew the rocks to be pressed. All she had to do was get the order right. Also, for the sake of proving Rayla's luck, let us assume that each rock had to be pressed only once.

This is similar to a situation where you know the digits of a number lock but do not know the order. Consider this keypad:

(Consider the password to this lock to be 8461)

The circumstances allow for us to know the digits of the lock.
These are the digits required to open the lock: 1, 4, 6, and 8. We arrive at a point to prove Rayla's insane luck already: Just knowing the digits is not enough. We need the specific order of the digits in the lock.

For instance, these are the different numbers we can get using these digits (once) alone:

1468416861488146
1486418661848164
1648461864188416
1684468164818461
1846481668148614
1864486168418641

From the table, it can be observed that the 8461 is 1 of the 24 different combinations that can be obtained by shuffling the digits – and Rayla got it in under 20 seconds. This example is enough to prove that she was lucky.

All good. But how lucky was she, numerically?

According to the data we have, we know that 9 rocks had to be pressed, in a specific sequence. We could label each of those rocks with a letter, say A, B, C, D, ... , I. Then, we could work out all the possible sequences the rocks could be pressed, to find out the total number of possibilities. Let's gooo:

ABCDEFGHI, ABCDEFGIH, ABCDEFHGI, ...

Oof, I'm tired and this thing feels so time-consuming and boring... Any way we could find out the number of such sequences possible instantly?

Heck yeah, boy, that's where Permutations come in!
A permutation means a specific sequence or order in which a list of things occur, be it digits, or letters, or just about any group of things. So, the various sequences of the letters A to I that can possibly occur, they are permutations. For example, ABCDEFGHI, and ABCDEFGIH are two permutations of the group of letters from A to I.

There is a very simple and logical (of course) way to calculate the total number of all possible permutations.

To understand this, consider a simple example. Take just three letters, A, B and C.

To begin with, you have 3 letters to choose from. For the next digit, you have 2 letters to choose from. Therefore, you can represent this possible number of permutations mathematically:

3 × 2 × 1 = 6

When you work the permutations out manually, you find that you get 6 different permutations even then!

ABCACBBAC
BCACABCBA

Also for the keypad-password example above, you could use the same logic:

1st digit → 4 numbers to choose from
2nd digit → 3 numbers to choose from
3rd digit → 2 digits to choose from
4th digit → 1 digit to choose from.

Mathematically:

4 × 3 × 2 × 1 = 24

Lookie what we've got: 24. Which is exactly equal to the number of permutations we got when we worked them out manually.

There's a simpler way to express this pattern of multiplying numbers with their preceding numbers till 1: Factorials.

This is how factorials are expressed mathematically:

n! = n × (n − 1) × (n − 2) × ... × 1

For example,

3! = 3 × 2 × 1 = 6
4! = 4 × 3 × 2 × 1 = 24


Coming back to our original question, to work out the number of permutations we can obtain using the rocks, i.e., the letters A to I, we could use factorials. Since there are 9 rocks, the total number of permutations is:

9! = 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 362,880

This is a neat trick to find out the number of permutations possible, but note, this is valid only for non-recurring digits in a sequence. If all digits could repeat themselves, it would be exponential. For example, if you could use the digits 1, 2 and 3 any number of times to get a 3-digit number, not necessarily all digits have to be present, then, by the same logic, there would be 3 digits to choose from for the first digit, for the second digit too there would be 3 digits, because the digits can repeat in this case!

So, to obtain a 3-digit number from the 3 digits, mathematically, we would do:

3 × 3 × 3 = 3³ = 27

In such recurrable cases, we use exponents. If we have n digits and have to make an m-digit number, under the condition that we can use any digit any number of times and not all digits must be present in a number, then the number of permutations possible would be nm, since we don't lose a digit with each place.

Now to the original question (again): We're not done yet; remember that there was a specific Rock/Stone keyword attached with each stone pressed? This only magnifies the elf's luck now; using the above information, and the fact that there could be a Stone or Rock for each stone pressed, the number of permutations, now including both the sequence of rocks pressed AND Stone/Rock for each stone, increases. Calculating the new permutation again, we get:

There we go! A total of 185,794,560 possible permutations, and Rayla unlocked the secret opening within a matter of 15 seconds. If this is not lucky, I don't know what is. And in addition to my two theories above, here's a third one, based on this: (iii) Rayla had a time machine which she used to rewind time over and over again until she opened the lock.




So, to sum it up: either Rayla is impossibly lucky, or probability decided to take a personal day. In any case, I’ll stick to math (and science)— it’s the only thing that doesn’t depend on jelly consistency. And I'm second-guessing: Rayla didn’t just get lucky—she looked Probability dead in the eye and said, “Move.” And Probability did. Somewhere, a statistician just screamed into a pillow.