A probability interview questions on pen type In an interview, the following question was asked:
A (single) box contains $20$ pens. $8$ pens are of type $A$, and the others are of type ‌$B$. We then randomly choose a pen, and discard it from the box (regardless of type). If we then choose another pen from the box, what is the probability that this pen is of type $A$?
I'm having trouble coming up with a solution to this, how would you compute this?
 A: How can I select a pen randomly? Supposing that it is not possible to detect which pen is which merely by feeling the pens (because the difference is only their color, for example),
I can shake up the contents of the box, perhaps reach in and stir them with my hand,
then finally grasp a pen and pull it out.
Suppose that while I am stirring the pens I grasp one and then put my fingers on a second pen;
I then carefully grasp the second pen while dropping the first pen so that I make sure
the first pen is not the one I am holding, and I pull the second pen from the box.
With respect to the probability that I finally choose a type A pen, how is this procedure different from any other method of stirring the pens and finally pulling one out?
With respect to the probability that I finally choose a type A pen, how is this procedure different from putting the first pen grasped in an empty corner of the box and then grabbing the second pen, ensuring that I do not take the first pen?
With respect to the probability that I finally choose a type A pen, how is this procedure different from removing the first pen without looking and
putting it in some other place outside the box where I still do not see it, and then
grabbing the second pen?
I think there is no need here for any calculation more involved than dividing one number by another.
A: $P(A)=8/20=0.4, P(B)=0.6$
We have to compute the conditional probability
$P(A|A\cup B)=P(A\cap(A\cup B))/(P(A\cup B))=P(A)/(P(A)+P(B))=P(A)=0.4$
Here is a Python simulation:
import numpy as np
from random import randint
rez=[]   
N=1000
for k in range(N):
    u=np.random.random()
    if  u<0.4: # an A-type is drawn
        x=randint(1,19)#second draw
        if x<8: rez.append(1)
    else: # a B-type is drawn
        x=randint(1,19)#second draw
        if  x<=8: rez.append(1)

 print 1.0*sum(rez)/N    

A: You have two scenarios to sum together : First pen is type B or first pen is type A. The probabilities for these are $\frac{12}{20}\times\frac{8}{19}$ and $\frac{8}{20}\times\frac{7}{19}$, which sums to the answer $\frac{8}{20}$, which is the same as the probability of picking up pen A the first time round.   
A: Hint: either the first pen is of type A or of type B. Can you compute the probability that the second pen is of type A in each case ?
