1

I am following the book "Introduction to probability" from Bertsekas.

In the book the derivation of the mean of Geometric random variable is through the use of the Total expecation theorem which involves conditional expectation.

enter image description here

My problem is when I try to derive $E[X]$ I end up getting $E[X] = E[X]$ instead of $E[X] = \frac{1}{p}$

I am going to try to derive the mean. Please highlight where I may be wrong. I am still new to probability so please highlight any small mistakes as well.

$E[X] = \sum_{k=1}^\infty ( P(k) \times E[X | k]) = P(k = 1) \times E[X | k = 1] + P(k > 1) \times E[X | k > 1]$

$P(k = 1) = p$

$P(k > 1) = 1 - p$ using sum of infinite geometric series formula

enter image description here

$E[X | k = 1] = 1 \times P(X | k = 1) = \frac{P(X \cap k = 1)}{P(k = 1)} = \frac{p}{p} = 1 $

The trouble is when I try to find $E[X | k > 1]$

enter image description here

$E[X | k > 1] = \sum_{k=2}^\infty ( k \times (P[X | k > 1]) $

$E[X | k > 1] = \sum_{k=2}^\infty ( k \times \frac{P(X \cap k > 1)}{P(k > 1)})$

$E[X | k > 1] = \sum_{k=2}^\infty ( k \times \frac{P(X \cap k > 1)}{(1-p)})$

$P(X \cap k > 1) = \sum_{k=2}^\infty ((1-p)^{k-1} \times p)$

I suspect the problem to be in the following line

$E[X | k > 1] = \frac{1}{(1-p)}\sum_{k=2}^\infty ( k \times \sum_{k=2}^\infty ((1-p)^{k-1} \times p)$

$E[X] = \sum_{k=1}^\infty ( k \times (1-p)^{k-1} \times p $

$E[X] = p + \sum_{k=2}^\infty ( k \times (1-p)^{k-1} \times p $

$\sum_{k=2}^\infty ( k \times (1-p)^{k-1} \times p = E[X] - p $

$E[X | k > 1] = \frac{E[X] - p}{1 - p}$

finally using the total expectation theorem

$E[X] = P(k = 1) \times E[X | k = 1] + P(k > 1) \times E[X | k > 1]$

$E[X] = p \times 1 + (1 - p) \times \frac{E[X] - p}{1 - p}$

$E[X] = E[X]$ ?? what is the meaning of this?

Thanks.

StubbornAtom
  • 17,052

4 Answers4

4

Let $S$ denote the event that the first attempt is successful. Then we can write:$$\mathbb EX=P(S)\mathbb E[X\mid S]+P\left(S^{\complement}\right)\mathbb E\left[X\mid S^{\complement}\right]=p\mathbb E[X\mid S]+(1-p)\mathbb E\left[X\mid S^{\complement}\right]\tag1$$

Now realize that $\mathbb E[X\mid S]=1$ (i.e. under the condition of a successful first attempt the expectation of the number of attempts needed equals $1$).

Further realize that $\mathbb E\left[X\mid S^{\complement}\right]=1+\mathbb EX$ (under condition of a first failing attempt we have one failure in our pocket and just start over again).

Substituting in $(1)$ we get:$$\mathbb EX=p+(1-p)(1+\mathbb EX)$$

This is an equality in $\mathbb EX$ that can easily be solved, leading to:$$\mathbb EX=\frac1p$$

With this method we find the expectation on an elegant way and only using the "character" of geometric distribution.


Observe that the first equality of $(1)$ can also be written as:$$\mathbb EX=P(X=1)\mathbb E[X\mid X=1]+P(X>1)\mathbb E\left[X\mid X>1\right]$$

which has resemblance with the first lines in your effort.

Your notation is IMV confusing.

Is $k$ an index (as notation $\sum_{k=1}^{\infty}\dots$ suggests) or is it a random variable (as notation $P(k=1)$ suggests)?...


edit (meant as confirmation of $\mathbb E[X\mid X>1]=1+\mathbb EX$)

$$\begin{aligned}\mathbb{E}\left[X\mid X>1\right] & =\sum_{k=2}^{\infty}kP\left(X=k\mid X>1\right)\\ & =\sum_{k=2}^{\infty}k\frac{P\left(X=k\text{ and }X>1\right)}{P\left(X>1\right)}\\ & =\sum_{k=2}^{\infty}k\frac{P\left(X=k\right)}{P\left(X>1\right)}\\ & =\sum_{k=2}^{\infty}k\frac{P\left(X=k\right)}{1-P\left(X=1\right)}\\ & =\sum_{k=2}^{\infty}k\frac{P\left(X=k\right)}{1-p}\\ & =\sum_{k=2}^{\infty}k\left(1-p\right)^{k-2}p\\ & =\sum_{k=1}^{\infty}\left(1+k\right)\left(1-p\right)^{k-1}p\\ & =\sum_{k=1}^{\infty}\left(1-p\right)^{k-1}p+\sum_{k=1}^{\infty}k\left(1-p\right)^{k-1}p\\ & =1+\mathbb{E}X \end{aligned} $$

drhab
  • 151,093
  • $k$ is equivalent to the small $x$ which is a value of the random variable $X$. – Jose_Peeterson Jun 02 '20 at 02:22
  • Hi drhab, bedankt voor je antwoord. :) I do not understand this "Further realize that $E[X∣S∁]=1+EX$ (under condition of a first failing attempt we have one failure in our pocket and just start over again)." This book also gives this reasoning. – Jose_Peeterson Jun 02 '20 at 02:53
  • I have tried to derive $E[X|k>1]$ as follows $E[X | k > 1] = 1 \times P(x | k=1) + \sum_{k=2}^\infty k \times \frac{(1-p)^{k-1} \times p}{1-p}$

    Then according to you $ \sum_{k=2}^\infty k \times \frac{(1-p)^{k-1} \times p}{1-p}$ is equal to E[X], correct? I think it is slightly off..

    – Jose_Peeterson Jun 02 '20 at 02:55
  • The thing that you do not understand is the essential part of this approach and is hard to make clear to someone who does not grasp it. Suppose there are two guys A,B both intending to throw a die until the first 4 appears. Guy A starts with it and the number of throws needed has expectation $6$. Guy B has already thrown exactly once and this was not a 4. Then the expectaction for the number of throws needed by B equals $1+6=7$. Agreed? – drhab Jun 02 '20 at 09:22
  • ...Now you start throwing a die with the same intention. If your first throw is a failure (i.e. not a 4) then you land in the position of guy B. Agreed? That can be expressed as $\mathbb E[X\mid S^{\complement}]=1+\mathbb EX=1+6=7$ where $X$ denotes the number of throws you need. Do you understand? – drhab Jun 02 '20 at 09:23
  • That means if you fail 5 times then the $E[X|k>5]$ becomes 5 + 6? Every new attempt resets back to starting from 1st roll. – Jose_Peeterson Jun 02 '20 at 14:54
  • If you see my comment above $E[X | k > 1] = 1 \times P(x | k=1) + \sum_{k=2}^\infty k \times \frac{(1-p)^{k-1} \times p}{1-p}$ (formula in summation does NOT equal $E[X]$. there is an error solved below.)

    The expected value equals the below using conditional probability. $\sum_{k=2}^\infty (k-1) \times \frac{(1-p)^{k-1} \times p}{1-p}$

    I do not understand why in the above equation I need to use $k-1$ and not $k$. maybe this is the reset part as summation starts from 2 we need to do $k-1$?

    – Jose_Peeterson Jun 02 '20 at 15:07
  • I have added to my answer a deduction of $\mathbb E[X\mid X>1]=1+\mathbb EX$. Can you find yourself where it differs from your try? – drhab Jun 02 '20 at 17:12
  • ok I understand now. There is a mistake in my first comment above from the bottom.

    $E[X | k > 1] \neq 1 \times P(x | k=1) + \sum_{k=2}^\infty k \times \frac{(1-p)^{k-1} \times p}{1-p}$

    It should be $E[X|K>1] = \sum_{k=2}^\infty k \times \frac{(1-p)^{k-1} \times p}{1-p}$

    bedankt voor de afleiding.

    – Jose_Peeterson Jun 03 '20 at 10:34
  • Glad I could help. If your problem has been solved then you can accept one of the answers that has been given. Maak daar een goeie gewoonte van. Cheers. – drhab Jun 03 '20 at 12:22
2

Before looking through your long solution, may I suggest you a simply way.

Remember that, for non negative rv, the mean can also be defined as follows

  • continuous variable

$$\mathbb{E}[X]=\int_0^{\infty}[1-F_X(x)]dx$$

  • in your case (discrete) this become

$$\mathbb{E}[X]=\mathbb{P}[X>x]=\sum_{x=1}^{\infty}(1-p)^{x-1}=\frac{1}{1-(1-p)}=\frac{1}{p}$$

tommik
  • 32,733
  • 4
  • 15
  • 34
  • your braistorming is very complicated but the main error is that at a certain point you substitute $\mathbb{E}[X]$ in the formula without calculatin it....so you arrive to the unusul identity $\mathbb{E}[X]=\mathbb{E}[X]$ – tommik Jun 01 '20 at 06:19
  • Indeed nice (+1) but IMV the solution that the OP is (unsuccesfully) trying to use is even more simple than yours. Further I bet that your soul needs more than that (I looked at your profile). :-) – drhab Jun 01 '20 at 07:41
1

tommik's answer is the most convenient, but if you have not encountered the derivation of an expected value from the so-called survival function ($S(x) = 1-F(x)$) then you can still find the expected value from the more common definition:

$$\mathsf{E}[X] = \sum_{k=1}^\infty kP(X=k) = \sum_{k=1}^\infty k(1-p)^{k-1}p = p\sum_{k=1}^\infty k(1-p)^{k-1} \tag{1}$$

Note here that $$\sum_{k=1}^\infty k(1-p)^{k-1} = -\cfrac{\mathrm d}{\mathrm dp} \sum_{k=1}^\infty(1-p)^k = -\cfrac{\mathrm d}{\mathrm dp} \cfrac{1-p}{1-(1-p)} = -\cfrac{\mathrm d}{\mathrm dp} \left(\cfrac 1p-1\right) = \cfrac{1}{p^2}$$

$$\therefore (1) = \cfrac p{p^2} = \cfrac 1p$$

jeremy909
  • 1,028
  • 6
  • 24
  • 1
    Thanks, this answer is quite understandable. But I don't think a derivative hidden inside was obvious. I will keep this in mind anyhow. :) – Jose_Peeterson Jun 02 '20 at 02:31
  • @PcumP_Ravenclaw Indeed, that is a step that was not obvious to me either, but that's just one way of evaluating that sum. There are others, and in fact they are (in my opinion) more interesting and more intuitive, but this one is short and sweet. – jeremy909 Jun 02 '20 at 02:49
1

Firstly, since $\mathsf P(X=k)=(1-p)^{k-1}p\mathbf 1_{k\in\Bbb N^+}$, therefore $\mathsf P(X=1)= p, \mathsf P(X>1)=1-p$.

Now $\mathsf P(X\mid X=1)=1$ because, $1$ is the expected value of $X$ when $X=1$ .

That leaves $\mathsf E(X\mid X>1)$ which is $1$ failure plus the expected value of the count of trials after the first trial and until the first success of a series of Bernoulli trials with success rate $p$ ~ that later term is a random variable with the same distribution as $X$. So $\mathsf E(X\mid X>1)=1+\mathsf E(X)$

You have $$\begin{align}\mathsf E(X)&=\mathsf P(X=1)~\mathsf E(X\mid X=1)+\mathsf P(X>1)~\mathsf E(X\mid X>1)\\[1ex]&=p+(1-p)(1+\mathsf E(X))\\[2ex](1-(1-p))\mathsf E(X)&=p+1-p\\[3ex]\therefore~~\mathsf E(X)&=1/p\end{align}$$

Graham Kemp
  • 129,094