Optimal betting strategy in game with biased coin

We have a biased coin with probability of heads p. We win $1 if we predict the number of heads correctly. Otherwise, nothing. How would one go to develop the optimal betting strategy to maximize expected earnings in a two coin toss game? That is, what is the number of heads we should predict in two coin tosses to maximize expected winnings? 2 Answers Since you win \$1 if you guess correctly, the expected winning is equal to the probability that you are correct. Let the number of heads be denoted by $X$. $$P(X=0)=(1-p)^2\\ P(X=1)=2p(1-p)\\ P(X=2)=p^2$$ To maximize the probability of being right, you need to pick the value of $X$ that has the highest probability.

You can show that if $0\le p\le 1/3$, $X=0$ has the highest probability, if $1/3\le p\le 2/3$, $X=2$ has the highest probability, and if $1/3\le p\le 1$, $X=2$ has the highest probability. For $2$ coins, the probability of 2 heads is $p^2$ and probability of 2 tails is $(1-p)^2$. The probability of exactly one heads is $2p(1-p)$. Based on the value of $p$, you should choose the number of predicted heads. In general, if $X$ is the number of heads in a sequence of $n$ tosses and $X_i$ is an IRV such that $X_i = 1$ if $i^{th}$ toss is heads and 0 otherwise, then

$$E(X) = np$$

This is the average number of heads you expect to see. For 2 coin toss, you should bet on seeing 1 head in 2 tosses if $p=1/2$. For $p=1$, you would bet on 2 heads.