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?

  • 2
    $\begingroup$ Is this a question from a course or textbook? If so, please add the [self-study] tag & read its wiki. $\endgroup$ – Stephan Kolassa Nov 29 '17 at 15:05
  • $\begingroup$ @ Stephan Kolassa, The problem is not from a course or textbook, at least not one I know. $\endgroup$ – user120911 Nov 29 '17 at 15:49
  • $\begingroup$ 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. $\endgroup$ – whuber Nov 29 '17 at 15:57
  • 1
    $\begingroup$ @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. $\endgroup$ – user120911 Nov 29 '17 at 16:17
  • 1
    $\begingroup$ 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 $\endgroup$ – 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

enter image description here

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


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))
    summary <- flips %>%
        summarise_all(.funs = f)
    colnames(summary) <- 1:k
# Example usage
cf <- coin_flips(1000000, 20)
cf %>% gather %>% ggplot(aes(as.numeric(key), value)) + geom_point() + ylim(c(0.48, 1))
  • $\begingroup$ 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. $\endgroup$ – whuber Nov 29 '17 at 18:27
  • $\begingroup$ @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 $\endgroup$ – Łukasz Grad Nov 29 '17 at 18:31
  • $\begingroup$ 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. $\endgroup$ – whuber Nov 29 '17 at 18:52
  • 2
    $\begingroup$ This is the answer to the posed question regardless of comments to the contrary. $\endgroup$ – Michael R. Chernick Nov 29 '17 at 20:09
  • 2
    $\begingroup$ @Maximilian Ok I recreated the sample part $\endgroup$ – Łukasz Grad Jan 14 '18 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.