Average number of draws

Debsta

MHF Helper
Oct 2009
1,343
620
Brisbane
Can someone help me with this please? It sounds simple but I can't get my head around it.

If you have a bag of 2 marbles A and B. You choose one marble randomly. If it is A, you stop. If it is not A, you put the marble back in the bag and try again until you get A. What is the average number of draws you need to make until you draw marble A?

I'm fairly sure the prob distribution is P(X=n) is \(\displaystyle (0.5)^n\) where X is the number of draws until an A is drawn. I thought it would be \(\displaystyle \int_1^\inf n*(0.5)^n dn\). This is 1.76 approx. Is that correct?
 

romsek

MHF Helper
Nov 2013
6,725
3,030
California
why use an integral? draws are discrete.

I get

$p = (0.5)\sum \limits_{k=1}^\infty (0.5)^{k-1} = \dfrac{1/2}{1-1/2} = 1$
 

Debsta

MHF Helper
Oct 2009
1,343
620
Brisbane
Yeah I realise the number of draws is discrete. But your answer of 1 can't be correct. That's saying that on average you need to draw only once to get marble A ??

I think it is 1*(0.5)^1 + 2*(0.5)^2 + 3*(0.5)^3 + .... ie \(\displaystyle \sum\limits_{n=1}^{\infty} n*(0.5)^n\).
 

Debsta

MHF Helper
Oct 2009
1,343
620
Brisbane
1578624649649.png courtesy of Wolfram alpha.

So the average number of draws you have to make to draw marble A out of a bag (under the conditions in post#1) is 2. Sound reasonable?
 

Debsta

MHF Helper
Oct 2009
1,343
620
Brisbane
Ok, so I think I have answered my own question.

Now, the initial problem I was trying to solve, is what is the average number of draws you have to make to get marble A out of a bag of 100 (with replacement if you don't get A)?

(I simplified the problem above to 2 marbles to establish a method - a good tip for problem-solving!)

Pr(1 draw) = \(\displaystyle \frac{1}{100}\)
Pr(2 draws) = \(\displaystyle \frac{99}{100} * \frac{1}{100}\)
Pr(3 draws) = \(\displaystyle (\frac{99}{100})^2 * \frac{1}{100}\)

Pr(n draws) = \(\displaystyle (\frac{99}{100})^{n-1} * \frac{1}{100}\)

So average number of draws = \(\displaystyle \sum\limits_{n=1}^{infty}n*(0.99)^{n-1}*0.01\)

Wolfram Alpha says:

1578625482611.png
So, on average, you'd have to take 100 draws before you get marble A.

And if there are n marbles in the bag, then the average number of draws would be n.

Intuitively, I thought it would be less. I can visualise the distributions and sort of see why. Is this really a simple concept that I am overthinking?? Any thoughts would be appreciated.
 

romsek

MHF Helper
Nov 2013
6,725
3,030
California
Yeah I realise the number of draws is discrete. But your answer of 1 can't be correct. That's saying that on average you need to draw only once to get marble A ??

I think it is 1*(0.5)^1 + 2*(0.5)^2 + 3*(0.5)^3 + .... ie \(\displaystyle \sum\limits_{n=1}^{\infty} n*(0.5)^n\).
jeeze... must have just woken up from a nap.. sorry.
yes.. the distribution sums to 1.

the expectation is

$0.5 \sum \limits_{k=1}^\infty k (0.5)^{k-1} = 2$

which you found.
 
  • Like
Reactions: Debsta

romsek

MHF Helper
Nov 2013
6,725
3,030
California
Ok, so I think I have answered my own question.

Now, the initial problem I was trying to solve, is what is the average number of draws you have to make to get marble A out of a bag of 100 (with replacement if you don't get A)?

(I simplified the problem above to 2 marbles to establish a method - a good tip for problem-solving!)

Pr(1 draw) = \(\displaystyle \frac{1}{100}\)
Pr(2 draws) = \(\displaystyle \frac{99}{100} * \frac{1}{100}\)
Pr(3 draws) = \(\displaystyle (\frac{99}{100})^2 * \frac{1}{100}\)

Pr(n draws) = \(\displaystyle (\frac{99}{100})^{n-1} * \frac{1}{100}\)

So average number of draws = \(\displaystyle \sum\limits_{n=1}^{infty}n*(0.99)^{n-1}*0.01\)

Wolfram Alpha says:

View attachment 39714
So, on average, you'd have to take 100 draws before you get marble A.

And if there are n marbles in the bag, then the average number of draws would be n.

Intuitively, I thought it would be less. I can visualise the distributions and sort of see why. Is this really a simple concept that I am overthinking?? Any thoughts would be appreciated.
that all looks correct.
 

Debsta

MHF Helper
Oct 2009
1,343
620
Brisbane
Thanks romsek. I can see now that using integration (ie assuming continuous variable) underestimates the average because of the shape of the curve.
 

Plato

MHF Helper
Aug 2006
22,490
8,653
View attachment 39712 courtesy of Wolfram alpha.
So the average number of draws you have to make to draw marble A out of a bag (under the conditions in post#1) is 2. Sound reasonable?
It is reasonable because it is correct.
This is a well-known result \(\displaystyle \sum\limits_{k = 1}^\infty {k{x^k}} = \frac{x}{{{{\left( {1 - x} \right)}^2}}},\;\left| x \right| < 1\)
 
  • Like
Reactions: Debsta