Thursday, March 16, 2017

logical deduction - The most probable key


You broke into John Doe's house and found the safe. It has a combination lock with 4 dials ranging from 0 to 9 each. Unfortunately it's a good safe, which doesn't click when one or more digits are correct. Luckily the owner seems to be quite forgetful – as one can see from the following sheet of paper attached to a side wall: Key recovery



  • You have no idea what newspaper article is referred to. Also there is no clue where to find it. Searching through the whole house would take way too much time.

  • The same for the VHS recorder manual: No idea where it could be, nor what page 9 is about.


  • Jane must be John's wife, but you don't know their parking spots. You only saw that all 20 parking spots belonging to this appartment are in a row and are marked with numberplates. They are rented to the residents of the appartment probably in random order.

  • You don't know the birthday of any of these persons.



With the knowledge available to you, which 4-digit key is most likely to open the safe?




Answer



After 2 months without John Kossa editing his answer on this question there is still no complete solution. So I decided to post an answer to this question myself. It is also very unlikely that somebody takes the effort to put his own answer, now that John Kossa already solved the puzzle halfway.


So, what's the most likely key?
Therefore, take a look at the reconstruction variables $a$, $b$, $c$ and $d$:



$a$:



One might think all digits are equally likely, but this is not the case for the first digit of a number. Benford's law describes that the probablity distribution for $a$ is $$P(a) = \text{log}_{10} \left( \frac{a+1}{a} \right) \text{.}$$ With this $a$ is most likely to be $1$ with a probablilty of $30.1 \, \%$. This is the probability distribution for $a$:



$b$:



Letters are also not equally distributed. As this is the 21st letter on a page of a (probably) English manual we cannot use the distribution of first letters of a word, but the general probability distribution. This distribution looks like:




$c$:



For the first of the two parking spots there are $20$ possibilities, for the second one $19$. This gives $380$ possible settings. In $38$ settings the distance between the parking spots is $1$. For a distance of $c=2$ there are only $36$ possibilities left. For each further increase of $c$ the number of possibilities drops by $2$. This gives the following probability distribution:



$d$:



This one seems to be less obvious than I thought. We may assume that the piece of paper with the instructions is meant to give a clear answer for John Doe (who knows the birth dates of these 11 people). The answer is only unique if the 11 people are born in 11 different months, so that $d$ gets its value from the remaining month. How this looks in terms of probability was answered in this question. The probability distribution is $$P(d) = \frac{1}{m_d \left( \sum\limits_{i=1}^{12} \frac{1}{m_i} \right)}$$ where $m_i$ is the length of the $i$th month. As February is the shortest month, the probability that none of the 11 persons is born in this month is maximal with $P(2) = 8.97 \, \%$.




If we now take the most likely values of



$a=1$, $b=5$, $c=1$ and $d=2$, we get $\left( 7000 \cdot 5 + 100 \cdot 2^{1+1} + \left\lfloor \frac{5 \cdot 1 + 2^2}{1^{3-5}} \right\rfloor + 2 \right) \text{mod} 10000$ $= \left( 35000 + 400 + 9 + 2 \right) \text{mod} 10000$ $= 5411$ with a probability of $0.034 \, \%$, which is at least better than just guessing.



But wait...



... there are in total $53352$ possible $(a, b, c, d)$ tuples which map onto $10000$ possible keys. This means it makes sense to make a histogram of all possible keys. But instead of just counting the number of possible tuples that map onto the same key, we weight the tuples with their individual probabilities.

The biggest peak is for a key of $7101$ with a probability of $0.154 \, \%$, which is twice as likely as the previous "solution" $5411$ ($0.081 \, \%$).

To understand this we take a look at a possible $(a, b, c, d)$ tuple leading to a key of $7101$, namely $(1, 1, 1, 1)$. This deviates from the most likely values of $b$ and $d$, but leads to many tuples mapping to the same key: With $d=1$ the term $100 \cdot d^{a+1}$ becomes independent of $a$, hence the second digit of the key is the same for (almost) all values of $a$.
The reason for $b=1$ is more subtle. If $b > 3$ the exponent in the denominator of the term $\left\lfloor \frac{5c + 2^d}{a^{3-b}} \right\rfloor$ becomes negative, hence the term will get big easily, which means that it will map the $(a, b, c, d)$ tuples onto many different keys. The smaller $b$ is the smaller this term will be. For the smallest value of $b = 1$ the term will result in $0$ for most values of $a$, $c$, $d$.




No comments:

Post a Comment

classical mechanics - Moment of a force about a given axis (Torque) - Scalar or vectorial?

I am studying Statics and saw that: The moment of a force about a given axis (or Torque) is defined by the equation: $M_X = (\vec r \times \...