I would appreciate help with this question: What is the probability that two nine digit numbers, each using all of the digits 1 through 9, will have exactly two of the digits in the same place in the number?
Thank you.
-Ron
Is there a Mathematica angle?
This sounds like homework.
Not homework, I am having a debate with my adult son and neither of us knows how to answer the question.
Thank you.
-Ron
We could simulate an experiment with 10^5 random pairs:
In[2]:= N[Sum[a = RandomSample[Range[9]]; b = RandomSample[Range[9]];
Boole[Count[a - b, 0] == 2], {10^5}]/10^5]
Out[2]= 0.18364
That’s not too far from the exact probability
In[3]:= (1/2) Sum[(-1)^j/j!, {j, 0, 7}]
Out[3]= 103/560
In[4]:= N[%]
Out[4]= 0.183929
See the following link for a proof: The Matching Problem.
Oh my. More complex than I had thought.
Thank you very much.
-Ron