0

Michael plays a random song on his iPod. He has $2,781$ songs, but only one favorite song. Let X be the number of songs he has to play on shuffle (songs can be played more than once) in order to hear his favorite song.

a) find $E(X)$

b) find $E(X^2)$

a is easy, just use $1/p$ where $p = 1/2781$ to find that $E(X)= 2781$

What I struggle with is b)

What is the formula for $E(X^2)$ for a geometric distribution?

Is it simply $E(X^2) = \cfrac{1}{p^2}$?

This doesn't seem right to me, but I can't find anything in my book that would give me $E(X^2)$, can someone show me what the formula is for $E(X^2)$ for a geometric distribution and the derivation if possible?

2 Answers2

1

$$V(X)=E(X^2)-E^2(X)$$

thus

$$E(X^2)=V(X)+E^2(X)$$


If you do not know the variance's formula you have to calculate $E(X^2)$ with its definition

$$E(X^2)=\Sigma_x x^2pq^{x-1}=\Sigma_x [x(x-1)+x]pq^{x-1}=\Sigma_x x(x-1)pq^{x-1}+E(X)=\dots=\frac{2q}{p^2}+\frac{1}{p}$$

where $q=1-p$

the proofs of the involved series are not difficult so I leave you this as an exercise

tommik
  • 32,733
  • 4
  • 15
  • 34
  • 1
    Why would he know the variance of the geometric distribution if he dosent know the expectation of $X^2$ ? – FreeZe Jan 05 '21 at 23:44
  • @FreeZe: the O.P. stated he know the mean... thus I supposed he knew the variance too (mean and variance are usually known indicators of a known law). On the countrary it is not difficult to prove $E(X)$ and $E(X^2)$ formulas – tommik Jan 05 '21 at 23:46
  • In order to calculate to variance you have to know how to calculate expectation of $ X^2 $, so even if its a well known result, I dont think its legit to use it in order to calculate the expactation of $ X^2$, kind of periodic argument. – FreeZe Jan 05 '21 at 23:49
  • @tommik I am confused in one thing that there is one more version of the geometric distribution that is $q^xp; x=0,1,2,3$ Why can't we use that here? $E(X)=\frac{q}{p}$ – Daman Jan 06 '21 at 00:02
  • @Daman : my answer supposed $x=1,2,3,...$ because the O.P. stated that $E(X)=1/p$. Reading the given text it is coherent....number of trials before the first success ("number of songs", and not "numbers of failures") – tommik Jan 06 '21 at 00:03
  • @tommik That's where my confusion is. How do we know which version is right? – Daman Jan 06 '21 at 00:05
  • 1
    @Daman : the given text said "number of songs in order to find your favourite one" – tommik Jan 06 '21 at 00:06
0

A common trick is to use the variance to back out $E(X^2)$ as follows: $$Var(X)=E(X^2)-(E(X))^2 \iff$$ $$E(X^2)=Var(X)+(E(X))^2$$

For a random variable $X$ that follows a geometric distribution, we have mean $E(X)=\frac{1}{p}$ and $Var(X)=\frac{1-p}{p^2}$ for some success probability p. Hence, $$E(X^2)=\frac{1-p}{p^2}+(\frac{1}{p})^2=\frac{2-p}{p^2}$$