Math: Probability and combinatronics
September 21, 2022 5:09 AM   Subscribe

Ok... so I'm looking at a candidate for a job position and I notice on his resume the following: Between his mobile number and my mobile number (10 digit, US format) there are 9 numbers in common, 5 of which are in the right position.

Without knowing which numbers are actually in common and which number does not match, what is the probability that you would be able to accurately synthesize the other phone number.

Probability was 25ish years ago, and while I've used it - this is one of those exhaustive cases where I remember it would require combining multiple conditional probabilities to solve.

I'd like to avoid giving the numbers and that would still be a special case of that condition, as you could place the 5 right positions in various permutations to make this pattern visible.

I'm also less interested in the actual solution and much more interested in re-learning how to tackle it
Statements I can make about the a given digit, Given that 9 digits are correct and 5 digits are in place, what is the probability that I am the right digit and in the right place?
I mean does that just simplify it it ((9/10) * (5/10))^10 or do I have to consider the positioning and the probability of this more closely... and is it (5/10) or is it (5/9)... these are the things that kept me up last night
T
posted by Nanukthedog to Grab Bag (12 answers total)
 
Are three of the five rightly-positioned numbers the area code? The rest of the math is beyond me, but you probably do need to consider that area codes (and the next three numbers, the exchanges) are not randomly distributed.
posted by hovey at 5:23 AM on September 21


Response by poster: I'm thinking only within the confines of a ten digit number. With specifics to my observation, the area codes don't match - the exchange was spot on and the last four were an inversion - hence where my eyes went. Amazingly, the area codes don't match - but as I said, for this - I'm thinking more in terms of a generalized solution which would treat 000 as an area code as a possibility even though that isn't a real solution...

While I don't want to solve for the exact answer, the exact format is:
His: BYF-FHY-QKVS
Mine: YQB-FHY-QSVK
I've replaced numbers with a random letter to make this largely useless, though you could use the specificity of the area code to initially narrow down the states - once again though, not looking to publish my phone number or some one else's on the internet.
posted by Nanukthedog at 5:52 AM on September 21


If it's a question about any pair of ten-digit numbers, and you are willing to ignore hovey's excellent point about area codes not being random and exchanges not being random, then I think the main question is whether there are repeated digits. As in, your example BYF.FHY.QKVS repeats the "F", and YQB.FHY.QSVK repeats the "Y."

If the number you were starting with was 123.456.7890, then there are 10-choose-9 ways to pick the 9 digits from those 10 and start mucking about with those. (That's 10, because picking 9 distinct things from 10 distinct things is the same as picking the 1 distinct thing you leave out.)

If the number you were starting with was 212.222.2222, then there's really only 2 sets of 9 digits to pick: (nine 2's,) and (eight 2's plus one 1). A seemingly reasonable resource for these kinds of counting problems is here.

If you're not going to let me know which digits are in the right position, then I think it's just (pick the nine digits in common)*(pick the tenth digit)*(permute those ten digits). So you'll need that "permutation with repetition" formula. But it's going to be on the order of:
10 (ways to pick nine from your ten to start) *
10 (ways to pick the tenth digit) *
10! (ways to arrange the ten digits you know have).

If there are repeated digits, you can divide that number by the number of repeated digits factorial to account for the fact that 12b45b789b gets counted 6 = 3! times for the 6 identical ten-digit numbers that result from whatever b happens to be.

If you account for the fact that area codes and exchanges are not assigned randomly, that probably comes down dramatically. But I don't know too much about how they're assigned these days. (I know that Cape Canaveral Florida asked for permission to get "321" as their area code, which is cool, but maybe not helpful.)
posted by adekllny at 6:09 AM on September 21 [2 favorites]


I solved the wrong problem, but this might still be of interest. How many phone numbers could have this relationship with yours?

You can simplify by looking only at the parts that differ: Y*BSK.

How many ways are there to arrange YBSK? That's a permutation of 4 elements, so there are 4! = 24 possibilities. However, all four digits have to be in the wrong position! Only 8 of the possibilities remain (BYKS BKYS BSKY KYBS KSBY SKBY SYKB SKYB).

That leaves the totally incorrect number (your Q). This could be any of 9 numbers (i.e. anything but Q). So there are 8 * 9 = 72 possible numbers with this precise relationship to your own.
posted by zompist at 6:23 AM on September 21


Response by poster: Nice Adekllny! This is helping unclog the brain. As a note though 212-222-2222 violates the initial supposition, as the amount of repetition prevents only 5 digits from being in place.
posted by Nanukthedog at 6:24 AM on September 21


zompist: the number of derangements of a 4-element set is 9; your list omitted KSYB.
posted by dfan at 6:37 AM on September 21 [2 favorites]


(Also, I think that your enumeration includes items like YBSKA -> BYKSC but not YBSKA -> BYKCS, where the four elements in common don't come from the same four positions as the original. This is where I decided to move on...)
posted by dfan at 6:41 AM on September 21


the exchange was spot on

As a note, exchanges cannot start with 0 or 1, which reduces the problem space a little.
posted by Candleman at 7:11 AM on September 21 [2 favorites]


I just want to chime in anecdotally to say that I've experienced this number matching in real life. My exact number exists within a different area code in my own state and I've gotten misdirected phone calls because someone assumed the person's number started with my are code. So...the occurrence of this is probably not as unique as one might think.
posted by eatcake at 7:19 AM on September 21


Both area codes and exchanges are relatively deliberate -- they're not strictly random. The North American Numbering Plan established the original rules, which have been slowly been being broken/revised due to the huge number of telephone numbers in use now. So, you have to exclude cases like where 911 or 555 is not a valid exchange, an exchange usually isn't the same as the area code (although I couldn't find whether this was a rule or not), etc.

According to the link above, an area code can have a maximum of 7,918,900 valid phone numbers, 20% fewer than the 9,999,999 you'd think were possible with truly random numbers.
posted by AzraelBrown at 8:32 AM on September 21 [1 favorite]


Best answer: Thanks for the correction and the useful word, dfan!

I was focused on keeping the identical slots where they were. But I think we could piggyback on that. Five digits are right; so I think we can look at every set of five digits, make them the right ones, and multiply by 81 to account for the wild card and the right digits in wrong position.

How many ways to pick five digits are there? I think 10 * 9 * 8 * 7 * 6 (that is, you choose one of the 10 digits, then one of the nine remaining, etc.). That's 30,240. So the total number of phone numbers with this level of correct digits/positions, not restricted to the particular locations in the example, should be 2,449,440. Compare this to the possible phone numbers, 10,000,000,000. (I'm ignoring the contraints on real phone numbers.)

I'm a computer programmer at heart, so my approach tends to be "how could we write a program to do this?" A statistician would think differently!
posted by zompist at 4:19 PM on September 21 [2 favorites]


Best answer: Sorry, to be clear, the above is still not completely general. It's a prediction of how many numbers are similar to a given phone number. That may be what Nanuk wants; but he may want to know how many such near-matchups occur among all phone number pairs.
posted by zompist at 4:28 PM on September 21


« Older What am I supposed to do when a friend insists on...   |   What should I do with a day and a half in the Bay... Newer »

You are not logged in, either login or create an account to post comments