# Expected value and negative binomial distribution

## Main Question or Discussion Point

Hello,

Can someone please tell me whether I can use negative binomial distribution for this question.

"If there are 3 types of books in a bookstore and each book has an equal probability of being bought. What is the expected number of purchases to get all 3 books?"

Using negative negative binomial, i get E(Y)=3/(1/3)=9. Is it just supposed to be this or is there something else to a question like this?

Any help would be great.

Related Set Theory, Logic, Probability, Statistics News on Phys.org
The expected number of purchases is
3 * (1 + 1/2 + 1/3) = 5.5

Hi Rogerio,

Thanks for replying. My intuitive initially gave me something similar to that.

Like P(getting first wanted book) = 1
P(getting second wanted book) = 2/3 <-- why is it 1/2??
P(getting third wanted book) = 1/3

But I didn't really get why binomial process was used instead of geometric or negative binomial. We do not know what the nth trial is, yet we can determine the probability of each purchase.

Thanks again.

I tried to see this from the standpoint of binominal problem with a probable outcome.

If we look at (a+b+c)^3, we will have 27 terms and the factor we want to look at in this trinominal is abc, with coefficient, $$\frac{3!}{1!1!1!} = 6$$. Since there are 27 terms in this expansion, the probability of all three books is 6/27 = 2/9 = 22%.

For 4, I look at (a+b+c)^4 giving abc(a+b+c), with a factor of $$\frac{4!}{1!1!2!} = 12,$$ giving a probability of 36/81 = 9/27 = 44%.

Thus we need five selections to get the probability above 50%, and is actually 150/243 = 50/81 = 62%.

Last edited:
Well, I'm gonna try to explain my approach...

Suppose in the begining there was N different types of book in a bookstore, and, at your library, you had N vacant positions (each one corresponding to a different type of book).
And then, after some random purchases, there are V vacant positions yet.

So, at this point, for each N random books you buy, you get V matches. In other words, you have to buy N/V books to fill one vacant position more.
So, N/V is the expected number of books you have to buy in order to fill one position, when there are V vacant positions.
Of course, after that, there will be V-1 vacant positions, and so on.

Then, when there are 3 different types of books, you will have to buy 3/3 books to fill one position, then you will buy 3/2 books to fill one position more, and then you will buy 3/1 books to fill the last vacant position.

So, the expected number of books is 3/3 + 3/2 + 3/1 = 5.5 But this is a question of probability. It is entirely possible that we will fill only one position after three books, or even 10 books. For 10 it would be (1/3)^9 that we continue to hit the same position as the first and not another one, unlikely but not impossible.

We have no certainity here. Cases will occur after 5 books that we have not filled three positions.

2RIP: Using negative negative binomial, i get E(Y)=3/(1/3)=9. Is it just supposed to be this or is there something else to a question like this?

Well, if that was actually applicable. you forgot to multiply by the chance of failure, which assumedly is 2/3, if the success rate is 1/3. You would get 3(2/3)/1/3 = 6.

But, I don't think it is applicable, since the probability of success must be constant from one trial to another. But we have a situation with three different objects, in which, we might figure, the first case is p=1, in the second case it is 2/3, and the third is 1/3. This gives probability of 2/9 of succeeding in three trials, a result I already have shown.

The formula: $$\frac{n*p}{1-p}$$ would make sense if the problem was that orders coming to the store are 1/3 for books and 2/3 for other things. Then the formula would be $$\frac{3*1/3}{2/3} =6$$, which would be the number of failures before 3 successes. So that it would take 9 orders before we could expect to sell three books.

Last edited:
But this is a question of probability. It is entirely possible that we will fill only one position after three books, or even 10 books.
...
The question is about "expected value".
In this problem, the answer is the same as:
[Prob to get the 3 books with 3 purchases] * 3 + [Prob to get them with 4 purchases] * 4 + ...etc

Of course, you can think of it as the average number of purchases to get all the 3 books.
The next step is to realize that this average is the same as the sum of the averages to fill each one of the free positions.

When all the 3 positions are free, of course 1 is the average number of purchases to fill one position.
When there are only 2 free positions, then the average number of purchases to fill one position is 3/2.
And when there are only 1 free position, the average number of purchases to fill one position (the last one) is 3.

The sum is 5.5.
The expected number of purchases to get all 3 types of books is 5.5. 2RIP:
Like P(getting first wanted book) = 1
P(getting second wanted book) = 2/3 <-- why is it 1/2??
P(getting third wanted book) = 1/3

Rogerio: Then, when there are 3 different types of books, you will have to buy 3/3 books to fill one position, then you will buy 3/2 books to fill one position more, and then you will buy 3/1 books to fill the last vacant position.
So, the expected number of books is 3/3 + 3/2 + 3/1 = 5.5

If the first is 1*1, then the second should be 1*2/3 and the third 1*1/3 = gives 2. Isn't that how expectation is handled? Probability is always 1 or less. Using 1/2 for the second case, would suggest that the last case was again just 1.

Last edited:
Rogerio: ...
So, the expected number of books is 3/3 + 3/2 + 3/1 = 5.5

Robert:
If the first is 1*1, then the second should be 1*2/3 and the third 1*1/3 = gives 2. Isn't that how expectation is handled?
No, it is not.

Well, I hope each step below is almost intuitive. If not, I'll try find an other way to explain that.

Initially, we can say "In the average, for each 3 purchases, we get 3 books ok".
So, the expected number of purchases to get 1 book is exactly 1 purchase.

Then, we have 2 free positions.
Of course, in the average, for each 3 books we buy, we get 2 books ok.
So, the expected number of purchases to get just 1 book ok is exactly 3/2 books.

Finally, we have only one free position.
Of course, in the average, for each 3 books we buy, we get only 1 book ok.
So, the expected number of purchases to get 1 book ok is exactly 3 books.

The total number of purchases is...5.5. I looked at that problem with the TI-86, and used the random number function getting strings of numbers ranging from 1 to 3. Then I checked the string and found out how many places were necessary to get all three numbers. This was a very amateurish thing, and I checked out 60 cases. I arrived at 39 cases out of 60 that were in five places or less, giving 39/60=65%, which was close to the 62% I calculated.

As for the average value, the length of the string, I got the result of 330/60 = 5.5. So there must be something in this answer. (Of course, a good programmer could have gone and done this same thing for 1000 or more cases.)

Last edited:
And so, the most probable value has nothing to do with the expected value...
See this example:

Suppose you had gotten 54 cases out 60 with exactly 5 places (90% of cases), and only 6 cases out 60 with exactly 55 places.
Of course, the most probable value would be 5 places.
However, the expected value would be 10 places.

Well, as you've already convinced yourself that 5.5 is the right answer, I suggest you read again the post #10, where I tried to explain that in a very intuitive way. 