0

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

  • 1
    In the linked answer, the Iverson brackets are really just a different way to notate the more conventional indicator variables. – amd Jun 03 '19 at 23:56

2 Answers2

2

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

Henry
  • 169,616
  • Great! Thanks! Just to verify, does $1$ in $1+E[N]$ stand for the first attempt where I got a $0$? The law of total expectation is really what I was missing! – Lerner Zhang Jun 04 '19 at 00:14
  • @LernerZhang Yes - the $1$ comes from the first attempt – Henry Jun 04 '19 at 01:11
1

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)$$
Graham Kemp
  • 133,231
  • -.- … Yes. Yes it should. Thank you. – Graham Kemp Jun 04 '19 at 22:50
  • I wonder if I can apply it to other expectations? For instance, binomial distribution... – Lerner Zhang Jun 04 '19 at 23:56
  • 1
    A binomially distributed random variable is a count of successes among a fixed amount ($n$) of independent Bernoulli trials with identical success rate ($p$). So if we let $(X_k)$ be the sequence of indicators for success in each trial, then by the Linearity of Expectation: $$\begin{align}\mathsf E(\sum_{k=1}^n X_k) ~&=~ n\mathsf E(X_1)\[1ex] &=~n~p\end{align}$$ So, yes, you evidently can use similar reasoning for other expectations. – Graham Kemp Jun 05 '19 at 00:48