If you have two bags each containing 100 numbered balls and pick 1 ball at random from each bag, what are the odds that you will pick two similarly numbered balls?

I believe this is equivalent to the Birthday paradox equation:

T! 1 - ----------------- T^n . ( T - n )!

Which for T=100, n=2 comes out to:

use strict; use bignum; sub fact{ my($r,$n) = (1,shift); $r *= $n-- while $n; return $r; } print 1-((fact(100)/fact(98))/100**2);

gives 0.01 or 1% chance.

My question is, if I have 2 pairs of 2 bags and pick one ball from each, what are the odds of the first pair being identical to the second pair?

For my purposes, order does matter. So, the question is really what are the odds that ball 1 from each of pair1/bag1 & pair2/bag1 will be identical; and ball 2 from each of pair1/bag2 & pair2/bag2 will also be identical?

Is this a simple combination of odds? Eg. 0.01 * 0.01 == 0.0001?


In reply to Math help by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.