Data Science Interview Prep: Q6
Combinations of the Last 4 Digits in Phone Numbers. (Category: Probability)
Sriram has 50 friends. What is the probability that exactly 3 of them have phone numbers where the last 4 digits are a permutation of the digits 1, 8, 3, and 2?
Solution:
Number of unique permutations for the last 4 digits.
First, calculate the number of unique permutations of the digits 1, 8, 3, and 2:
The total number of permutations of four digits is 4! (factorial of 4).
4! = 4 × 3 × 2 × 1 = 24.
There are 24 different permutations of the digits 1,8,3,2.
Number of possible combinations for the last 4 digits.
Since each of the last four digits in the phone number is independent of the others, you can calculate the total number of combinations by multiplying the number of choices for each digit:
Last digit: 10 choices (0-9).
2nd last digit: 10 choices (0-9).
3rd last digit: 10 choices (0-9).
4th last digit: 10 choices (0-9).
The total number of possible combinations of the last four digits = 104 = 10,000.
Probability calculation for phone numbers ending in 1, 8, 3, and 2.
Formula:
Probability that an event E occurs is: P(E) = (Number of favorable outcomes / Total number of outcomes).
Let E be the event that a phone number ends with the digits 1, 8, 3, and 2.
The number of favorable outcomes is 24, which are the different permutations of the digits 1, 8, 3, and 2.
The total number of outcomes is 10,000, which is the total number of possible combinations of the last four digits.
Probability that event E occurs is:
P(E) = 24/10000 = 3/1250 = 0.0024.
Hence, the probability that event E occurs, i.e., the probability that a phone number has the last 4 digits containing the numbers 1, 8, 3, and 2, is 0.0024.
Probability calculation for exactly 3 out of 50 friends having phone numbers ending in 1, 8, 3, and 2.
Formula for choosing x objects out of n total objects:
nCx = n! / (n-x)! x!
n = Total number of objects in the set.
x = Number of objects chosen from n.
A quick recap of the binomial distribution:
The binomial distribution formula calculates the probability of x successes in n independent trials.
It involves two parameters viz. n (the number of trials) and p (the probability of success in each trial).
A probability distribution is binomial if it meets the following conditions:
The experiment is repeated a fixed number of times, n.
Each trial is independent of the others.
Each trial results in one of two possible outcomes, labeled as success or failure.
The probability of success, p, is the same for each trial.
Binomial distribution probability formula:
P(x) = nCx . px · (1 − p)n−x
n = Total number of trials.
p = Probability of success in each trial (the same for each trial).
x = Number of successful events.
Given that Sriram has 50 friends, the probability that exactly 3 of them have the specified combination of last 4 digits is obtained using the above furnished binomial distribution probability formula, where:
n = 50.
x = 3.
p = 24/10000 = 3/1250 = 0.0024.
Probability that exactly 3 out of Sriram’s 50 friends have the specified combination of last 4 digits is given by:
P(X = 3) = 50C3 × (0.0024)3 × (1 − 0.0024)50−3
P(X = 3) = 50C3 × (0.0024)3 × (0.9976)47
P(X = 3) ≈ 0.000242.
Hence, the probability that exactly 3 out of Sriram’s 50 friends have phone numbers with the last 4 digits as a permutation of 1, 8, 3, and 2 is approximately 0.000242, or 0.0242%.
We hope you found the article both enlightening and valuable! For more insightful content delivered straight to your inbox, simply enter your email address below and hit the subscribe button. Stay tuned for future updates!
Reference:
Identical Digits in Friends' Phone Numbers: https://www.glassdoor.co.in/Interview/Three-of-my-150-friends-have-phone-numbers-ending-in-a-permutation-of-the-digits-0-1-4-and-9-Is-this-surprising-QTN_204308.htm