Difficulty in understanding "Find $E[N]$ , where $N=\min\{n>0: X_n=X_0\}$"

$N=min\{n>0 | X_n=X_0\}$ means that $N$ is a random variable whose value is the minimum of the set $\{n>0 | X_n=X_0\}$.

Imagine an experience where you first make a draw, say X_0, and then keep drawing $X_i$, one after another, until you get a draw similar to $X_0$ again and then you stop. The number of draws you made is equal to $N$ as defined earlier.

The sample space for it is $\Bbb N^*$ (even though it is impossible in terms of probabilities, you could keep drawing an infinite number of times without getting $X_0$)

What you're looking for is the expected number of draws you made until you got $X_0$ again (a draw identical to the first one).

It follows that $(N|X_0=x_o)$ follows has a Geometric distribution of parameter $p(x_0)$. The expectation for that is $E[N|X_0] = \frac1{p(x_0)}$. Now given (and that's the formula used in Ross's book) $E[N] = E[E[N|X_0]] = \sum_{x_0=1}^m p(x_0)*\frac1{p(x_0)} = m$ Intuitively it makes sense. Among m objects, you have to make m draws on average to get the one you were looking for.


Using nothing but definitions we get

\begin{align} \mathbb E(N) &=\sum_{n\geq 1}\,n\cdot\mathbb P(N=n)\\ &=\sum_{n\geq 1}\,n\cdot\mathbb P(\min\{k\in\mathbb N\,:\,X_k=X_0\}=n)\\ &=\mathbb P\left(X_1=X_0\right)+\sum_{n\geq 2}\,n\cdot \mathbb P\left(\Big(X_n=X_0\Big)\cap\left(\bigcap_{k=1}^{n-1}\Big(X_k\neq X_0\Big)\right)\right) \end{align}

Now, we may use the law of total probability to calculate each of the terms above. We'll have

\begin{align} \mathbb P\left(X_1=X_0\right) =&\sum_{j\geq1}\,\mathbb P\left(X_1=j\,|\,X_0=j\right)\cdot\mathbb P\left(X_0=j\right)\\ \stackrel{\text{indep.}}{=}&\sum_{j\geq1}\,\mathbb P\left(X_1=j\right)\cdot\mathbb P\left(X_0=j\right)\\ \stackrel{\text{iid}}{=}&\sum_{j\geq1}\,{\mathbb P\left(X_0=j\right)}^2 \tag{1} \end{align}

Similarly:

\begin{align} \mathbb P\left(\Big(X_n=X_0\Big)\cap\left(\bigcap_{k=1}^{n-1}\Big(X_k\neq X_0\Big)\right)\right)& \\ =\sum_{j\geq1}\,\mathbb P\left(\Big(X_n=j\Big)\cap\left(\bigcap_{k=1}^{n-1}\Big(X_k\neq j\Big)\right)\,\middle|\,X_0=j\right)\cdot\mathbb P\left(X_0=j\right)&\\ \stackrel{\text{indep. and iid}}{=}\,\sum_{j\geq1}\,{\mathbb P\left(X_0=j\right)}^2\cdot{\mathbb P\left(X_0\neq j\right)}^{n-1}&& \tag{2} \end{align}

So we can see that the formula in $(2)$ also applies to $(1)$, with $n=1$. Hence:

$$\mathbb E(N) =\sum_{n\geq 1}\,n\cdot \left(\sum_{j\geq1}\,{\mathbb P\left(X_0=j\right)}^2\cdot{\mathbb P\left(X_0\neq j\right)}^{n-1}\right) \tag{3}$$

For our particular case, $(3)$ reduces to

$$\mathbb E(N) =\sum_{n\geq1}\,n\cdot \left(\sum_{j=1}^m\,p(j)\,^2\cdot{\big(1-p(j)\big)}^{n-1}\right) $$

We can then change summation order to obtain

$$\mathbb E(N) =\sum_{j=1}^m\,p(j)\,^2\cdot \underbrace{\left(\sum_{n\geq1}\,n\cdot{\big(1-p(j)\big)}^{n-1}\right)}_{(*)} $$

To calculate $(*)$, consider the identitiy

$$\sum_{n\geq 0}x^n=\frac1{1-x},$$

which holds whenver $|x|<1$. Differentiate both sides to obtain

$$\sum_{n\geq 1}nx^{n-1}=\frac1{(1-x)^2}.$$

We can apply the identity above to $(*)$ with $x=1-p(j) \iff 1- x = p(j)$, yielding

$$\mathbb E(N) =\sum_{j=1}^m\,p(j)\,^2\cdot \frac{1}{p(j)\,^2} =\sum_{j=1}^m\,1=m $$

as the solution claims.