# Probability question

**URL:** <https://community.wolfram.com/t/probability-question/736>\
**Category:** Questions\
**Tags:** statistics-and-probability\
**Created:** [October 18, 2013, 6:17pm UTC](https://community.wolfram.com/t/probability-question/736 "2013-10-18T18:17:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![blissak](https://avatars.discourse-cdn.com/v4/letter/b/f475e1/32.png) [@blissak](https://community.wolfram.com/u/blissak)\
**Post date:** [October 18, 2013, 6:17pm UTC](https://community.wolfram.com/t/probability-question/736/1 "2013-10-18T18:17:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![brucem](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/brucem/32/26319_2.png) [@brucem](https://community.wolfram.com/u/brucem)\
**Post date:** [October 18, 2013, 7:39pm UTC](https://community.wolfram.com/t/probability-question/736/2 "2013-10-18T19:39:42Z")

</div>

Is there a Mathematica angle?

This sounds like homework.

---

<div class="post-metadata">

**Author:** ![blissak](https://avatars.discourse-cdn.com/v4/letter/b/f475e1/32.png) [@blissak](https://community.wolfram.com/u/blissak)\
**Post date:** [October 18, 2013, 8:34pm UTC](https://community.wolfram.com/t/probability-question/736/3 "2013-10-18T20:34:25Z")

</div>

Not homework, I am having a debate with my adult son and neither of us knows how to answer the question.  
Thank you.  
-Ron

---

<div class="post-metadata">

**Author:** ![iliang](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/iliang/32/11263_2.png) [@iliang](https://community.wolfram.com/u/iliang)\
**Post date:** [October 18, 2013, 9:22pm UTC](https://community.wolfram.com/t/probability-question/736/4 "2013-10-18T21:22:49Z")

</div>

We could simulate an experiment with 10^5 random pairs:

```auto
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

```auto
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**](http://www.math.uah.edu/stat/urn/Matching.html).

---

<div class="post-metadata">

**Author:** ![blissak](https://avatars.discourse-cdn.com/v4/letter/b/f475e1/32.png) [@blissak](https://community.wolfram.com/u/blissak)\
**Post date:** [October 18, 2013, 9:58pm UTC](https://community.wolfram.com/t/probability-question/736/5 "2013-10-18T21:58:51Z")

</div>

Oh my. More complex than I had thought.  
Thank you very much.  
-Ron
