# A Coin Flip Problem

Suppose I have $n$ fair coins, and I mark one of them for identification. Next I flip the $n$ coins without looking. My friend, who is looking on, now informs me that there were at least $k$ heads flipped.

What is the probability that my marked coin was heads?

• Is this a question from a course or textbook? If so, please add the [self-study] tag & read its wiki. – Stephan Kolassa Nov 29 '17 at 15:05
• @ Stephan Kolassa, The problem is not from a course or textbook, at least not one I know. – user120911 Nov 29 '17 at 15:49
• Do you believe the outcomes of the other $n-1$ coins somehow determine that probability? If so, please explain how. Otherwise, you may ignore them, allowing you to restate your question as "A fair coin is flipped: what is the probability it landed heads?" If you think that's anything but a trivial question, then its content must reside in what you mean by "fair," so please explain your meaning. – whuber Nov 29 '17 at 15:57
• @Whuber, if I am informed that 10 of 10 were heads, then the probability that the marked coin is heads is 1. If I am informed there were no heads, the probability of the marked coin being heads is 0. So, yes, the observation matters. I am interested in the probability conditional on the observation. – user120911 Nov 29 '17 at 16:17
• its k/n if it is exactly k and not "at least k". If it is "at least k" then it can be (k + 0.5(n-k))/n , but I am not sure – show_stopper Nov 29 '17 at 16:32

Let your coin be $X_1$ and denote sum of heads as $S$.

As I have written in the comment the answers seems to be

$$P(X_1 = 1| S \ge k) = \frac{\sum_{i = k}^{n} \binom{n-1}{i-1}}{\sum_{i=k}^{n}\binom{n}{i}}$$

Here is a plot of theoretical vs sample probabilities with $n = 20$ and 1e^7 trials We can see that with low values of $k$ we get almost no additional information, thus the probability is close to unconditional $0.5$

Partially recreated code as requested by @Maximilian

library(tidyverse)

coin_flips <- function(n, k) {
# Create n x k matrix of binary outcomes
flips <- matrix(as.numeric(rbinom(n * k, 1, 0.5)), ncol = k)
firsts <- flips[, 1]
flips <- t(apply(flips, 1, sort, decreasing = T)) # i-th column is an indicator value [S >= i]
# where S is the sum of heads
flips <- as.tibble(flips)
f <- function(x) {
if (sum(x) > 0) {
return(sum(x * firsts) / sum(x))
}
return(1)
}
summary <- flips %>%
summarise_all(.funs = f)
colnames(summary) <- 1:k
return(summary)
}
# Example usage
cf <- coin_flips(1000000, 20)
cf %>% gather %>% ggplot(aes(as.numeric(key), value)) + geom_point() + ylim(c(0.48, 1))

• The left asymptote at $0.5$ looks so unreasonable that you should consider elaborating on the assumptions you have made to derive this formula. In effect, it looks like you are allowing an arbitrary (and unnecessary) prior to dominate the solution when $k$ is small. – whuber Nov 29 '17 at 18:27
• @whuber Hmm, I thought the result is reasonable since for small k the probability of a condition $P(S \ge k)$ is close to 1, thus it brings no new information – Łukasz Grad Nov 29 '17 at 18:31
• There are at least two ways to interpret the question, "probability my marked coin was heads." After a conversation with the OP in comments to the question, I understand it to ask for the probability conditional on observing $k$ heads out of $n$ coins. The exchangeability of the distribution implies the answer is simply $k/n$. Because you are getting values that depart hugely from that number (and it seems they would still be close to $1/2$ even if $n$ were enormous), you must be adopting a very strong prior indeed. – whuber Nov 29 '17 at 18:52
• This is the answer to the posed question regardless of comments to the contrary. – Michael Chernick Nov 29 '17 at 20:09
• @Maximilian Ok I recreated the sample part – Łukasz Grad Jan 14 '18 at 12:11