Get inspired by the success stories of our students in IIT JAM 2021. Learn More 

April 15, 2020

How to Pursue Mathematics after High School?

For Students who are passionate for Mathematics and want to pursue it for higher studies in India and abroad.

This problem is a beautiful and elegant probability based on an elementary problem on how to effectively choose the key to a lock. This gives a simulation environment to problem 6 of ISI MStat 2017 PSB.

Problem

Suppose you have a 4-digit combination lock, but you have forgotten the correct combination. Consider the following three strategies to find the correct one:
(i) Try the combinations consecutively from 0000 to 9999.
(ii) Try combinations using simple random sampling with replacement from the set of all possible combinations.
(iii) Try combinations using simple random sampling without replacement from the set of all possible combinations.

Assume that the true combination was chosen uniformly at random from all possible combinations. Determine the expected number of attempts needed to find the correct combination in all three cases.

This problem really intrigues me, which gives me the excitement to solve and solve it.

Prerequisite

  • Expectation
  • Simple Random Sampling With and Without Replacement
  • Discrete Uniform Distribution
  • Geometric Distribution
  • Smoothing of Expectation \( E_X(E(Y|X)) = E(Y)\). When \(Y\) and \(X\) have some relationship, this helps us to calculate the expectation.

Solution

Consecutive Combination

\(U\) ~ Discrete Uniform \(({0, 1, 2, ..., 9999})\)

Suppose, observe that if you select the keys consecutively, then for the true key \(U\), you need \(U\) attempts. (*)

\(N\) denotes the number of attempts required = \(U + 1\) due to (*)

\( E(N) = E(U) = \frac{9999}{2}\).

Simple Random Sampling With Replacement

This is something no one does, but let's calculate this and see why we don't do this and why we need to remember the keys that don't work like SRSWOR, which is the next case.

\(U\) ~ Discrete Uniform \(({0, 1, 2, ..., 9999})\)

\(N\) denotes the number of attempts required. \( E_U(E(N|U)) = E(N)\)

Let's say, we have observed \(U\), which is fixed and we will calculate \(E(N|U)\).

Observe that \(N|U\) ~ Geom(\frac{1}{10000}\), since, there are unlimited trials and success occurs if you pick up the right key \(U\), which has a probability of \(\frac{1}{10000}\).

Therefore, \(E(N|U) = 10000\). Hence, \( E(N) = E_U(E(N|U)) = 10000\)

Let's simulate it.

#Simple Random Sampling with Replacement

NUM = 0
size = 1000 # we have taken 1000 for easier calculation
key = sample(size,1)
number = NULL
random = sample(size,1)
N = 1
for (k in 1:1000) {
  number = NULL
  
  for (j in 1:100)
  {
    while (random != key) 
    {
      random = sample(size,1)
      N = N + 1
    }
    number = c(number,N)
    random = sample(size,1)
    N = 1
  }
  NUM = c(NUM,mean(number))
}
mean(NUM)
980.899
hist(NUM) 
#Note Replace = TRUE will not work, since, this is an open-ended program

Hence, this is validated by our simulation.

Simple Random Sampling Without Replacement

This is the sort of key selection, we usually do. Let's investigate it.

\(U\) ~ Discrete Uniform \(({0, 1, 2, ..., 9999})\)

\(N\) denotes the number of attempts required. \( E_U(E(N|U)) = E(N)\)

Let's say, we have observed \(U\), which is fixed and we will calculate \(E(N|U)\).

\( p_i = P ((N|U) = i) = \frac{9999}{10000}.\frac{9998}{9999}.\frac{9997}{9998}...\frac{10001-i}{10002-i}.\frac{1}{10001-i} = \frac{1}{10000}\)

\(E(N|U) = \sum_{i = 0}^{9999} ip_i = \sum_{i = 0}^{9999} i \cdot \frac{1}{10000} = \frac{9999}{2} \). Hence, \( E(N) = E_U(E(N|U)) = \frac{9999}{2}\).

#Simple Random Sampling without Replacement
average = NULL
number = NULL
size = 10000
key = sample(size,1)
for (j in 1:1000)
{
for (i in 1:100) 
    {
      option = sample(size,size, replace = FALSE)
      v = which(option == key)
      number = c(number,v)
    }
average = c(average,mean(number))
}  
mean(average)
4996.567
hist(average, freq = FALSE)
 a graph of lock and key problem
Close to 4999.5

Stay tuned!

Stay Blessed!

What to do to shape your Career in Mathematics after 12th? 

From the video below, let's learn from Dr. Ashani Dasgupta (a Ph.D. in Mathematics from the University of Milwaukee-Wisconsin and Founder-Faculty of Cheenta) how you can shape your career in Mathematics and pursue it after 12th in India and Abroad. These are some of the key questions that we are discussing here:

  • What are some of the best colleges for Mathematics that you can aim to apply for after high school?
  • How can you strategically opt for less known colleges and prepare yourself for the best universities in India or Abroad for your Masters or Ph.D. Programs?
  • What are the best universities for MS, MMath, and Ph.D. Programs in India?
  • What topics in Mathematics are really needed to crack some great Masters or Ph.D. level entrances?
  • How can you pursue a Ph.D. in Mathematics outside India?
  • What are the 5 ways Cheenta can help you to pursue Higher Mathematics in India and abroad?

Want to Explore Advanced Mathematics at Cheenta?

Cheenta has taken an initiative of helping College and High School Passout Students with its "Open Seminars" and "Open for all Math Camps". These events are extremely useful for students who are really passionate for Mathematic and want to pursue their career in it.

To Explore and Experience Advanced Mathematics at Cheenta
Register here

One comment on “Lock and Key | ISI MStat 2017 PSB | Problem 6”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Knowledge Partner

Cheenta is a knowledge partner of Aditya Birla Education Academy
Cheenta

Cheenta Academy

Aditya Birla Education Academy

Aditya Birla Education Academy

Cheenta. Passion for Mathematics

Advanced Mathematical Science. Taught by olympians, researchers and true masters of the subject.
JOIN TRIAL
support@cheenta.com