How do I use the Iverson Bracket notation to calculate the expectation of geometric distribution?

381 Views Asked by At

I learned from this answer that I can use the Iverson bracket notation to get the expectation of the geometric distribution. The theory behind it seems unfathomable to me now and I just want to intuit the following practice:

Let $X$ be a random variable which is $1$ with probability $\frac{1}{100}$ and $0$ with probability $\frac{99}{100}$. Suppose that I draw independent random variables $X_1$, $X_2$ ... and I stop when I see the first "$1$". For example, if I draw

$$X_1=0, X_2=0, X_3 = 0, X_4=1$$

then I would stop at $X_4$. Let N be the last index that I draw. How big would the expected $N$ be?

Here are my thoughts:
If it comes up $1$(with probability $1/100$), then the expectation is $\frac{1}{100} \cdot 1$; otherwise, I start again except I've already used one trial, but I don't understand why the expectation, in this case, is $(1-\frac{1}{100}) \cdot (1+E[N])$?

Is it for the rest of all trials or just the second trial? If it is the expectation of the rest of all trials why its probability is $1-\frac{1}{100}$? It seems comprehensible that the expectation is $E[N]+1$ because the first trial is fixed and the expectation for the rest is the same as that for the whole trials.

If it is also for the first trial(learned from the aforementioned answer as he/she stated that, quote: "$ X= 1\cdot[\text{H on 1st toss}] + (1+Y)\cdot[\text{T on 1st toss}]$") what is the $(1+E[N])$? I can understand why the probability is $1-\frac{1}{100}$.

Reference: CS109: Probability for Computer Scientists

2

There are 2 best solutions below

3
On BEST ANSWER

The Iverson Braket notation has value $1$ when the indicated condition is true, and $0$ otherwise.

By the Law of Total Expectation, we may partition the outcome space on the values of the first sample $X_1$: $$\begin{align}\mathsf E(X)&=\mathsf E(X\cdot \mathsf [X_1{=}1\mathsf ])+\mathsf E(X\cdot\mathsf [X_1{=}0\mathsf ])\tag 1\\[1ex]&=\mathsf P(X_1{=}1)\cdot\mathsf E(X\mid X_1{=}1)+\mathsf P(X_1{=}0)\cdot\mathsf E(X\mid X_1{=}0)\tag 2\\[1ex]&=\tfrac 1{100}\cdot 1+\tfrac {99}{100}\cdot(1+\mathsf E(X))\tag 3\\[2ex]100\mathsf E(X)&=1+99+99\mathsf E(X)\tag 4\\[2ex]\mathsf E(X)&=100\tag 5\end{align}$$

Reasoning:

  • Under the condition that $X_1=1$ then we count the first trial and stop there. $$\mathsf E(X\mid X_1{=}1)=1$$
  • Under the condition that $X_1=0$ then we count the first trial and continue counting until the terminating sample.   However, the expected value of this continuation is $\mathsf E(X)$, as this is the expected count of an indefinite sequence of Bernouli events with success rate $1/100$. $$\mathsf E(X\mid X_1{=}0)=1+\mathsf E(X)$$
2
On

Either you get a $1$ the first time with probability $\frac1{100}$, taking just one attempt, or you get a $0$ the first time with probability $1-\frac1{100}$ and then start over again, taking one attempt plus the number of attempts you would expect when restarting (this latter value being the same as the expected number when originally starting)

So to find the expected number of attempts you have $$\mathbb E[N] = \frac1{100} \times 1 + \left(1-\frac{1}{100}\right)\left(1 + \mathbb E[N]\right)$$ and rearranging this gives $\mathbb E[N]-\frac{99}{100}\mathbb E[N]= \frac{1}{100}+\frac{99}{100}$, i.e. $\frac{1}{100}\mathbb E[N]= 1$ and so $\mathbb E[N]= 100$

In effect, you are using the law of total expectation by considering what happens on the first attempt