Montmort's Problem

Mr. M. wrote a number of letters and prepared the corresponding envelopes. He then put the letters into the envelopes at random. How many letters will be in the correct envelope? The Demonstration shows the results of this experiment and the exact probabilities of the various numbers of correct matches.


  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


Snapshot 1: With five letters, one experiment gave five matches, which has probability only about 0.8%. With letters, exactly matches is impossible, because the letter must also be in the correct envelope.
Snapshot 2: with 10 letters, there are some cases with four matches; here is one of them
Snapshot 3: with 20 letters, there are also some cases with four matches; here is one of them
This problem has various names that contain words like Montmort, derangements, rencontres, matches, or coincidences; see, for example, [1, pp. 100–101], [2, pp. 68–73], [3, pp. 4–8, 231–236]. It was first considered and solved by Pierre Rémond de Montmort in 1708 and 1713. The problem is often represented, as here, by randomly putting letters into envelopes but also, say, by randomly giving hats to their owners.
The expected number of matches is always 1, irrespective of the number of letters. The variance is also always 1. The probability of at least one match approaches the value . Already with five letters, the probability of at least one match is 0.6333, quite close to the limit. With five or more letters, the probability of at least five matches is very small. The distribution of the number of matches approaches the Poisson distribution with parameter 1.
[1] W. Feller, An Introduction to Probability Theory and Its Applications, Vol. I, 3rd ed., New York: Wiley, 1968.
[2] F. Mosteller, Fifty Challenging Problems in Probability with Solutions, New York: Dover, 1987.
[3] P. J. Nahin, Digital Dice: Computational Solutions to Practical Probability Problems, Princeton, NJ: Princeton University Press, 2008.


    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2018 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+