2

If I flip three coins, and guess the outcome before each flip, what is the probability I get at least two correct out of three? I can't wrap my head around this...a simple explanation would be great!

I know the answer is 50%, but I don't know why. I wrote a quick program to verify this.

import java.util.Random;
public class Random1 {
public static void main(String args[]) {
    double twoRight = 0;
    int numTrials = 10000000;
    for (int i = 0; i < numTrials; i++) {
        Random r = new Random();
        int guess1 = r.nextInt(2), guess2 = r.nextInt(2), guess3 = r.nextInt(2);
        int actual1 = r.nextInt(2), actual2 = r.nextInt(2), actual3 = r.nextInt(2);
        int correct = 0;
        if (guess1 == actual1) { correct++; }
        if (guess2 == actual2) { correct++; }
        if (guess3 == actual3) { correct++; }
        if (correct >= 2) {twoRight++;}
    }
    System.out.println("two right: " + twoRight);
    System.out.println("numTrials: " + numTrials);
    System.out.println("% both right: " + (twoRight / numTrials * 100.0) );
}
}
banncee
  • 123
  • 4
    Similar to this one.There is a nice argument by symmetry: you either get at least 2 right, or you get at least 2 wrong; these events are equally likely. –  Feb 16 '16 at 15:37
  • The difference is that in the linked question, you know you are looking for at least two heads - it's not a guess each time. In that question, symmetry or the write out combinations approach is available. – banncee Feb 16 '16 at 15:50
  • Think of it this way: each time you guess, you have a 50% chance to guess correctly. It doesn't matter whether you base your guess on previous flips or on your astrological sign: whatever you guess, the coin has a 50% chance to agree and a 50% chance to disagree. So instead of sequences $HHH$, $HHT$, etc., think of sequences $RRR$, $RRW$, etc., where $R$ means you guessed "right" and $W$ means you guessed "wrong". It's still true that every sequence of $R$ and $W$ is equally likely to occur, just as it was with sequences of $H$ and $T$. – David K Feb 16 '16 at 16:22
  • Thanks, that makes perfect sense now. I just needed to turn the result around and look at the Rs and Ws. Don't have enough rep to upvote original comment - will as soon as I can! – banncee Feb 17 '16 at 18:37

1 Answers1

2

The number $X$ of correct guesses is a binomial random variable with parameters $n=3$ and $p=1/2$. You want to calculate the probability $$P(X\ge 2)$$ so, by the formula of the binomial distribution you have that \begin{align}P(X\ge 2)&=P(X=2)+P(X=3)\\[0.2cm]&=\dbinom{3}{2}(1/2)^2(1/2)^{3-2}+\dbinom{3}{3}(1/2)^3(1/2)^{3-3}=(1/2)^3(3+1)=1/2\end{align} or equivalently $P(X\ge 2)=50\%$ as your answer indicates.

Jimmy R.
  • 35,868
  • 1
    Thank you! The explanation of the why the probability mass function works makes total sense. I just wouldn't have figured this out by writing out the combinations on paper... – banncee Feb 16 '16 at 15:45