# Finding Conditional Expectation and Distribution of Shuffled Songs

You have a playlist of $$N$$ songs. You listen to $$K$$ songs on shuffle (as the playlist shuffles, it selects a song out of the $$N$$ with replacement).

While listening, you observe that you listened to exactly $$a$$ of the $$N$$ songs exactly $$b$$ times. Given $$a$$ and $$b$$, what are the expected values of $$N$$ and $$K$$? Further, what are the conditional distributions of $$N$$ and $$K$$ given $$a$$ and $$b$$?

For example, you could have 5 songs (1,2,3,4,5). You listen to 10 on shuffle. One possible sequence is:

1,2,3,2,3,4,5,5,5,1

This sequence consists of 3 songs being listened to twice (1,2,3), one song being listened to once (4), and one song being listened to thrice (5). You would be given one of the aforementioned three pieces of information (eg, exactly 3 songs were repeated exactly 2 times), and need to determine an expected value of the original number of songs and shuffles given that information, as well as the conditional distributions of those values. Bonus points if someone could figure out how to do it if you're given multiple pieces of information (eg, exactly 3 songs repeated exactly 2 times, exactly 1 song repeated exactly 3 times)!

• This isn't a "Do all my homework for me" site. Please show what you have tried and indicate exactly where are you having trouble. – Graham Kemp May 17 at 4:08
• In order to answer this, $N$ and $K$ need to be random quantities. What are the prior distributions on $N$ and $K$? – Mike Earnest May 17 at 5:23