Expecting HTH - Coin Quant Interview Question

Поделиться
HTML-код
  • Опубликовано: 11 дек 2024

Комментарии • 8

  • @FRANKONATOR123
    @FRANKONATOR123 5 месяцев назад +2

    Could you also treat this as a geometric distribution with p=1/8 and then you add 2 to the mean of that to account for the length of the sequence?

    • @QuantQuestionsio
      @QuantQuestionsio  5 месяцев назад +1

      Yeah it gives the correct solution - but the reasoning may not be correct.
      I see how you got to it, batch flips into 3 coin flip, and treat them as one event.
      The probability of HTH is thus (1/2)^3 = 1/8
      The expected value of a geometric distribution is 1/p = 1/(1/8) = 8
      Meaning it'll take on average 8 flips to get to this situation, then add 2, because you need to account for the 2 other coins in the group of 3 to get 10 flips as your answer
      This batching doesn't account for overlap, such as HH in the HTH case.
      Try finding the number of flips with both methods for HHH and you can see the lack of overlap cases results in a larger expected value.
      EDIT: Thank you CelestiaAstronomy for pointing this out

    • @CelestiaAstronomy
      @CelestiaAstronomy 2 месяца назад +1

      I don't think that's possible, because the probability of each occurrence is dependent upon the prior failure. The probability of getting HTH on the N th flip given that we are failing on the N-1 and N-2 flip is not 1/8.
      Imagine the question is asking about getting HHH instead of HTH. If we use your method, we will get the same answer (10). But if we use recursion like in the video, we'll get 14 flips

    • @QuantQuestionsio
      @QuantQuestionsio  2 месяца назад +1

      @@CelestiaAstronomy After careful review, the geometric distribution method is wrong and wouldn't yield the same answer.
      See the recursive approach:
      - 50% chance of tails on the first flip: 1/2 * (X+1)
      - 25% chance of heads then tails on the second flip: 1/4 * (X+2)
      - 12.5% chance of heads, heads then tails on the third fllip: 1/8 * (X+3)
      - 12.5% chance of heads, heads, and heads thats a win: 1/8 * (X+3)
      ^^ The method from the video yields a value of 14 - different from 10.
      This is because there is some overlap between the values in the HTH case, specifically if you get HH.
      This breaks the sequence but you're not starting from the start again, instead your starting from H.
      The geometric distribution standpoint simply happened to work in the HTH case, but in general is wrong because it doesn't account for this overlap correctly.
      Thanks for pointing that out Celestia :)

    • @CelestiaAstronomy
      @CelestiaAstronomy 2 месяца назад

      @@QuantQuestionsio On the third flip, 12.5% chance of heads that yield a win, should be 1/8 * (3) right? So the equation is:
      X = 1/2*(X+1) + 1/4*(X+2) + 1/8*(X+3) + 1/8*(3)
      If I use this equation, I get X=14. Somehow it is harder to get HHH then getting HTH. I don't know if this is true.. it felt so counter intuitive for me
      Btw, love your videos! Keep up the good work :)

    • @QuantQuestionsio
      @QuantQuestionsio  2 месяца назад

      ​@@CelestiaAstronomy You are right! - I updated the previous comment to showcase this, thank you Celelstia

  • @jewelmohajan9326
    @jewelmohajan9326 Месяц назад

    the reasoning of +1 and -1 for the HH case is not correct, it only worked out (by chance) because the coin is fair.

    • @FreeAccountReddit
      @FreeAccountReddit Месяц назад

      I did not like that rationale either. What is the correct reasoning for it being x again?