# Conditional probability with a B dependent on A

A computer first selects a natural number n in a uniform manner from the set $$\{1, 2, 3, 4, 5\}$$ (This means that each of these numbers has an equal chance of becoming chosen). Then our computer uniformly selects a natural number m from the set $$\{1,\ldots,n\}$$. Given that $$m = 3$$, what is the probability that $$n = 5$$?

I know the basic rule that $$\mathbb{P}[A|B] = \frac{\mathbb{P}[A\cap B]}{\mathbb{P}[B]},$$ but I have trouble with applying this formula.

I need to know two things: The intersection of A and B, and the probability of B.

But it seems that B doesn't have a fixed probability, since it depends on A. So the probability of B is. 1/n.

How do I take the intersection of A and B?

The answer is 12/47. But I don't know how to get there.

Can I get feedback on this problem?

Ter

Let $$A_k=\{n=k\}$$, $$B_l=\{m=l\}$$. You are asked about $$P(A_5|B_3)$$; using Bayes rule $$P(A_5|B_3)=\frac{P(B_3|A_5)P(A_5)}{P(B_3)}$$ and using law of total probability $$P(B_3)=P(B_3|A_3)P(A_3)+P(B_3|A_4)P(A_4)+P(B_3|A_5)P(A_5)$$
Think of Bayes Theorem. Intuitively, you know that $$m=3$$. What is the probability $$p_1$$ to pick $$m=3$$ if $$n = 1$$? What about $$p_2$$ (if $$n=2$$)? Find $$p_3,p_4,p_5$$ and then you need the chance it was actually $$5$$ only, which would be $$\frac{p_5}{p_1 + p_2 + p_3 + p_4 + p_5}$$