Programming Praxis


Home | Pages | Archives


Green Eyes

September 29, 2009 9:00 AM

We haven’t done a math problem in a while. This one comes from my daughter’s high-school math class. She is never quite sure whether or not to ask me for help; sometimes she gets much more help than she really wants.

In a group of twenty-seven people, eleven have blue eyes, thirteen have brown eyes, and three have green eyes. If three people are randomly selected from the group, what is the probability that exactly one of them will have green eyes?

Your task is to find the probability. When you are finished, you are welcome to read or run a suggested solution, or to post your solution or discuss the exercise in the comments below.

Posted by programmingpraxis

Categories: Exercises

Tags:

5 Responses to “Green Eyes”

  1. I’d say we have

    P = 3/27 * 24/27 * 24/27 * 3 =~ 26.34%

    By P. Riva on September 29, 2009 at 11:23 AM

  2. OPS!!! I was a bit in a hurry:

    3/27 * 24/26 * 23/25 * 3 =~ 28.31%

    By P. Riva on September 29, 2009 at 11:33 AM

  3. 92 / 325
    or about 28.308%

    By Mark VandeWettering on September 29, 2009 at 11:22 PM

  4. It may be easier to conceptualize as choosing one child w/ green eyes and two children with eyes of any other color. Your numerator is P(choosing one green of the 3 greens)*P(choosing 2 not greens of the 24 not greens). The denominator is the total number of combinations of choosing three children out of the 27.

    Number of ways of:
    -Choosing 1 green out of the 3 greens: 3C1 = 3
    -Choosing 2 non-greens out of the 24 non-greens: 24C2 = 276
    -Choosing 3 kids out of 27 kids: 27C3 = 2925

    So, the probability of choosing only one green eyed kid out of the three selected is:
    (3C1*24C2)/(27C3) = (3*276)/2925 = 0.283076923

    By Peter on October 20, 2009 at 7:57 PM

  5. from operator import mul
    
    def falling_factorial(n, k):
        """(n)_k = n! / (n - k)! = n * (n - 1) * ... * (n - k + 1)"""
        return reduce(mul, xrange(n - k + 1, n + 1), 1)
    
    
    def binom(n, k):
        """n! / (k! * (n-k)!) = (n)_k / k!; k! = (k)_k"""
        return falling_factorial(n, k) / falling_factorial(k, k)
    
    
    if __name__ == "__main__":
        print 100 * binom(24, 2) * binom(3, 1) / float(binom(27, 3))
    

    By Graham on June 28, 2011 at 2:09 PM

Leave a Reply



Mobile Site | Full Site


Get a free blog at WordPress.com Theme: WordPress Mobile Edition by Alex King.