The probability distribution of the number of coin flips needed to get $n$ heads or $k$ tails

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












Suppose we are flipping a fair coin. Let n,k be fixed numbers. We flip the coin until we get a total of n heads or a total of k tails. What is the probability distribution of the number of coin flips needed to get n heads or k tails? If it is easier, what is the expectation? The support of this discrete distribution is from the min(n,k) to n+k-1.







share|cite|improve this question























    up vote
    0
    down vote

    favorite












    Suppose we are flipping a fair coin. Let n,k be fixed numbers. We flip the coin until we get a total of n heads or a total of k tails. What is the probability distribution of the number of coin flips needed to get n heads or k tails? If it is easier, what is the expectation? The support of this discrete distribution is from the min(n,k) to n+k-1.







    share|cite|improve this question





















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Suppose we are flipping a fair coin. Let n,k be fixed numbers. We flip the coin until we get a total of n heads or a total of k tails. What is the probability distribution of the number of coin flips needed to get n heads or k tails? If it is easier, what is the expectation? The support of this discrete distribution is from the min(n,k) to n+k-1.







      share|cite|improve this question











      Suppose we are flipping a fair coin. Let n,k be fixed numbers. We flip the coin until we get a total of n heads or a total of k tails. What is the probability distribution of the number of coin flips needed to get n heads or k tails? If it is easier, what is the expectation? The support of this discrete distribution is from the min(n,k) to n+k-1.









      share|cite|improve this question










      share|cite|improve this question




      share|cite|improve this question









      asked 2 days ago









      Cihan T

      1




      1




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          0
          down vote













          The probability of getting the $n$-th head on the $r$-th toss,
          is that of the $r$-th toss being a head, and exactly $n-1$ of the first
          $r-1$ tosses being heads, that is $p_r=
          2^-rbinomr-1n-1$. In this case
          this probability is only relevant if $r-n<k$. There is a similar
          formula for the probability that the $k$-th tail occurs on the
          $r$-th toss, that is $q_r=2^-rbinomr-1k-1$. So the probability
          you seek is $p_r+q_r$ if $nle r<k+n$ and $kle r<k+n$, is $p_r$
          if $nle r<k+n$ and $k>r$ and is $q_r$ if
          if $kle r<k+n$ and $r>k$.






          share|cite|improve this answer





















          • Thank you! I think this is right. Is there a name for this distribution? I want to find a closed form for its expectation. Also, is there a way to find a multinomial version. By that I mean instead of a coin flip, we can have a roll of a die. We stop if we get k1 ones, or k2 twos etc until k6 sixes. It is probably elementary to figure it all out, but I was wondering if it had a name so that I can lookup properties, asymptotics etc. Thanks again.
            – Cihan T
            2 days ago

















          up vote
          0
          down vote













          This is a negative binomial distribution.



          Suppose that $X sim NegBin(r;p)$



          The probability mass function is given as



          $$f(k;r,p) equiv Pr(X=k) = binomk+r-1kp^k(1-p)^r $$



          where $k$ is the number of successes and $r$ is the number of failures with probability $p$



          We have



          $$E(X) = fracrp $$



          In your specific case we have



          $$ X sim NegBin(k;p) $$



          Then our mass function is
          $$f(n;k,p) equiv Pr(X=n) = binomn+k-1np^n(1-p)^k $$



          where we have $n$ heads and $k$ tails.
          Given that you said it was fair $p =frac12$



          $$f(n;k,p) equiv Pr(X=n) = binomn+k-1n(frac12)^n(frac12)^k $$
          $$f(n;k,p) equiv Pr(X=n) = binomn+k-1n(frac12)^n+k$$
          $$f(n;k,p) equiv Pr(X=n) = binomn+k-1n2^-(n+k)$$






          share|cite|improve this answer























          • There is no $n$ in your answer.
            – Lord Shark the Unknown
            2 days ago










          • Thanks for the response. It is not negative binomial because we stop either when we get n ones or k zeros.
            – Cihan T
            2 days ago










          • Ahh that is unfortunate..
            – Geronimo
            2 days ago










          Your Answer




          StackExchange.ifUsing("editor", function ()
          return StackExchange.using("mathjaxEditing", function ()
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          );
          );
          , "mathjax-editing");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "69"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2871708%2fthe-probability-distribution-of-the-number-of-coin-flips-needed-to-get-n-heads%23new-answer', 'question_page');

          );

          Post as a guest






























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          The probability of getting the $n$-th head on the $r$-th toss,
          is that of the $r$-th toss being a head, and exactly $n-1$ of the first
          $r-1$ tosses being heads, that is $p_r=
          2^-rbinomr-1n-1$. In this case
          this probability is only relevant if $r-n<k$. There is a similar
          formula for the probability that the $k$-th tail occurs on the
          $r$-th toss, that is $q_r=2^-rbinomr-1k-1$. So the probability
          you seek is $p_r+q_r$ if $nle r<k+n$ and $kle r<k+n$, is $p_r$
          if $nle r<k+n$ and $k>r$ and is $q_r$ if
          if $kle r<k+n$ and $r>k$.






          share|cite|improve this answer





















          • Thank you! I think this is right. Is there a name for this distribution? I want to find a closed form for its expectation. Also, is there a way to find a multinomial version. By that I mean instead of a coin flip, we can have a roll of a die. We stop if we get k1 ones, or k2 twos etc until k6 sixes. It is probably elementary to figure it all out, but I was wondering if it had a name so that I can lookup properties, asymptotics etc. Thanks again.
            – Cihan T
            2 days ago














          up vote
          0
          down vote













          The probability of getting the $n$-th head on the $r$-th toss,
          is that of the $r$-th toss being a head, and exactly $n-1$ of the first
          $r-1$ tosses being heads, that is $p_r=
          2^-rbinomr-1n-1$. In this case
          this probability is only relevant if $r-n<k$. There is a similar
          formula for the probability that the $k$-th tail occurs on the
          $r$-th toss, that is $q_r=2^-rbinomr-1k-1$. So the probability
          you seek is $p_r+q_r$ if $nle r<k+n$ and $kle r<k+n$, is $p_r$
          if $nle r<k+n$ and $k>r$ and is $q_r$ if
          if $kle r<k+n$ and $r>k$.






          share|cite|improve this answer





















          • Thank you! I think this is right. Is there a name for this distribution? I want to find a closed form for its expectation. Also, is there a way to find a multinomial version. By that I mean instead of a coin flip, we can have a roll of a die. We stop if we get k1 ones, or k2 twos etc until k6 sixes. It is probably elementary to figure it all out, but I was wondering if it had a name so that I can lookup properties, asymptotics etc. Thanks again.
            – Cihan T
            2 days ago












          up vote
          0
          down vote










          up vote
          0
          down vote









          The probability of getting the $n$-th head on the $r$-th toss,
          is that of the $r$-th toss being a head, and exactly $n-1$ of the first
          $r-1$ tosses being heads, that is $p_r=
          2^-rbinomr-1n-1$. In this case
          this probability is only relevant if $r-n<k$. There is a similar
          formula for the probability that the $k$-th tail occurs on the
          $r$-th toss, that is $q_r=2^-rbinomr-1k-1$. So the probability
          you seek is $p_r+q_r$ if $nle r<k+n$ and $kle r<k+n$, is $p_r$
          if $nle r<k+n$ and $k>r$ and is $q_r$ if
          if $kle r<k+n$ and $r>k$.






          share|cite|improve this answer













          The probability of getting the $n$-th head on the $r$-th toss,
          is that of the $r$-th toss being a head, and exactly $n-1$ of the first
          $r-1$ tosses being heads, that is $p_r=
          2^-rbinomr-1n-1$. In this case
          this probability is only relevant if $r-n<k$. There is a similar
          formula for the probability that the $k$-th tail occurs on the
          $r$-th toss, that is $q_r=2^-rbinomr-1k-1$. So the probability
          you seek is $p_r+q_r$ if $nle r<k+n$ and $kle r<k+n$, is $p_r$
          if $nle r<k+n$ and $k>r$ and is $q_r$ if
          if $kle r<k+n$ and $r>k$.







          share|cite|improve this answer













          share|cite|improve this answer



          share|cite|improve this answer











          answered 2 days ago









          Lord Shark the Unknown

          83.9k949111




          83.9k949111











          • Thank you! I think this is right. Is there a name for this distribution? I want to find a closed form for its expectation. Also, is there a way to find a multinomial version. By that I mean instead of a coin flip, we can have a roll of a die. We stop if we get k1 ones, or k2 twos etc until k6 sixes. It is probably elementary to figure it all out, but I was wondering if it had a name so that I can lookup properties, asymptotics etc. Thanks again.
            – Cihan T
            2 days ago
















          • Thank you! I think this is right. Is there a name for this distribution? I want to find a closed form for its expectation. Also, is there a way to find a multinomial version. By that I mean instead of a coin flip, we can have a roll of a die. We stop if we get k1 ones, or k2 twos etc until k6 sixes. It is probably elementary to figure it all out, but I was wondering if it had a name so that I can lookup properties, asymptotics etc. Thanks again.
            – Cihan T
            2 days ago















          Thank you! I think this is right. Is there a name for this distribution? I want to find a closed form for its expectation. Also, is there a way to find a multinomial version. By that I mean instead of a coin flip, we can have a roll of a die. We stop if we get k1 ones, or k2 twos etc until k6 sixes. It is probably elementary to figure it all out, but I was wondering if it had a name so that I can lookup properties, asymptotics etc. Thanks again.
          – Cihan T
          2 days ago




          Thank you! I think this is right. Is there a name for this distribution? I want to find a closed form for its expectation. Also, is there a way to find a multinomial version. By that I mean instead of a coin flip, we can have a roll of a die. We stop if we get k1 ones, or k2 twos etc until k6 sixes. It is probably elementary to figure it all out, but I was wondering if it had a name so that I can lookup properties, asymptotics etc. Thanks again.
          – Cihan T
          2 days ago










          up vote
          0
          down vote













          This is a negative binomial distribution.



          Suppose that $X sim NegBin(r;p)$



          The probability mass function is given as



          $$f(k;r,p) equiv Pr(X=k) = binomk+r-1kp^k(1-p)^r $$



          where $k$ is the number of successes and $r$ is the number of failures with probability $p$



          We have



          $$E(X) = fracrp $$



          In your specific case we have



          $$ X sim NegBin(k;p) $$



          Then our mass function is
          $$f(n;k,p) equiv Pr(X=n) = binomn+k-1np^n(1-p)^k $$



          where we have $n$ heads and $k$ tails.
          Given that you said it was fair $p =frac12$



          $$f(n;k,p) equiv Pr(X=n) = binomn+k-1n(frac12)^n(frac12)^k $$
          $$f(n;k,p) equiv Pr(X=n) = binomn+k-1n(frac12)^n+k$$
          $$f(n;k,p) equiv Pr(X=n) = binomn+k-1n2^-(n+k)$$






          share|cite|improve this answer























          • There is no $n$ in your answer.
            – Lord Shark the Unknown
            2 days ago










          • Thanks for the response. It is not negative binomial because we stop either when we get n ones or k zeros.
            – Cihan T
            2 days ago










          • Ahh that is unfortunate..
            – Geronimo
            2 days ago














          up vote
          0
          down vote













          This is a negative binomial distribution.



          Suppose that $X sim NegBin(r;p)$



          The probability mass function is given as



          $$f(k;r,p) equiv Pr(X=k) = binomk+r-1kp^k(1-p)^r $$



          where $k$ is the number of successes and $r$ is the number of failures with probability $p$



          We have



          $$E(X) = fracrp $$



          In your specific case we have



          $$ X sim NegBin(k;p) $$



          Then our mass function is
          $$f(n;k,p) equiv Pr(X=n) = binomn+k-1np^n(1-p)^k $$



          where we have $n$ heads and $k$ tails.
          Given that you said it was fair $p =frac12$



          $$f(n;k,p) equiv Pr(X=n) = binomn+k-1n(frac12)^n(frac12)^k $$
          $$f(n;k,p) equiv Pr(X=n) = binomn+k-1n(frac12)^n+k$$
          $$f(n;k,p) equiv Pr(X=n) = binomn+k-1n2^-(n+k)$$






          share|cite|improve this answer























          • There is no $n$ in your answer.
            – Lord Shark the Unknown
            2 days ago










          • Thanks for the response. It is not negative binomial because we stop either when we get n ones or k zeros.
            – Cihan T
            2 days ago










          • Ahh that is unfortunate..
            – Geronimo
            2 days ago












          up vote
          0
          down vote










          up vote
          0
          down vote









          This is a negative binomial distribution.



          Suppose that $X sim NegBin(r;p)$



          The probability mass function is given as



          $$f(k;r,p) equiv Pr(X=k) = binomk+r-1kp^k(1-p)^r $$



          where $k$ is the number of successes and $r$ is the number of failures with probability $p$



          We have



          $$E(X) = fracrp $$



          In your specific case we have



          $$ X sim NegBin(k;p) $$



          Then our mass function is
          $$f(n;k,p) equiv Pr(X=n) = binomn+k-1np^n(1-p)^k $$



          where we have $n$ heads and $k$ tails.
          Given that you said it was fair $p =frac12$



          $$f(n;k,p) equiv Pr(X=n) = binomn+k-1n(frac12)^n(frac12)^k $$
          $$f(n;k,p) equiv Pr(X=n) = binomn+k-1n(frac12)^n+k$$
          $$f(n;k,p) equiv Pr(X=n) = binomn+k-1n2^-(n+k)$$






          share|cite|improve this answer















          This is a negative binomial distribution.



          Suppose that $X sim NegBin(r;p)$



          The probability mass function is given as



          $$f(k;r,p) equiv Pr(X=k) = binomk+r-1kp^k(1-p)^r $$



          where $k$ is the number of successes and $r$ is the number of failures with probability $p$



          We have



          $$E(X) = fracrp $$



          In your specific case we have



          $$ X sim NegBin(k;p) $$



          Then our mass function is
          $$f(n;k,p) equiv Pr(X=n) = binomn+k-1np^n(1-p)^k $$



          where we have $n$ heads and $k$ tails.
          Given that you said it was fair $p =frac12$



          $$f(n;k,p) equiv Pr(X=n) = binomn+k-1n(frac12)^n(frac12)^k $$
          $$f(n;k,p) equiv Pr(X=n) = binomn+k-1n(frac12)^n+k$$
          $$f(n;k,p) equiv Pr(X=n) = binomn+k-1n2^-(n+k)$$







          share|cite|improve this answer















          share|cite|improve this answer



          share|cite|improve this answer








          edited 2 days ago


























          answered 2 days ago









          Geronimo

          807715




          807715











          • There is no $n$ in your answer.
            – Lord Shark the Unknown
            2 days ago










          • Thanks for the response. It is not negative binomial because we stop either when we get n ones or k zeros.
            – Cihan T
            2 days ago










          • Ahh that is unfortunate..
            – Geronimo
            2 days ago
















          • There is no $n$ in your answer.
            – Lord Shark the Unknown
            2 days ago










          • Thanks for the response. It is not negative binomial because we stop either when we get n ones or k zeros.
            – Cihan T
            2 days ago










          • Ahh that is unfortunate..
            – Geronimo
            2 days ago















          There is no $n$ in your answer.
          – Lord Shark the Unknown
          2 days ago




          There is no $n$ in your answer.
          – Lord Shark the Unknown
          2 days ago












          Thanks for the response. It is not negative binomial because we stop either when we get n ones or k zeros.
          – Cihan T
          2 days ago




          Thanks for the response. It is not negative binomial because we stop either when we get n ones or k zeros.
          – Cihan T
          2 days ago












          Ahh that is unfortunate..
          – Geronimo
          2 days ago




          Ahh that is unfortunate..
          – Geronimo
          2 days ago












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2871708%2fthe-probability-distribution-of-the-number-of-coin-flips-needed-to-get-n-heads%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          What is the equation of a 3D cone with generalised tilt?

          Relationship between determinant of matrix and determinant of adjoint?

          Color the edges and diagonals of a regular polygon