# Thread: Expectation for a Simple Problem

1. ## Expectation for a Simple Problem

Hello Everyone!

Suppose you have 6000 songs on your playlist, each of these songs have an equal probability of being played next (I assume even the song that is currently played).
How many songs are expected to play before the song you're listening to now repeats?

I thought of it in this way:
Let $\displaystyle A$ be the event: Current songs replays itself, and $\displaystyle B$ be the event that a new song plays.
Obiously, $\displaystyle A$ and $\displaystyle B$ are independent therefore $\displaystyle P(B) = 1 - P(A)$.
$\displaystyle P(A) = \frac{1}{6000}$ and $\displaystyle P(B) = \frac{5999}{6000}$.
It follows that $\displaystyle E(X) = P(A) + 5999\times P(B) = \frac{1}{6000}+5999\times \frac{5999}{6000} = 5998$ songs.

Is this approach correct?

Thanks!

2. If we indicate with n the number of songs, the probability that a song is replied in k 'trials' is $\displaystyle P_{k,n} = \frac{1}{n}\ (1-\frac{1}{n})^{k-1}$, so that the requested expected value is...

$\displaystyle \displaystyle E(k)= \sum_{k=0}^{\infty} \frac{k}{n}\ (1-\frac{1}{n})^{k-1}$ (1)

Kind regards

$\displaystyle \chi$ $\displaystyle \sigma$

3. How to compute the series of the previous post?... let's start remebering that for $\displaystyle |x|<1$ is...

$\displaystyle \displaystyle \sum_{k=0}^{\infty} x^{k}= \frac{1}{1-x}$ (1)

... and deriving both terms we have...

$\displaystyle \displaystyle \sum_{k=0}^{\infty} k\ x^{k-1}= \frac{1}{(1-x)^{2}}$ (2)

Setting $\displaystyle x= 1-\frac{1}{n}$ in the formula for $\displaystyle E(k)$ we have drived we obtain...

$\displaystyle \displaystyle E(k)= \frac{1}{n}\ \sum_{k=0}^{\infty} k\ (1-\frac{1}{n})^{k-1} = \frac{1}{n}\ \frac{1}{(1-1+\frac{1}{n})^{2}} = n$ (3)

... and that is not a surprise!...

Kind regards

$\displaystyle \chi$ $\displaystyle \sigma$

4. ## Let me get this staright

So you mean I'm set to listen 6000 songs before I get to listen the song I am listening to right now?

Thanks