4.7. [3+5] Before Alex, there are 100 closed boxes, each containing a red or blue ball. Alex has one pound in his account. He chooses one of the closed boxes and one of the two colors and bets some amount not exceeding the amount in his account (there is no requirement to bet whole pennies). The box is opened, and Alex's account increases or decreases by the bet amount depending on whether his prediction is correct or not. The game continues until all the boxes are opened. What is the maximum amount Alex can guarantee himself if he knows that

a) there is only one blue ball;

b) the number of blue balls is equal to $n$.

(Alex can bet 0, thereby seeing the color of the ball in the chosen box for free.)

Answer. a) $\frac{2^{100}}{100}$. b) $\frac{2^{100}}{C_{n}^{100}}$
Solution. b) Let's consider the general case. Alex knows that there are $m$ red and $n$ blue balls in $m+n=K$ boxes. Let him then bet $\frac{|n-m|}{K}$ of his capital on the color that is more frequent (if $m=n$, Alex bets nothing). We will prove by induction on $K$ that this way Alex will increase his capital by a factor of $\frac{2^{K}}{C_{n}^{K}}$.

For one box, the statement is obvious; the capital increases by a factor of 2. If the statement is true for $K-1$, we will prove it for $K$ boxes. Let's assume for definiteness that $m \leq n$.

If a box with a blue ball is opened, at this step the capital increases by a factor of $1+\frac{n-m}{K}=\frac{2 n}{K}$, and there remain $n-1$ blue balls out of $K-1$ boxes, which according to the induction hypothesis leads to an increase by a factor of $\frac{2^{K-1}}{C_{n-1}^{K-1}}$. Multiplying these numbers and taking into account that $\frac{K}{n} C_{n-1}^{K-1}=C_{n}^{K}$, we get the desired $\frac{2^{K}}{C_{n}^{K}}$. If a box with a red ball is opened, the capital decreases, being multiplied by $1-\frac{n-m}{K}=\frac{2 m}{K}$, and there remain $n$ blue balls and $K-1$ boxes. By induction, in this case, the increase is $\frac{2^{K-1}}{C_{n}^{K-1}}$ times. Multiplying and taking into account that $\frac{K}{m} C_{n}^{K-1}=\frac{K}{m} C_{m-1}^{K-1}=C_{m}^{K}=C_{n}^{K}$, we again get the desired increase.

By induction on $K$, we will show that a greater increase is not possible. For one box, this is obvious. If there are more boxes and Alex bets a larger portion of what is indicated in the algorithm on the blue color, upon opening a red ball, he will get less than by the algorithm. And if he bets a smaller portion of what is indicated in the algorithm (including a negative one, if betting on red), he will get less than by the algorithm when a box with a blue ball is opened.