返回题库

信封错装

Messing with Envelops

专题
Probability / 概率
难度
L6

题目详情

有 nn 封信与 nn 个信封。把 nn 封信随机放入信封(等价于对 nn 个编号做均匀随机排列)。

问:最终装对的信封数量的期望是多少?

提示:指示变量 + 期望线性性。

英文原题

There are nn letters and nn envelopes. You put the letters randomly in the envelopes so that each letter is in one envelope. (Effectively a random permutation of nn numbers chosen uniformly). Calculate the expected number of envelopes with the correct letter inside them.

Hint

Use Indicator variables and the Linearity of Expectation

解析

答案是 1。

令 XiX_i 表示第 ii 个信封是否装对(装对为 1,否则为 0),则

E[Xi]=P(第 i 封信进第 i 个信封)=1n.E[X_i]=P(\text{第 }i\text{ 封信进第 }i\text{ 个信封})=\frac{1}{n}.

总装对数 X=∑i=1nXiX=\sum_{i=1}^n X_i,因此

E[X]=∑i=1nE[Xi]=n⋅1n=1.E[X]=\sum_{i=1}^n E[X_i]=n\cdot\frac{1}{n}=1.

英文解析

1

Solution

Let XiX_i be the indicator random variable such that:

  • 11 if the iith letter ends up in the iith envelope.
  • 00 otherwise

E[Xi]=P(Xi=1)=1/nE[X_i] = P(X_i = 1) = 1/n for any ii

let XX be the number of letters that ended up in their respective envelopes.

Now, XX= X1+X2+…+XnX_1 + X_2+ \ldots +X_n

E[X]=E[∑i=1nXi]E[X] = E[\sum_{i=1}^{n} X_i]

=∑i=1nE[Xi]= \sum_{i=1}^{n} E[X_i] (Using Linearity of Expectations)

=∑i=1n(1/n)=1=\sum_{i=1}^{n} (1/n) = 1

Therefore, we expect on average one letter to be in the correct envelope.