1

The Matching Problem

You write a stack of thank you cards for people who gave you presents for your birthday. You address all of the envelopes but before you can stuff them you are called away. A friend tying to help you see the stack of cards and stuffs them in the envelops. Unfortunately they did not realize that each card was personalized and just stick them in the envelops randomly. Assuming there were $n$ cards and $n$ envelops, let $X_n$ be the number of cards in the correct envelope.

Find $E(X_n)$.


I have brute forced the answer by calculating $E(X_n)$ for $1, 2, 3, 4, 5, 6$ letters. It seems pretty clear that $E[X_n] = 1$. However, I have trouble generalizing this for all $n$. I would appreciate any help and hints on a non-bruteforce method that gives me the answer.

nonuser
  • 90,026
  • Are you familiar with linearity of expectation? Try to write $X_n$ as the sum of $n$ simpler variables (they don't have to be independent). – Erick Wong Feb 24 '15 at 02:55
  • 1
    My god. I spent two hours playing around with factorials and combinations and triangular numbers only to find that the answer is so simple. Thank you sir. – user3642365 Feb 24 '15 at 02:58
  • This is a little off topic, but you might also find it interesting: http://math.stackexchange.com/questions/399500/why-is-the-derangement-probability-so-close-to-frac1e – jameselmore Feb 24 '15 at 03:17

1 Answers1

0

Community wiki answer so the question can be marked as answered:

As noted in the comments, the problem is readily solved using linearity of expectation and indicator variables for the $n$ cards to be in the right envelope (or the $n$ envelopes to contain the right card).

joriki
  • 238,052