Solved – Probability of 2 uniformly randomly generated, n-digit numbers (n>=4) having the same last 4 digits

probabilityself-study

I apologize if question is too simple!

For example, is the probability of generating 2, 8-digit numbers that have the last 4 digits match the same as the probability of the last 4 matching with a 12 digit number?

For an 8 digit number:

10^8 total possible numbers and 10*10*10*10*1*1*1*1 = 10^4 / 10^8 = 1/10,000 probability of generating 2 with the same last 4.

For 12 digit:

10^12 total possible. 10^8 / 10^12 = 1/10,000 probability again of generating 2 with the same last 4?

Is this correct?

Best Answer

Assumptions:

  1. you're generating these values uniformly
  2. an "8 digit number" could have leading 0s (e.g., the number 123 can be written 00000123).

If these assumptions are true, then your answer and you're reasoning are correct.

Here's another way to look at it that might require less arithmetic. Reframe the question: each digit is sampled independently and identically uniformly on $0, 1, \dots, 9$. Then having the last 4 digits match for two 8 digit numbers is the same as the probability of having two 4 digit numbers match exactly (the other digits don't matter since they are independent of the last 4, and we're not interested in whether they match or not). The probability the last 4 digits match is $(1/10)^4$ which is what you wrote above. Taking this same perspective for the 12 digit numbers, it doesn't matter what the first 8 digits are, and you again have $(1/10)^4$ chance of getting matching last 4 digits.

Related Question