[Math] Optimal Stake for coin flip game

expectationprobability

I'm doing some prep work for a job interview and one of their difficult sample questions is as follows:

You flip a coin 100 times, but instead of having a fixed stake, you can freely choose the stake for each flip. You start with £100. After each flip, if it comes up heads you win twice your stake (and your stake is returned), if it comes up tails you lose your stake. So if you start with $x$ and select a stake of $S$, then after the flip you will either have $x+2S$ or $x-S$. You can never make your stake larger than your current balance.

If your profit is $P$ how should you select your stake, $S$, to maximise:

a) $E[P]$
b) $E[\log (P+100)]$

Edit: to clarify $0<S<100$ is required so you are betting an amount but you are also protecting yourself from losing all of your money (of course successive losses would whittle your total money to zero eventually)

Best Answer

As I see it, the second question concerns maximising the logarithm of "100 plus the profit":

$$S^*=\underset{S\in(0,100),\, S\leq B}{\mathrm{argmax\:\;}}{\mathbb{E}(\log{(P+100)})} = \\\underset{S\in(0,100),\, S\leq B}{\mathrm{argmax\:\;}}{(\frac{1}{2}\log{(-S+100)+\frac{1}{2}\log{(2S+100)}})} $$ $$\begin{equation} = \begin{cases} 25 & \text{if } B > 25 \\ B & \text{otherwise} \end{cases} \end{equation}$$

where B is the current balance (or "bankroll"). So this means that we would not be betting $25\%$ of the current balance on each round as per the previous answer, but either betting $25 or going all in. However, if we were maximising the logarithm of "the current balance plus the profit" we would get the result that we should bet 25% of the current balance on each round:

$$S^{**}=\underset{S\in(0,100),\, S\leq B}{\mathrm{argmax\:\;}}{\mathbb{E}(\log{(P+B)})} = \\\underset{S\in(0,100),\, S\leq B}{\mathrm{argmax\:\;}}{(\frac{1}{2}\log{(-S+B)+\frac{1}{2}\log{(2S+B)}})} $$ $$\begin{equation} = \begin{cases} \frac{1}{4}B & \text{if } B < 400 \:\,(\iff \frac{1}{4}B <100\:)\\ 100 & \text{otherwise} \end{cases} \end{equation}$$ $$\begin{equation} \end{equation}$$