# Flipping a randomly-lopsided coin

Whenever the Lopsided Mint stamps a coin, its heads-bias $p$ is chosen uniformly at random between $0$ to $1$, which makes it have a probability $p$ of landing heads when flipped. Bob takes a random coin and flips it 10 times. Whats count(s) of heads is he most likely to obtain?

We're looking for the mode, not the expectation. The answer should not depend on $p$, since the coin's bias is unknown.

(You can solve this by doing some integrals, but there's an elegant argument with no calculation or algebra.)

• I'd be stunned if the answer wasn't five, but that seems way too trivial, so it's probably not. – No. 7892142 Jan 20 '15 at 7:43
• Is it really possible to make a coin that lands on a given side 100% of the time? (p = 0 or p = 1) – EFrog Jan 20 '15 at 8:45
• @EFrog Sure you can. – xnor Jan 20 '15 at 8:49
• It seems that the gömböc does not actually land on a given side 100% of the time, since it may land and stay still on its unstable equilibrium point. – March Ho Jan 20 '15 at 9:19
• @MarchHo A coin doesn't land on head or tail all the time it is tossed. Sometime it may rest on the edge. – Mohit Jain Jan 20 '15 at 12:37

All numbers from 0 to 10 are equally likely.

Here is one way to flip a coin with bias $p$. Choose a random number uniformly from $(0,1)$, and pick heads if that number is less than $p$.

This gives us a way to simulate Bob's experiment. We choose $p$ uniformly from $(0,1)$, and then choose ten coin-flip numbers uniformly from $(0,1)$. The number of heads is equal to the number of coin-flip numbers less than $p$.

During this simulation, we choose 11 numbers independently and uniformly from $(0,1)$. By symmetry, there is an equal chance of the first chosen number turning out to be the smallest, second smallest, third smallest, ..., or eleventh smallest of the numbers. And the first chosen number is $p$. So by symmetry, there is an equal chance of Bob flipping 0, 1, 2, ..., or 10 heads.

Either every number between 0 and 10 (inclusive), or the mode doesn't exist, depending on whether you think the mode of a uniform distribution does or does not have a mode.

Reasoning:

The probability of getting $k$ heads is $$p(k) = \int_0^1 \binom{10}k x^k(10-x)^{10-k}dx$$ Integrating $p(k+1)$ by parts yields $$p(k+1) = \int_0^1 \binom{10}{k+1}\frac{k+1}{10-k}x^{k+1}(1-x)^{10-k}dx - \left(\left.\frac 1 {10-k} x^{k+1}(1-x)^{10-k}\right|_0^1\right)$$ The last term vanishes for all k between 0 and 9 (it's undefined for $k=10$). Using the fact that $\binom{10}{k+1} = \frac{10-k}{k+1}\binom{10}k$, the above simplifies to $p(k+1) = p(k)$, valid for for all integral $k$ from 0 to 9. Since $p(0)=\int_0^1 (1-x)^{10}dx = 1/11$, we have $p(k)=1/11$ for all $k$ from 0 to 9 by induction. Finally, $p(10)$ is easily integrated; it too is $1/11$. This is a uniform distribution. There is no mode (or alternately, all integers from 0 to 10 are the mode).

• That's a neat solution, relating the integral for p(k+1) to p(k) by integration by parts. I'd only seen them done out directly with beta functions and gamma functions. – xnor Jan 21 '15 at 2:56

All the counts are equally likely

And the reasoning is

Likeliness to get n heads = $\int_0^1\ {p^n*(1-p)^{10-n}}\text{ }dp$ * 10Cn
You want n heads(probability pn) and (10-n) tails(probability (1-p)(10 - n)) and there are 10Cn ways to get n heads out of 10 tosses

Solving for n from 0 to 10
N = 0 and N = 10: (111/11 - 011/11) = 1/11
N = 1 and N = 9: ((110/10 - 111/11) - (010/10 - 011/11)) * (10) / (1) = 1/11
N = 2 and N = 8: ((19/9 - 110/5 + 111/11) - (09/9 - 010/5 + 011/11)) * (10 * 9) / (1 * 2) = 1/11
N = 3 and N = 7: ((18/8 - 19/3 + 3 * 110/10 - 111/11) - (08/8 - 09/3 + 3 * 010/10 - 011/11)) * (10 * 9 * 8) / (1 * 2 * 3) = 1/11
N = 4 and N = 6: ((17/7 - 18/2 + 2 * 19/9 - 2 * 110/5 + 111/11) - (17/7 - 18/2 + 2 * 19/9 - 2 * 110/5 + 111/11)) * (10 * 9 * 8 * 7) / (1 * 2 * 3 * 4) = 1/11
N = 5: ((16/6 - 5 * 17/7 + 5 * 18/4 - 10 * 19/9 + 110/2 - 111/11) - (06/6 - 5 * 07/7 + 5 * 08/4 - 10 * 09/9 + 010/2 - 011/11)) * (10 * 9 * 8 * 7 * 6) / (1 * 2 * 3 * 4 * 5) = 1/11

• We're looking for the mode, not the expectation. – xnor Jan 20 '15 at 8:34

5

Why?

The coin can be biased in either direction. There is equal probability for the bias to be p or 1-p. Such coins "even" themselves-out. If we throw both of them, our expectation for "number of heads" is 1. Thus each coin has, such a counterpart. Because of that the expectation of "number of heads" for a randomly chosen p (that is a coin with such p) is 0.5. The expectation for 10 flips is 5.

• We're looking for the mode, not the expectation. – xnor Jan 20 '15 at 8:34
• @xnor If it is not 5, then there should be two answers. Therefore it is 5 :D – dmg Jan 20 '15 at 9:12
• @dmg What's wrong with there being two answers? The question says "Whats count(s) of heads is he most likely to obtain?" – Lopsy Jan 20 '15 at 10:25
• @Lopsy missed the (s) part – dmg Jan 20 '15 at 10:26

The mode of a given binomial distribution is floor((n+1)p), except when (n+1)p is an integer, in which case the mode is (n+1)p and (n+1)p - 1.

We can ignore all the non-integer values, since they are equally distributed over the 11 possible values for the mode. (You can show this with an Excel spreadsheet).

Therefore, we only need to look at the integer values of (n+1)p. When p is 0/11 or 11/11, the mode is 0 or 10. When p is n/11, where n ranges from 1 to 10, the mode is n and n-1. Therefore, for all values of mode from 0 to 10, there are two cases where the mode falls on it.

Therefore, there is no mode for this distribution of modes, assuming the spread is uniform.

• This is an incorrect way to get to the correct answer. You can't look at a mode of the modes, and the set of values where (n+1)p is an integer is a space of measure zero and therefore contributes nothing. – David Hammen Jan 20 '15 at 15:14
• @DavidHammen Care to explain why you can't look at the distribution of the modes? Also, if the spaces have measure zero and are excluded, the first argument still stands. – March Ho Jan 20 '15 at 17:13

A complete statistical answer can be found Here, on another SE question.

? It turns out that each count is equally likely, for any n.

? Basic approach is that the count at each level is dependent on n and p. If p itself is a random variable ( here, p ~ Uniform(0,1) ), it can be "integrated out" and shown to be constant for any chosen n.