What Is the Average Number of Plays Before a Track Repeats?

  • Thread starter Zurtex
  • Start date
  • Tags
    Average
In summary, the conversation discusses a probability problem involving the average number of tracks before the first repeat occurs. The speakers provide different approaches to solving the problem, including using basic rules of probability and mathematical approximations. They also discuss the expected value of the problem and its asymptotic behavior as the number of tracks increases.
  • #1
Zurtex
Science Advisor
Homework Helper
1,120
1
Knowing I did mathematics my room mate posed me a question yesterday, he wanted to know given a number of tracks randomly played what is the average of a track being first repeated. He'd already written a program in Perl to solve this problem by brute calculation but was coming up with some very odd answers, he later discovered the random function wasn't very good.

Now, I was some what rusty on my probability skills and had to take this away to think about it. This did and still does sound like a very doable problem. This is how I started out:

Let X be the track number where the first repeat is, where the initial track played is track 0. Let x1 be the event where X=1, x2 be the event where X=2 etc.. To start off easy, let there be 3 tracks, then:

[tex]P(x_1) = \frac{1}{3}[/tex]

It follows then that:

[tex]P(x_2 | {x_1}') = \frac{2}{3}[/tex]

(In words, the probability of x2 occurring given that x1 has not occurred is 2/3). It therefore follows from some basic rules of probability:

[tex]\frac{P({x_1}' \cap x_2)}{P({x_1}')} = \frac{2}{3}[/tex]

I then drew a little diagram to show that x2 was a subset of x1'. And therefore:

[tex]P(x_2) = \frac{4}{9}[/tex]

I then worked out the probability of x3 the long way to make sure I was doing everything right, by saying that:

[tex]P(x_3|({x_2}' \cap {x_1}')) = 1[/tex]

After expanding and reducing this nicely led to:

[tex]P(x_3) = \frac{2}{9}[/tex].

This gave a nice expectation of x as:

[tex]E(x) = \frac{17}{9}[/tex]

I then set out looking at n tracks, which was pretty much the same:

[tex]P(x_1) = \frac{1}{n}[/tex]

[tex]P(x_2 | {x_1}') = \frac{2}{n}[/tex]

Which led to:

[tex]P(x_2) = \frac{2}{n} - \frac{2}{n^2}[/tex]

I also worked out:

[tex]P(x_i | ( {x_{i-1}}' \cap \ldots \cap {x_1}')) = \frac{P(x_i)}{P({x_{i-1}}' \cap \ldots \cap {x_1}')}[/tex]

Which leads to:

[tex]P(x_i) = \frac{i}{n} \left(1 - \sum_{r=1}^{i-1} (P(x_r)) \right) \quad \text{with} \quad P(x_1) = \frac{1}{n}[/tex]

This is far too complicated for me to deal with, so I attempted to put into mathematica and it doesn't seem to be able to make anymore out of it that I can either. I feel I am going wrong somewhere because this doesn't seem like too difficult of a problem.
 
Physics news on Phys.org
  • #2
It looks like

[tex]P(x_i)=\frac{i}{n}\prod_{j=0}^{i-1}\frac{n-j}{n}=i\frac{n!}{n^{i+1}(n-i)!}[/tex]

offhand I can't see a nice expression for the expected value, but you can find it easily enough for a given n.
 
  • #3
This sounds like the Birthday Problem.

The general rule of thumb is that out of N choices, it takes on the order of [itex]\sqrt{N}[/itex] picks to get a repeat. (Actually, one ought to multiply that by something to get a better estimate... probably something like [itex]\sqrt{2}[/itex], but I can't remember for sure)


The analysis on the Wikipedia page says the probability of getting no repeats after K picks is about:

[tex]
\bar{P}(K) = e^{-\frac{K^2}{2 N}}
[/tex]


You're asking for the expected number of picks before getting a repeat. In other words:

[tex]
\sum_{k = 1}^{N} k \bar{P}(k-1) \frac{k}{N}
[/tex]

because the odds that the first repeat happens at pick k is the product of the odds of no repeats by the (k-1)-th pick and the odds that the k-th pick is one of those previously chosen.

Well, I can do another approximation by pretending this is an integral and not a sum, and goes from 0 to infinity:

[tex]
E \approx \int_0^{+\infty} \frac{1}{N} k^2 e^{-\frac{K^2}{2 N}} \, dx
[/tex]

if I've done my integration by parts and substitutions correctly, this yields:

[tex]
E \approx \sqrt{2N} \int_0^{+\infty} e^{-x^2} \, dx = \sqrt{\frac{N \pi}{2}}
[/tex]
 
Last edited:
  • #4
Cool, that's very nice, I did a little work from what shmoe gave me and got an exact expectation, which is given n tracks then:

[tex]E(x) = -1 + n e^n \text{ExpIntegralE}[-n,n][/tex]

Which if you look at definitions and stuff isn't too far out from your approximation.
 
  • #5
As n goes to infinity, that's asymptotic to what Hurkyl provided.

That's quite a lot of approximations in Hurkyl's post! the sums to integrals are fine, the integrand is increasing up to sqrt(2N) and decreasing thereafter with a max of 2/e at sqrt(2N), so this will be off by a constant at most.

What seems harder to justify is replacing the exact probability with [tex]\bar{P}(K)[/tex], which is a terrible approximation when K is close to N. However, it's an upper bound for the true probability (1+x<e^x) and it drops of very quickly, so the main contribution for the expected value sum will come from something like the first [tex]N^{1/2+\epsilon}[/tex] terms. This should handily show that the expected value sum in this range is asymptotic to the approximation.
 
  • #6
Ack, you don't want me to do some real work, do you? :uhh:
 
  • #7
Let us find the fraction of the number line(from 0 to 1) that will be filled:
Now we will find E(1) which is nothing but the expected fraction of the line(x=0 to x=1) given that each filling width is a small h
(h=1/N)
E(1)=h+E(1-h)
E(1-h)=(1-h){h+E(1-2h)}
and so on
hence we get
E(1)=h{1+(1-h)+(1-h)(1-2h)+.,,}
Now since h is very small we can make (1-kh)->exp(-kh)
So the nth term->(exp(-(n^2+n)/2)->exp(-hn^2/2)
so the sum can be approxuimated to the integral
Note that kh<<1
Hence
[tex]\int_{0}^{\infty} e^{-\frac{hx^2}{2}}dx=\sqrt{\frac{\pi h}{2}}[/tex]
The above is wrt to 0 to 1
So if we scale it up to N and noting that h=1/N since
[tex]\sqrt{\frac{\pi N}{2}}[/tex]
 

1. What is the average number of tracks on an album?

The average number of tracks on an album varies depending on the genre and the artist. However, a standard album usually contains around 10-12 tracks.

2. Does the average number of tracks on an album affect its success?

The success of an album is not solely determined by the number of tracks, but it can play a role in its overall reception. Some artists may choose to release longer albums with more tracks, while others may opt for shorter, more concise albums. Ultimately, the quality of the music is what determines an album's success.

3. Are albums with more tracks better than albums with fewer tracks?

The number of tracks on an album does not necessarily determine its quality. Some albums with fewer tracks may be considered masterpieces, while others with more tracks may not be as well-received. It ultimately depends on the individual album and the preferences of the listener.

4. Does the average number of tracks on an album differ across music streaming platforms?

The average number of tracks on an album may vary slightly across different music streaming platforms, as some may have exclusive tracks or bonus songs that are not included on other platforms. However, the overall average number of tracks on an album remains relatively consistent.

5. How does the average number of tracks on an album compare to previous years?

The average number of tracks on an album has decreased in recent years due to the rise of digital music and streaming services. In the past, physical albums often had more tracks as artists had more space to work with. However, with the shift to digital, artists have more flexibility and may choose to release shorter albums with fewer tracks.

Similar threads

  • Precalculus Mathematics Homework Help
Replies
10
Views
2K
  • Precalculus Mathematics Homework Help
Replies
14
Views
1K
  • Precalculus Mathematics Homework Help
Replies
5
Views
1K
  • Precalculus Mathematics Homework Help
Replies
4
Views
753
Replies
3
Views
709
  • Precalculus Mathematics Homework Help
Replies
32
Views
817
  • Precalculus Mathematics Homework Help
Replies
5
Views
477
  • Precalculus Mathematics Homework Help
Replies
1
Views
493
  • Precalculus Mathematics Homework Help
2
Replies
53
Views
5K
  • Precalculus Mathematics Homework Help
Replies
21
Views
1K
Back
Top