Skip to main content
GameDev.net gamedev.net
🔒 Locked

Probability

Started by Dave007 May 21, 2003 at 8:31 AM 6 replies 950+ views
Original Post
Dave007
Dave007
Hi, a family has 4 children. What''s the probability of a) there are at least 3 girls (children of female sex in the family b) there are max. 2 girls in the family This is not a homework. It was just a test exercise. I just want to know, who is right. My teacher says that you have to look at the order of the children, thus the probability of a) is 5/16 and the probabily of b) is 11/16. I say there is no need to look at the order, thus the probabily would be a) 2/5 and b) 3/5. Please help. ---------- Dave
--------Dave[ Math Studio ] A Computer Algebra System
Buster
Buster
This is a bit brute-force, but shows you what the teacher is saying... make a tree:


  
M
/
start
\
F


and carry it out 4 steps... you''ll see 16 possible outcomes. Now just count the ones that match your problem and you indeed get 5/16 and 11/16.
Dave007
Dave007
actually I wrote a simple program for it computing the probability by brute force.
By randomly generating 4 values - 0 for boy, 1 for girl I got the probability 5/16 and 11/16.
By randomly generating the count of girls/boys I got 2/5 and 3/5.
It doesn''t make sence to me. Why is that?

-----------
Dave
--------Dave[ Math Studio ] A Computer Algebra System
LuckyNewbie
LuckyNewbie
This comes directly from "The Practice of Statistics" 1999 W. H. Freeman and Company by Daniel Yates, et al:

"If we assume the couple is equally likely to have a girl or a boy, then how unusual is it for a family to have 3 children who are all girls? If success = girl, and failure = boy, then p(success) = .5. We will define the random variable X as the number of girls. Then we want to simulate families with 3 children. Our goal is to determine the long-term relative frequency of a family with 3 girls, that is, P(X = 3)"

Then it goes on to do the simulation without using any formulas and such. But the thing is set up that you can soon be introduced to a binomial distribution. A binomial distribution is used when

"1)Each observation falls into one of just two categories, which we call "success or failure"
2) There is a fixed number n of observations.
3) The n observations are all independent. That is, knowing the result of one observation tells you nothing about the others.
4) The probability of success, call it p, is the same for each observation."

Since your situation meets this criteria, we can go ahead and use the binomial distribution. What is it? Right out of the horse''s mouth:

"If X has a binomial distribution with n observations and probability p of success on each observation, the possible values of X are 0,1,2,...,n. If k is any one of these values,

P (X = k ) =

( n! / (k!(n - k)!) ) * P^k * (1 - P)^(n-k)"

Plugging your values in for part A, where n is 4, k is 3, and P is .5:

( 4*3*2*1 / 3*2*1(1) ) * .5^3 * .5^1
= (24 / 6) * .125 * .5
= 4 * .125 * .5
= .5*.5
= .25

Thus, the probability of getting three girls is .25. To find the probability of getting a maximum of 2 girls (0,1, or 2 girls), you would simply re-use the formula and add P(X = 0), P(X = 1), and P(X = 2). Simple enough! Double check my math because I might be wrong.

If this wasn''t clear, do a google search on "Binomial setting" or "binomial distribution" or "binomial random variable". I hope this helps.


"Let me just ejaculate some ideas"
LuckyNewbie
LuckyNewbie
quote:
Original post by Dave007
actually I wrote a simple program for it computing the probability by brute force.
By randomly generating 4 values - 0 for boy, 1 for girl I got the probability 5/16 and 11/16.
By randomly generating the count of girls/boys I got 2/5 and 3/5.
It doesn''t make sence to me. Why is that?

-----------
Dave


To write a brute force program for this, generate the four random values (0 for boy, 1 for girl) and add them up. You must also define four variables to hold the frequency that so many girls show up. For example, the couple could have 0,1,2,3, or 4 girls. Maybe use an array NumGirlsFrequency[5]. Heres the psuedocode for such a program.


  
input the number of trials
for (trial = 0; trial < numTrials; trial++)
{
numGirls = 0
for (index = 0; index < 4; index++)
{
numGirls += (rand()%2);
}
NumGirlsFrequency[numGirls]++
}

// probability of having 3 girls is now NumGirlsFrequency[3] / numTrials



"Let me just ejaculate some ideas"
"Let me just ejaculate some ideas"
Dave007
Dave007
LuckyNewbie, thank you for your explanation. I already know about binomial distribution. Thank you for your answer.
As I mentioned in my first post, it can be computed just by counting occurences of 3 or more girls in all possibilities. I just didn''t know you have to look at the order of children.

Anyway, this probability stuff is quite strange...

--------
Dave
--------Dave[ Math Studio ] A Computer Algebra System

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.