19. Pills. On February 28, the doctor prescribed Pills for Absentmindedness to the Absent-Minded Mathematician, which he had to take once a day after lunch. The Mathematician bought two bottles, each containing 10 pills. Starting from March 1, the Mathematician takes one of the bottles to work with him each day (choosing it randomly), and after lunch, he takes a pill from the bottle in his pocket.

a) (9th grade. 4 points). Find the probability that on March 14, the Mathematician will first discover that the bottle in his pocket is empty.

b) (9th grade. 4 points). Find the expected number of pills the Mathematician will have taken by the time he discovers that the bottle is empty.
Solution. a) The specified event will occur only if the Mathematician ate 10 pills from one bottle and 3 pills from the other during the first 13 days of March, and on March 14th, he accidentally took the empty bottle with him. The probability of this is

$$
2 \cdot C_{13}^{3} \frac{1}{2^{13}} \cdot \frac{1}{2}=C_{13}^{3} \frac{1}{2^{13}}=\frac{13 \cdot 12 \cdot 11}{6} \cdot \frac{1}{2^{13}}=\frac{143}{4096} \approx 0.035
$$

b) Let the random variable $X$ be the number of pills taken by the Mathematician by the time the bottle was found to be empty. Reasoning as in part a), we get:

$$
\mathrm{P}(X=k)=C_{k}^{k-10} \frac{1}{2^{k}}
$$

where $k=10,11, \ldots, 20$. Then

$$
\mathrm{E} X=10 C_{10}^{0} \frac{1}{2^{10}}+11 C_{11}^{1} \frac{1}{2^{11}}+\ldots+20 C_{20}^{10} \frac{1}{2^{20}}
$$

This sum can be computed directly on a computer (it will be approximately 17.3), but we will try to simplify it.

On the one hand,

$$
\begin{aligned}
\mathrm{E} X & -10=0 \cdot C_{10}^{0} \frac{1}{2^{10}}+1 \cdot C_{11}^{1} \frac{1}{2^{11}}+2 \cdot C_{12}^{2} \frac{1}{2^{12}}+\ldots+10 \cdot C_{20}^{10} \frac{1}{2^{20}}= \\
& =\frac{11!}{0!\cdot 10!} \cdot \frac{1}{2^{11}}+\frac{12!}{1!\cdot 10!} \cdot \frac{1}{2^{12}}+\frac{13!}{2!\cdot 10!} \cdot \frac{1}{2^{12}}+\ldots+\frac{20!}{9!\cdot 10!} \cdot \frac{1}{2^{20}}= \\
& =\frac{1}{2}\left(11 C_{10}^{0} \frac{1}{2^{10}}+12 C_{11}^{1} \frac{1}{2^{11}}+13 C_{12}^{2} \frac{1}{2^{12}}+\ldots+20 C_{19}^{9} \frac{1}{2^{19}}\right)
\end{aligned}
$$

On the other hand,

$$
\mathrm{E} X+1=11 C_{10}^{0} \frac{1}{2^{10}}+12 C_{11}^{1} \frac{1}{2^{11}}+\ldots+20 C_{19}^{9} \frac{1}{2^{19}}+21 C_{20}^{10} \frac{1}{2^{20}}
$$

From these two equations, we get:

$$
\mathrm{E} X-10=\frac{1}{2}\left(\mathrm{E} X+1-21 \cdot C_{20}^{10} \frac{1}{2^{20}}\right), \text { hence } \mathrm{E} X=21\left(1-C_{20}^{10} \frac{1}{2^{20}}\right) \approx 17.3
$$

Answer: a) approx. 0.035; b) approx. 17.3.

Comment 1. Using Stirling's formula $n!\approx \sqrt{2 \pi n}\left(\frac{n}{e}\right)^{n}$, replace the expression $C_{2 n}^{n} \frac{1}{2^{2 n}}$ with the value $\frac{1}{\sqrt{\pi n}}$ (verify this). Then we get: $\mathrm{E} X \approx 21\left(1-\frac{1}{\sqrt{10 \pi}}\right) \approx 17.25$. The agreement is satisfactory. It is easy to generalize the problem to an arbitrary number of pills in the bottle, by substituting $n$ for 10.

Comment 2. It is clear that by choosing a bottle randomly each day, the Mathematician is likely to take quite a few pills. He might even take all of them - the value 17.3 is not much less than 20. However, to form a more definite idea, it is necessary to know not only the expectation but also the variance, which we did not seek. You can do this independently.

[^0]:    ${ }^{1}$ The variance of a set of numbers is the average of the squares of the deviations of the numbers from their arithmetic mean. The standard deviation is the square root of the variance. The standard deviation is often used (and in our case, too) to estimate the plausibility of the deviation of the obtained average value from the expected one.

    ${ }^{2}$ Conditional probabilities of events $\delta0$ given $\delta \neq 0$ are meant.

    ${ }^{3}$ This is the same as counting heads and tails in 67 coin tosses.

[^1]:    ${ }^{4}$ Unfortunately, an error was made in the problem statement - the word "below" was used instead of "above". This led to the problem becoming different and less interesting. Everyone who solved it was given the highest possible score.

[^2]:    ${ }^{5}$ It is unknown whether this number is rational. It is only known that if it is rational, it can be represented as an irreducible fraction with a denominator no less than $10^{242080}$.