A problem with covariance

2.2k Views Asked by At

A total of n balls, numbered 1 through n, are put into n urns, also numbered 1 through n in such a way that ball i is equally likely to go into any of the urns 1, 2, . . . , i.

Find

(a) the expected number of urns that are empty; (b) the variance of the number of empty urns.

(a)Let $X_i$ be a random variable that is 1 if the i-th urn is empty, 0 otherwise.

$X=\sum_{i=1}^N X_i$=number of empty urns.

$E[X]=\sum_{i=1}^N E[X_i]=\sum_{k=1}^N \frac{i-1}{N}=\frac{N-1}{2}$

(b) $$\begin{align} Var (X) &=Var (\sum_{i=1}^NX_i)\\ &=\sum_{i=1}^N Var (X_i)+2*\sum_{}^ {}\sum_{i<j}^ {}Cov(X_i,X_j)\end{align}$$ I have a doubt about the subscript of the cov

for $i<j$, $$Cov(X_i,X_j)=E[X_i X_j]-E[X_i]*E[ X_j]$$

$$\begin{align}E[X_i X_j] &= P(X_i=1,X_j=1)\\ &=P(X_i)P(X_j=1|X_i=1)\\ &=\prod_{i=1}^{j-1} (1-\frac{1}{i})*\prod_{j=1}^{N} (1-\frac{2}{j})\end{align}$$

$$\begin{align}Cov(X_i,X_j) &= E[X_i X_j]-E[X_i]*E[ X_j]\\ &=\prod_{i=1}^{j-1} (1-\frac{1}{i})*\prod_{j=1}^{N} (1-\frac{2}{j})-\prod_{i=1}^{j-1} (1-\frac{1}{i})*\prod_{j=1}^{N} (1-\frac{1}{j})\end{align}$$

1

There are 1 best solutions below

5
On BEST ANSWER

We can write the number of urns that are empty as $$ N_E = \sum_{j=1}^nX_i $$ where $X_i$ is an indicator that urn $i$ is empty, so that taking expected value of both sides gives $$ E(N_E) = \sum_{i=1}^nP(\mbox{urn i is empty}).$$ The probability that urn $i$ is not assigned ball $k$ is $1-1/k$ if $i\le k$ or else $1.$ Since the balls are independently placed in the urns, the probability that all $n$ balls are not placed in urn $i$ is $$ P(\mbox{urn i is empty})=\prod_{k = i}^n\left(1-\frac{1}{k}\right) =\prod_{k = i}^n\frac{k-1}{k} = \frac{i-1}{n}$$ where we used the fact that the product telescopes.

So for the expected value, we have $$E(N_E) = \sum_{i=1}^n\frac{i-1}{n} = \frac{n-1}{2}.$$

For the variance, we are focused on $$ N_E^2 = \sum_{i=1}^n\sum_{j=1}^n X_iX_j= \sum_{i=1}^nX_i^2 + 2\sum_{i<j} X_iX_j $$ where we separated cross terms of the product from the main terms. We then take the expectation of both sides to get $$ E(N_E^2) = \sum_{i=1}^nP(\mbox{urn i is empty}) + 2\sum_{i<j} P(\mbox{urns i and j are empty}).$$ where we used the facts that $X_i^2=X_i$ and $X_iX_j=1$ only if both urns are empty.

The only thing we haven't computed yet is $P(\mbox{urns i and j are empty})$ for $i <j.$ For that, group the two urns together. The probability that ball $k$ does not go into either urn $i$ or urn $j$ is $1$ if $k<i,$ $(1-1/k)$ if $i\le k < j$ and $(1-2/k)$ if $k\ge j.$ So we have $$\begin{align}P(\mbox{urns i and j empty (i<j)}) &= \prod_{k=i}^{j-1}\left(1-\frac{1}{k}\right)\prod_{k=j}^{n}\left(1-\frac{2}{k}\right) \\&=\left(\frac{i-1}{j-1}\right)\left(\frac{(j-2)(j-1)}{(n-1)n}\right) \\&= \frac{(i-1)(j-2)}{n(n-1)}\end{align}$$ where the products can be computed by telescoping.

We can then compute $$ \sum_{i<j}P(\mbox{urns i and j are empty}) = \sum_{j = 1}^n\sum_{i=1}^{j-1}\frac{(i-1)(j-2)}{n(n-1)}\\=\sum_{j=1}^n\left(\frac{j-2}{n-1}\right)\left(\frac{j^2-3j+2}{2n}\right)\\=\frac{3n^2-11n+10}{24}.$$ Plugging all this in gives $$E(N_E^2) = \frac{n-1}{2} +\frac{3n^2-11n+10}{12}$$ so that the variance is $$\mathrm{Var}(N_E) = E(N_E^2)-(E(N_E))^2 \\= \frac{n-1}{2} +\frac{3n^2-11n+10}{12} - \left(\frac{n-1}{2}\right)^2 \\=\frac{n+1}{12}$$ valid for $n\ge 2.$