I've been trying to solve a following riddle
A secretary types four letters to four people and addresses the four envelopes. If she inserts the letters at random, each in a different envelope, what is the probability that exactly three letters will go into the right envelope?
Since the events appear to be dependent, why not use conditional probability, I thought.
Let $P(A)$ be the probability that she picked the first envelope right. Then $P(A)=\frac{1}{4}$. Then, assuming that she did, $P(B|A) = \frac{1}{3}$ where $P(B|A)$ is the probability that she picked the correct second envelope given that the first was correct. Then, by conditional probability rule, $P(B|A) = \frac{P(A \cap B)}{P(A)}$ that is $\frac{1}{3}=\frac{P(A \cap B)}{\frac{1}{4}}$, so the probability that she picked two of the envelopes correctly is $P(A \cap B) = \frac{1}{12}$. Now she has picked the first two envelopes correctly, so for the third one she has only two choices, that is $P(C|A \cap B) = \frac{1}{2}$, and from the conditional probability formula we find $P(C \cap A \cap B) = \frac{1}{24}$. This is where the trouble starts because the real probability of this is zero! Had she picked three envelopes right, then the fourth one must be right as well, so that $P(D | A \cap B \cap C) = 1$ and $P(A \cap B \cap C \cap D) = \frac{1}{24}$. Now this last probability is correct (as far as I can determine by simulation), but my $P(A \cap B \cap C)$ is wrong, as it should be zero?
I'm not sure what went wrong here and how to think about this kind of problem. Please help.
Just for the reference, this is the Python script I've written to check that $P(A \cap B \cap C)$ converges to $\frac{1}{24}$:
import random
result = [0] * 5
tries = 1000000
for x in xrange(0,tries):
people = range(1,5)
envelopes = range(1,5)
subresult = []
for x in xrange(0,4):
p = random.choice(people)
people.remove(p)
e = random.choice(envelopes)
envelopes.remove(e)
subresult.append(p-e)
result[subresult.count(0)] += 1
print [1.0*x/tries for x in result]
There is no problem. You have that $P(A \cap B \cap C) = P(A \cap B \cap C \cap D)$. Observe that $P(A \cap B \cap C)$ is the probability that at least 3 letters go in the correct envelopes, and $P(A \cap B \cap C \cap D)$ is the probability that all four letters go in the correct envelopes.
What can you conclude about $P(A \cap B \cap C \cap \bar{D})$, the probability that exactly three letters go in the correct envelopes?