So there are 12 files in total and 3 of them contain viruses. If a file with a virus is selected, it is removed and a new file is then selected. What is the expected number of files that need to be selected to get a virus free computer?
Progress
I thought it was an expected value problem. So summation $\sum X(\xi)p(\xi)$ but that doesn't make sense.
Is this correct? Let n be the number of viruses, then the result is $n(1/1 + .. +1/n)$ $$3(1/1 + 1/2 +... + 1/12) = 9.3096$$
Assuming files cannot be chosen more than once, the probability the third virus is in the $n$th file is the probability the two viruses are in the first $n-1$ files and the $n$th file has a virus, which is $$ \frac1{13-n} \times \frac{{3 \choose 2}{9 \choose n-3}}{{12 \choose n-1}} $$ and so the expectation is $$\sum_{n=3}^{12} \frac{n}{13-n} \times \frac{{3 \choose 2}{9 \choose n-3}}{{12 \choose n-1}} $$ which is $9.75$. Since this is $\frac34 \times(12+1)$, there may be an easier way.
Added A more combinatorial approach:
Number the virus-free files $1,2,\ldots,9$.
The probability that virus-free file $i$ has not been chosen by the time all three viruses have been found is $\frac14$.
So the expected number of virus-free files which have not been chosen by the time all three viruses have been found is $\frac94$.
So the expected number of files which have been examined by the time all three viruses have been found is $12-\frac94 = 9.75$.
Generalising this, if there are $c$ clean (virus-free) files, $v$ files with viruses and $f=c+v$ total files, then the expected number is $f-\frac{c}{v+1}=\frac{v}{v+1}(f+1)$.