Expected size of a sample A warehouse contains seven printing machines, three of which are defective.
A company worker has a task to send two of the defective machines for a
repair. In order to identify such a pair, he selects a printing machine at random and
inspects whether it is a defective or a non-defective one. Then he selects another
printing machine at random for the inspection and he repeats the process until he
identifies the second defective printing machine. What is the expected number of
printing machines he has to inspect?
I would really appreciate a hint on how to proceed with this problem. So far I have created a tree diagram, which made me believe the answer is 4. But I think there has to be another way to solve this.
 A: Assuming that non-defective machines aren't inspected again, the scenario is equivalent to shuffling the machines and having the worker inspect them in order. There are $\binom73=35$ possible orders and of those

*

*$5$ have the second defective machine second-in-line ($1$ way to place the defective machine before it, $5$ ways to place the one after)

*$8$ have the second defective machine third-in-line

*$9$ have it fourth

*$8$ have it fifth

*$5$ have it sixth

Thus the expected number of machines inspected is
$$\frac{5×2+8×3+9×4+8×5+5×6}{35}=4$$
A: $4$ is indeed correct for sampling without replacement.
This is a negative hypergeometric distribution which in this particular formulation has mean $2\frac{7+1}{3+1}$
One approach is say: introduce another defective machine so you have $7+1=8$ machines of which $3+1=4$ are defective.  Place them in a circle at random.  Clearly the expected or average gap between successive defective machines is $\frac{7+1}{3+1}=2$, in effect counting from immediately after a defective machine through to the next defective machine.  Now break the circle at the machine which you had introduced, remove it and straighten the line. The expected count of machines to the second defective machine (i.e. two gaps) is then $2\frac{7+1}{3+1}=4$
A: For every case where the second of three defective machines is not at position $k\ne 4$, there is an equally likely reflected case where the second of three is at position $8-k$. Hence we can pair all $k\ne 4$ cases such that the expected position of the second defective machine is $4$. Then that expected position is also $4$ overall.
Nitpicking mode. However, there are $5$ (out of $7\choose 3$) cases where our given knowledge that there are three defective machines saves us one check - namely when the last two remaining must be defective. Additionally, there is one case where we save yet another check - namely when the last three remaining machines are defective. So we might subtract $\frac 6{7\choose 3}$ from the simple answer above.
