do my homework

Aug 10, 2001
10,420
2
0
Actually, I just want someone to check my work:

You have a bucket containing n red balls and m black balls. What's the expected number of red balls selected before a black ball is selected?

I let X1, X2, ..., Xn be equal to 1 if red ball "i" is selected before a black ball; 0 otherwise

then the number of red balls selected before a black ball is X = X1+X2+...+Xn

E(Xi) = P(Xi) = 1/(n+m) + (n-1)/(n+m)*1/(n+m-1) + (n-1)/(n+m)*(n-2)/(n+m-1)*1/(n+m-2) + ... + (n-1)/(n+m)*(n-2)/(n+m-2)*(n-3)/(n+m-2)...1/(m+2)*1/(m+1)

then E(X) = E(X1+X2+...+Xn) = E(X1)+E(X2)+E(X3)+...+E(Xn) = nE(Xi)
= n/(n+m) + n/(n+m)*(n-1)/(n+m-1) + ... + n/(n+m)*(n-1)/(n+m-1)*(n-2)/(n+m-1)...1/(m+1)
= sum of nCj/(n+m)Cj from j = 1 to n

I saw this same problem done elsewhere in a different way, but the answer didn't make any sense because it said that if you had 0 black balls, the expected value would be greater than the number of red balls.
 

TuxDave

Lifer
Oct 8, 2002
10,571
3
71
Maybe it's been a while since I worked with probability but I'm not really sure what approach you're using.

If we started off with the basic definition of "expected" then it goes along the lines of:

X = # of red balls chosen before getting a black ball

E(x) "expected value of x" = P(0)*0+P(1)*1+....P(n)*n

And then you work your way into a summation which you can simplify into an equation.
 
Aug 10, 2001
10,420
2
0
What would be the probability of selecting two reds before a black? n/(n+m)*(n-1)/(n+m-1)*m/(n+m-2) or just n/(n+m)*(n-1)/(n+m-1)?
 

IronWing

No Lifer
Jul 20, 2001
72,916
34,056
136
I've been to a number of driving ranges and I have never seen such a thing as described above.


At any rate, empirical evidence trumps maths so just go to a driving range and experiment a bit.
 
Aug 10, 2001
10,420
2
0
Originally posted by: ironwing
I've been to a number of driving ranges and I have never seen such a thing as described above.


At any rate, empirical evidence trumps maths so just go to a driving range and experiment a bit.
The only problem is that you'll have to go through many buckets (maybe a few hundred).

 

QED

Diamond Member
Dec 16, 2005
3,428
3
0
Let P(i) be the odds that exactly i red balls are selected before a black one.

Then P(0) = m / ( n + m).
P(1) = n / (n+m) * m / (n+m-1).
P(2) = n / (n+m) * (n-1)/(n+m-1) * m/(n+m-2)
P(3) = n / (n+m) * (n-1)/(n+m-1) * (n-2)/(n+m-2) * m/(n+m-3)
etc.

In general P(i) = m * ( n! / (n-i)! ) / ( (n+m)! / (n+m-i-1)! ), or
P(i) = m * n!(n+m-i-1)! / ( n-i)!(n+m)!

Now the expecetd value is simply equal to the sum of 0*P(0) + 1 * P(1) + 2*P(2) + ... n *P(n). Note that in each P(i) are the constant factors (m * n! / (n+m)!), so you can pull those out of the sum first and simply sum the variable portions.
 

chuckywang

Lifer
Jan 12, 2004
20,133
1
0
Originally posted by: Random Variable
What would be the probability of selecting two reds before a black? n/(n+m)*(n-1)/(n+m-1)*m/(n+m-2) or just n/(n+m)*(n-1)/(n+m-1)?

The first probability is the probability of selecting at least two reds before a black.

The second probability is the probability of selecting exactly two reds before a black.
 
Aug 10, 2001
10,420
2
0
Originally posted by: QED
Let P(i) be the odds that exactly i red balls are selected before a black one.

Then P(0) = m / ( n + m).
P(1) = n / (n+m) * m / (n+m-1).
P(2) = n / (n+m) * (n-1)/(n+m-1) * m/(n+m-2)
P(3) = n / (n+m) * (n-1)/(n+m-1) * (n-2)/(n+m-2) * m/(n+m-3)
etc.

In general P(i) = m * ( n! / (n-i)! ) / ( (n+m)! / (n+m-i-1)! ), or
P(i) = m * n!(n+m-i-1)! / ( n-i)!(n+m)!

Now the expecetd value is simply equal to the sum of 0*P(0) + 1 * P(1) + 2*P(2) + ... n *P(n). Note that in each P(i) are the constant factors (m * n! / (n+m)!), so you can pull those out of the sum first and simply sum the variable portions.
But in the extreme case when m=0, the expected number of red balls would be zero. That doesn't make any sense.

Your approach is the most logical, though.
 

QED

Diamond Member
Dec 16, 2005
3,428
3
0
Originally posted by: Random Variable
Originally posted by: QED
Let P(i) be the odds that exactly i red balls are selected before a black one.

Then P(0) = m / ( n + m).
P(1) = n / (n+m) * m / (n+m-1).
P(2) = n / (n+m) * (n-1)/(n+m-1) * m/(n+m-2)
P(3) = n / (n+m) * (n-1)/(n+m-1) * (n-2)/(n+m-2) * m/(n+m-3)
etc.

In general P(i) = m * ( n! / (n-i)! ) / ( (n+m)! / (n+m-i-1)! ), or
P(i) = m * n!(n+m-i-1)! / ( n-i)!(n+m)!

Now the expecetd value is simply equal to the sum of 0*P(0) + 1 * P(1) + 2*P(2) + ... n *P(n). Note that in each P(i) are the constant factors (m * n! / (n+m)!), so you can pull those out of the sum first and simply sum the variable portions.
But in the extreme case when m=0, the expected number of red balls would be zero. That doesn't make any sense.

Your approach is the most logical, though.

Actually, it does.

This about it-- you are not asking just how many red balls can you expect to pull out before seeing a black ball. You are asking how many red balls can you expect to pull out before you will certainly pull out a black ball. If there is no black ball, there is no way to pull out even a single red ball with the guaruntee that a black ball will follow.


 
Aug 10, 2001
10,420
2
0
The two approaches appear to lead to two different answers, but plug in any values for n and m (other than m=0) and the expected values are the same.
 
Aug 10, 2001
10,420
2
0
The answer turned out to be simply n/(m+1), which turns to be equivalent to my overly complicated-looking answer.


If two events (A & B) are mutually exclusive, the probabilty that event A occurs before event B is P(A)/[P(A)+P(B)].

therefore, E(Xi) = P(Xi) = P(of picking red ball i)/[P(of picking red ball i)+P(of picking a black ball)] = 1/(n+m)[1/(n+m)+m/(n+m)] = 1/(m+1)

and then E(X) = nE(Xi) = n/(m+1)