Lets say there is an experiment in which balls numbered $1,...,n$ are distributed at random in $n$ boxes, also numbered $1,...,n$ so that each box has exactly one ball. Thus, the total number of possible outcomes is $n!$. Let $S_n$ be the number of matches; a match occurs when the ball and the box containing it have the same number.

I want to find $E(S_n)$ and $Var(S_n)$. I'm having troubles identifying the problem mathematically.


closed as off-topic by Henrik, Nick Peterson, Davide Giraudo, Daniel W. Farlow, zhoraster Dec 20 '16 at 22:07

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – Henrik, Nick Peterson, Davide Giraudo, Daniel W. Farlow, zhoraster
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ I had an answer on my computer, but I had to go afk for a while. When I came back and finished up and submitted my answer, the question was closed. If you add some context, maybe the question will be reopened. $\endgroup$ – robjohn Dec 21 '16 at 2:49

Hint: If $X_i$ is the number of the ball in the $i$-th box, then $S_n = \sum \limits_{i = 1}^n I\{X_i = i\}$. Now use standard arithmetic and the linearity of the expectation to determine $E[S_n]$ and $E[S_n^2]$.

  • $\begingroup$ So for $E[S_n]$ would it just be $(1/n!)^n$ and for $E[S^2_n]$ it would be the same? $\endgroup$ – Mike Dec 20 '16 at 16:16
  • $\begingroup$ No, this is very wrong. $\endgroup$ – Dominik Dec 20 '16 at 16:18
  • $\begingroup$ Here is how I did it $E[S_n]=E[I{X_1=1}+...+I{X_n=n}]$ then for each term multiply the value of 1 by the probability of $i-th$ ball getting in the corresponding bin which is $1/n$ $\endgroup$ – Mike Dec 20 '16 at 16:25
  • $\begingroup$ Then how did you get from this to $1/n!^n$? $\endgroup$ – Dominik Dec 20 '16 at 16:25
  • $\begingroup$ It should of been $(1/n)^n$ but I couldn't edit my comment. $\endgroup$ – Mike Dec 20 '16 at 16:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.