Birthday Problem

Discussion in 'C++' started by Sandra, Apr 12, 2004.

  1. Sandra

    Sandra Guest

    Thanks Alf - I am working on an encyrption\decryption program right
    now so I think I am going to let this one go. I really am stuck :)

    He is going to give us the answer on Wed - Do you want to see what he
    comes up with ?

    Sandra, Apr 13, 2004
    1. Advertisements

  2. Sandra

    Howard Guest

    Actually, the original question is unanswerable!

    It would seem that there are four answers to the original question, one for
    each of the following conditions:

    1) Not a leap year, my birthday not on Feb. 29th.
    2) Leap year, my birthday not on Feb. 29th.
    3) Not a leap year, my birthday on Feb. 29th.
    4) Leap year, my birthday on Feb. 29th.

    We would need to handle "my birthday on Feb. 29th" differently from "my
    birthday not on Feb. 29th", because the odds of someone ELSE having that
    birthday are not the same as them having any other specific birthday. And
    we'd have to handle the fact that it's leap year NOW because of the
    differing number of days in the year.


    Even that is not accurate, because there is a basic assumption that the
    distribution of birthdays across the year is uniform, and that is not a
    provable assumption! (It may in fact be a false assumption, but I wouldn't
    know how prove *that*, one way or the other.)

    I *do* know that, for any given population, the distribution of birthdays is
    not uniformly distributed. Look it up. If I recall, in temperate climates
    there tend to be more births around the end of summer, presumably because as
    it gets cold outside, people tend to, shall we say, "come together" more,
    for the sake of warmth. And so, nine months later, there are more births.

    So, if you live in a temperate climate, your birthday is in September, the
    odds are greater that someone in a given set of people will have that
    birthday than if your birthday is in, say April (where conception would have
    occurred in July).

    Of course, the instructor may have assumed a uniform distribution, and
    intended to ignore leap year and a Feb. 29th birthday altogether. But,
    being the nuisance I am, I'd have gone to the teacher and asked. :)

    Howard, Apr 13, 2004
    1. Advertisements

  3. Sandra

    Sandra Guest

    Thanks Howard ~ I did ask him, he is not giving any clues except that
    the number is exact and is between 1600-1700

    I did not think there could be an exact answer either - just an

    I guess I'll find out later this week - I will let you guys know what
    he came up with

    Sandra, Apr 13, 2004
  4. Well, at least Alfred's contention that I gave you the answer is
    clearly wrong in that case ;)
    Sounds like it has a definite trick question element to it.
    Christopher Benson-Manica, Apr 13, 2004
  5. Given the level of discussion, I doubt he'd be the only one :)
    Christopher Benson-Manica, Apr 13, 2004
  6. Sandra

    Sandra Guest

    I will let you guys know :)
    Sandra, Apr 13, 2004
  7. You bet. Especially since you cannot know, without some distribution
    information, how many people it will take to find your birthday.
    If you were born on 1-1 and asked people as they got off the subway if
    anyone was born on 1-1 there is no telling how many people you would
    ask before one of them was born on 1-1. It's not the pigeon hole
    principle here. You might go through 1,000,000 people until one was
    born on 1-1. There is just no way of telling.
    If, on the other hand, you were asking people what their birthdates
    were and kept track of the answers, you might be surprised to find
    that after the first 20 you will have a 50-50 chance of finding two of
    them with the same birthday. But it is a different problem.

    I think your teacher is on a wrong track.
    Gary Labowitz, Apr 13, 2004
  8. The only meaningful numerical result is the one I gave first, and implied by
    later posters. Sandra would not have learned less if you just gave that
    number. What one should not do is to help someone avoid learning, or,
    although clearly not the case here, to cheat.

    I think so too. The range 1600-1700 means the seemingly only meaningful
    result (for non Feb 29) is not the one intended. I'm leaning towards thinking
    there is some earlier context -- earlier questions -- Sandra did not list.
    Alf P. Steinbach, Apr 13, 2004
  9. Sandra

    tom_usenet Guest

    This question is impossible to answer without statistics on how many
    people in the population were born on each day of the year. It is very
    unlikely to be a uniform distribution, which is what everyone else
    seems to be assuming (e.g. if everyone in the world was born on 4th
    July, the answer would be 1).

    Even if you assume that anyone was born on a particular day of the
    year with equal probability, you still run into the problem of leap
    years. To calculate how this affects things will require a full world
    population age distribution, to find out the average number of leap
    years per year over the population as a whole. However, assuming
    365.25 days per year is probably safe since you only need a result to
    the nearest person.

    Anyway, before answering the question, make sure you state your
    assumptions clearly.

    tom_usenet, Apr 13, 2004

  10. I do not think that the data you provided are enough. When you say birthday
    you mean day and month and year? Is there any other restriction (e.g. is it
    possible two people in the room to have the same birthday (day, month and
    year) and still be different from yours?
    Ioannis Vranos, Apr 13, 2004
  11. I certainly hope I did neither...
    Christopher Benson-Manica, Apr 13, 2004
  12. Sandra

    Julie Guest

    Is that _birthday_ as in sharing a common day of the year

    - or -

    _birth_date_ as in sharing a common point in time (day, month, year)?
    Julie, Apr 13, 2004
  13. Sandra

    Anonymous Guest

    I actually find this offensive. I have never been called a troll before
    and I don't understand why my post was considered one.
    It was polite (no insults of any kind) and not only did it simply say
    that this was not an appropriate place for the question but it also
    suggested other groups where it would be more appropriate. I mean, while
    any of us are capable of helping her with this problem, it was a math
    problem that really didn't have anything to do with C++ or even programming!
    Really, where is the C++ in "Ok - The problem is to find out how many
    people need to be in a room for a 95% chance that someone in that room will
    match my birthday?"
    Anonymous, Apr 13, 2004
  14. Most regulars of this group (and comp.lang.c) realize that E. Robert
    Tisdale is a troll himself. His opinions on who is or is not a troll
    are fairly irrelevant; please try not to take his trolls seriously or
    Christopher Benson-Manica, Apr 13, 2004
  15. Sandra

    Mabden Guest

    It's an old logic puzzle. It refers to birthday - no year is implied.
    You and I can share a birthday and be 20 years apart in age.

    I think if you have 25 people the answer is something like a 50% chance.
    By the time you have 70 people in a room it is about 100% - unless it's
    a Twins convention! :)

    Not what you thought, huh!

    The way to get the actual number is to analyze what the probabilities
    are. If I am in a room with just one person, then the chances of us
    sharing a birthday are 1 in 365. Add another person and the probability
    goes to 1 in 363. So, (364/365) x (363/365).

    The complete table is an exercise for the student! ;-)
    Mabden, Apr 14, 2004
  16. Or an exercise for previous posts :) (It turns out that I was the one
    who posted that code, and it also turns out that the professor is
    looking for a vastly different answer.)
    Christopher Benson-Manica, Apr 14, 2004
  17. Sandra

    Dave Moore Guest

    This question is impossible to answer without statistics on how many
    Interesting point ... in fact, in some areas, like say Minnesota or
    North Dakota, birthdays tend to be clustered in the months July-Sept.

    [ya' gotta find somethin' to do on those long, cold winter nights I

    To extend this further, with technological advances in the last n
    years (say 40 if you like), the "clustering" from the above example
    has likely started to decrease with time, yielding a more even
    distribution for people born more recently.

    [Now you can drive in your heated automobile on plowed, paved roads
    to, say, go bowling .. so there are more solutions to the
    aforementioned "what to do" problem, regardless of the time of year

    So, you would really have to know quite a lot of details about the
    people in the room (is it a geratrics convention in Alberta, or a
    child's birthday party in Sao Paolo) in order to get an accurate grasp
    on the probability problem.

    Like some other posters in this thread, I wonder if the point of the
    problem was really the code, or whether it was intended to help you
    realize that sometimes the most simply stated problems are the
    trickiest to solve. If I were the prof., I would give credit based
    not so much on the code itself, but rather on how well the students
    thought about the problem ... recognizing the leap-year issue gets one
    point, the non-even birthday distribution gets two points, etc. After
    all, a careful analysis of the problem is (at least) 80% of proper
    program design .. I guess (from context) that your course is on an
    introductory level, but one can never learn this lesson too early.

    I am extremely interested to see the soln. given by your prof. ... if
    only to find out how narrowly/broadly the problem was defined in her
    mind. In my experience, profs, like wizards, can be quite subtyl ..
    and they can even be quick to anger as well 8*).

    Good luck!
    Dave Moore, Apr 14, 2004
  18. Sandra

    Default User Guest

    Do you have statistics to back that up? Sounds pretty urban-legendy to
    me, like the supposed baby booms following blackouts and 9/11 and such.

    Brian Rodenborn
    Default User, Apr 14, 2004

  19. Live birth totals for USA 1993 :

    Month Per Vs daily
    Total Day Avg

    Jan 323,420 10,433 -4.91%
    Feb 304,947 10,891 -0.73%
    Mar 342,518 11,049 0.71%
    Apr 327,372 10,912 -0.54%
    May 336,368 10,851 -1.10%
    Jun 335,703 11,190 +1.99%
    Jul 352,949 11,385 +3.77%
    Aug 351,306 11,332 +3.29%
    Sep 348,399 11,613 +5.85%
    Oct 333,313 10,752 -2.00%
    Nov 316,751 10,558 -3.76%
    Dec 331,477 10,693 -2.54%

    Monthly totals from "Live births by state by month for 1993"

    Interested people can repeat the calculations for individual states.
    Bruce Clement, Apr 14, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.