# Using bayes's theorem for probability

this other problem is troubling me now. It involves using Bayes's theorem,

$$P(A|B) = \frac{Pr(B|A)Pr(A)}{Pr(B)}$$

The problem is: You have all your 2N2222 NPN transistors in the left drawer and all the 2N2907 PNP transistors in the right one. A buddy of yours throws two NPN transistors from the left drawer to the right. Then he proceeds to throw one from the right drawer to the left. Then suppose you've just taken a 2N907 PNP transistor, what is the probability of you opening the left drawer?

How could I set the events up?

Hint: Suppose you had $n$ NPN transistors in the left drawer and $p$ PNP transistors in the right drawer. After the the shuffling of transistors, there are two possibilities:

(1) $n-1$ NPN on left, $1$ NPN and $p$ PNP on the right with probability $\frac2{p+2}$

(2) $n-2$ NPN and $1$ PNP on left, $2$ NPN and $p-1$ PNP on the right with probability $\frac{p}{p+2}$

Assuming that we have chosen the drawers with equal probability,

Left drawer and we drew PNP: $\overbrace{\frac2{p+2}0}^{(1)}+\overbrace{\frac{p}{p+2}\frac1{n-1}}^{(2)}=\frac{p}{(p+2)(n-1)}$

Right drawer and we drew PNP: $\overbrace{\frac2{p+2}\frac{p}{p+1}}^{(1)}+\overbrace{\frac{p}{p+2}\frac{p-1}{p+1}}^{(2)}=\frac{p}{p+2}$

We drew PNP: $\frac{p}{(p+2)(n-1)}+\frac{p}{p+2}=\frac{pn}{(p+2)(n-1)}$

However, I don't see how to use the formula you cite. This seems to require $P(X|Y)=\frac{P(X\text{ and }Y)}{P(Y)}$