Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

A and B are sequences of random numbers where each number is an independantly random number from 1 to 365.

i and j are sequence positions in a and b

What's the probability that the set A(1..i) intersect B(1..j) is not empty?

Update: To help frame this as a real world problem, let's say you had a company of 50 people and made the entry code to the building everyone's birthday - then someone found out this was the case - how many guesses would it statistically take to gain entry?

Note: I'm not planning a heist.

share|cite|improve this question

First, consider the count $D$ of distinct numbers in the sequence $A(1..i)$. Given that $D = d$, the probability that $B(1..j)$ does not intersect $A(1..i)$ is equal to: $$P(D = d) = \left(\frac{365-d}{365}\right)^j$$

so the sought probability would be $1 - \left(\frac{365-d}{365}\right)^j$.

If however $D$ is unknown (i.e. variable), a more complicated expression (involving the probability for $D$ assuming certain values) comes in to play. If you are interested, I can write it up for you, but it will probably be a nasty expression.

share|cite|improve this answer

You have $ij$ pairs that might match, each with probability $\frac 1{365}$ (assuming the usual rules). Are they selected independently? Do you know that all the numbers in sequence A are distinct? These will change the answer.

share|cite|improve this answer
I updated my question to make it more concrete/specific (hopefully) – Aaron Anodide Oct 9 '12 at 19:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.