Results 1 to 3 of 3

Math Help - Programming probability.

  1. #1
    Newbie
    Joined
    Oct 2007
    Posts
    5

    Programming probability.

    Hi all, this is my first post.

    I'm a second year computer programming student and we've just been given our first assignment for this symester. The problem in to design a program that can work out how many people need to be in a room for the probability of 2 people sharing the same birthday to be greater than 0.5.

    I'm not very good at probability but I had a go none the less. Here's what i came up with.

    If there are two people in a room, the probability of them sharing the same birthday would be 1/365. If there were 3 people then the probability would be 2/365.

    I don't think it's this simple at all and I'm not sure how to factor leap years into this. Any help on this would be really cool, thanks all .
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Super Member

    Joined
    May 2006
    From
    Lexington, MA (USA)
    Posts
    11,707
    Thanks
    627
    Hello, Malicant!

    Welcome aboard!


    The problem is to design a program that can work out
    how many people need to be in a room for the probability of 2 people
    sharing the same birthday to be greater than 0.5.

    If there are two people in a room, the probability of them
    . . sharing the same birthday would be 1/365. . . . . Yes!
    If there were 3 people then the probability would be 2/365. . . . . no

    With 3 people, look at the opposite probability: no one shares a birthday.

    The first person can have any birthday: \frac{365}{365}

    The second must have a different birthday: \frac{364}{365}

    The third must have yet another birthday: \frac{363}{365}

    Hence: . P(\text{different birthdays}) \:=\:\frac{365}{365}\cdot\frac{364}{365}\cdot\frac  {363}{365} \:=\:\frac{132,132}{133,225}

    Therefore: . P(\text{common birthday}) \;=\;1 - \frac{132.132}{133.225} \;=\;\frac{1093}{133,225} \:\approx\:0.0082


    We want n people to share (at least) a birthday with probability greater than 0.5

    The probability that none of them have the same birthday is:

    . . \underbrace{\frac{365}{365}\cdot\frac{364}{365}\cd  ot\frac{363}{365}\cdot\frac{362}{365}\:\cdots\;\fr  ac{366-n}{365}}_{n\text{ fractions}}

    When this product drops below 0.5, we've found it!


    I trust you can write the program now . . .

    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Oct 2007
    Posts
    5
    Yes!, i get it . Thank you so much for your help. Now that I know this, the rest should be a breeze. Thank you again .
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 2
    Last Post: May 6th 2009, 10:41 PM
  2. [SOLVED] Simple Probability Question (Programming)
    Posted in the Advanced Statistics Forum
    Replies: 2
    Last Post: February 23rd 2009, 05:55 PM
  3. Programming For HP 48G+
    Posted in the Calculators Forum
    Replies: 0
    Last Post: February 3rd 2009, 03:09 AM
  4. Replies: 1
    Last Post: November 17th 2008, 03:18 AM
  5. Please help on R programming
    Posted in the Math Software Forum
    Replies: 0
    Last Post: August 16th 2008, 02:51 AM

Search Tags


/mathhelpforum @mathhelpforum