Optimal betting strategy -- 1D optimization

The betting game consists of two rounds. In each round you can bet a certain amount, and you know beforehand that the opponent's bet follows a distribution with p.d.f. $$f(x)$$ whose support is on $$[0, \infty)$$.

In a round, if your bet is higher you pay whatever the opponent's bet is; otherwise you lose the round and you pay nothing.

Suppose you have $$S \in [0, \infty)$$ amount of money to bet, and the goal is to win as many rounds as possible with the money in hand (in expectation), under the condition that you cannot spend more than $$S$$ almost surely.

If you lose the first round, clearly the best strategy is to bet $$S$$ in the second round, and if you win with a cost of $$C$$ in the first round, the best strategy is to bet $$S - C$$ in the second round. Now the problem simply boils down to a 1D optimization problem where the optimization variable is how much you should betin the first round. I'm having a hard time finding the analytical form of the solution.

• "the goal is to win as many rounds as possible": The number of rounds won is a random variable, so it can't be maximized. Do you mean that you want to maximize the expected number of rounds won? May 9 '20 at 23:24
• @joriki Yes, I've edited the question to make it more clear. May 10 '20 at 0:34

If you want to maximize the expected number of rounds won, there’s no point in foregoing a win in the first round to save money hoping for a win in the second round, since that would also just count for one win. Since how much you pay in the first round depends only on whether you win, not on how much you bet in order to win, you should bet the entire sum $$S$$ in the first round.
• How much you pay in the first round also depends on how much you bet right? i.e., $\int_0^b f(x)dx \cdot \int_0^b xf(x)dx$ in expectation if you bet $b$. May 10 '20 at 0:49
• What I was thinking is that the probability of winning under a bet $b$ is $\int_0^b f(x)dx$. And, the expected amount you would pay under the condition that you won under a bet $b$, would be $\int_0^b xf(x)dx$. Maybe I'm wrong somewhere, but I'm not able to see it. May 10 '20 at 1:08