Variance of Coin Flips Until H

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





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
1
down vote

favorite
1












If we flip a fair coin until we get heads, what is the variance of the number of flips to do this?



My attempt is:



$$E(flips):=Y=1times P(H)+(1+Y)times P(T)$$
$$Rightarrow Y=frac12+frac1+Y2$$
$$Rightarrow Y=2$$
I know this is correct. Now we attempt to compute:



$$E(flips^2):=X=1^2times P(H)+(sqrtX+1)^2times P(T)$$



$$Rightarrow X=frac12+frac(sqrtX+1)^22$$



$$Rightarrow X=2(2+sqrt 3)$$



I know the right answer is $E(flips^2)=6$, but I'm not sure how to solve it using this recursive strategy, as the above seemed most natural to me.*



*ie take the expected value $X$, square root it to get the number of flips (not squared), add one, then square it again.










share|cite|improve this question







New contributor




Dan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    up vote
    1
    down vote

    favorite
    1












    If we flip a fair coin until we get heads, what is the variance of the number of flips to do this?



    My attempt is:



    $$E(flips):=Y=1times P(H)+(1+Y)times P(T)$$
    $$Rightarrow Y=frac12+frac1+Y2$$
    $$Rightarrow Y=2$$
    I know this is correct. Now we attempt to compute:



    $$E(flips^2):=X=1^2times P(H)+(sqrtX+1)^2times P(T)$$



    $$Rightarrow X=frac12+frac(sqrtX+1)^22$$



    $$Rightarrow X=2(2+sqrt 3)$$



    I know the right answer is $E(flips^2)=6$, but I'm not sure how to solve it using this recursive strategy, as the above seemed most natural to me.*



    *ie take the expected value $X$, square root it to get the number of flips (not squared), add one, then square it again.










    share|cite|improve this question







    New contributor




    Dan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      1
      down vote

      favorite
      1









      up vote
      1
      down vote

      favorite
      1






      1





      If we flip a fair coin until we get heads, what is the variance of the number of flips to do this?



      My attempt is:



      $$E(flips):=Y=1times P(H)+(1+Y)times P(T)$$
      $$Rightarrow Y=frac12+frac1+Y2$$
      $$Rightarrow Y=2$$
      I know this is correct. Now we attempt to compute:



      $$E(flips^2):=X=1^2times P(H)+(sqrtX+1)^2times P(T)$$



      $$Rightarrow X=frac12+frac(sqrtX+1)^22$$



      $$Rightarrow X=2(2+sqrt 3)$$



      I know the right answer is $E(flips^2)=6$, but I'm not sure how to solve it using this recursive strategy, as the above seemed most natural to me.*



      *ie take the expected value $X$, square root it to get the number of flips (not squared), add one, then square it again.










      share|cite|improve this question







      New contributor




      Dan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      If we flip a fair coin until we get heads, what is the variance of the number of flips to do this?



      My attempt is:



      $$E(flips):=Y=1times P(H)+(1+Y)times P(T)$$
      $$Rightarrow Y=frac12+frac1+Y2$$
      $$Rightarrow Y=2$$
      I know this is correct. Now we attempt to compute:



      $$E(flips^2):=X=1^2times P(H)+(sqrtX+1)^2times P(T)$$



      $$Rightarrow X=frac12+frac(sqrtX+1)^22$$



      $$Rightarrow X=2(2+sqrt 3)$$



      I know the right answer is $E(flips^2)=6$, but I'm not sure how to solve it using this recursive strategy, as the above seemed most natural to me.*



      *ie take the expected value $X$, square root it to get the number of flips (not squared), add one, then square it again.







      variance expected-value






      share|cite|improve this question







      New contributor




      Dan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|cite|improve this question







      New contributor




      Dan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|cite|improve this question




      share|cite|improve this question






      New contributor




      Dan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 3 hours ago









      Dan

      82




      82




      New contributor




      Dan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Dan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Dan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          You are essentially using the Law of Total Expectation; see the accepted answer here for a review: https://math.stackexchange.com/questions/521609/finding-expected-value-with-recursion.



          Let $N$ be the number of flips required until the first heads appears, and let $H_1$ be the indicator of a heads on the first flip; i.e. $H_1 = 1$ if the first flip is heads and $H_1 = 0$ if it is tails. We will compute $E(N^2)$ using the Law of Total Expectation:
          $$E(N^2) = E(E(N^2 | H_1)).$$
          The conditional expectation $E(N^2 | H_1)$ is a random variable; in particular it is a function of $H_1$. Let's find its distribution. Conditional on $H_1 = 1$ (i.e. when the first flip is heads), the number of flips until heads appears will of course be one, so $E(N^2 | H_1 = 1) = 1^2$. Conditional on $H_1 = 0$ (when the first flip is tails), the number of flips until heads appears will be one more than in the unconditional case, hence the conditional expectation is $E(N^2 | H_1 = 0) = E((N + 1)^2) = E(N^2) + 2E(N) + 1$. Thus
          beginalign E(N^2) & = E(E(N^2 | H_1)) \
          & = 1^2 cdot frac12 + (E(N^2) + 2E(N) + 1)cdot 1/2 \
          & = frac12 + (E(N^2) + 2(2) + 1)cdot 1/2. \
          endalign

          Solving the equation, we find that $E(N^2) = 6$ and then $Var(N) = 6 - 2^2 = 2$.






          share|cite|improve this answer





























            up vote
            1
            down vote













            Although this doesn't follow your recursive approach, you can use the geometric distribution's properties here.



            You have $X$, which I will refer to as $flips$ from now on, is distributed according to $Geometric(p=0.5)$.



            Recall the definition of Variance, $Var(flips)=E(flips^2) + [E(flips)]^2$



            where,
            $Var(flips)=frac1-pp^2$ and $E(flips)=frac1p$.



            Thus, $E(flips^2)=Var(flips) + [E(flips)]^2 = 2+4 = 6$.






            share|cite|improve this answer










            New contributor




            OUrista is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.

















              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: "65"
              ;
              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: false,
              noModals: false,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );






              Dan is a new contributor. Be nice, and check out our Code of Conduct.









               

              draft saved


              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f373195%2fvariance-of-coin-flips-until-h%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
              3
              down vote



              accepted










              You are essentially using the Law of Total Expectation; see the accepted answer here for a review: https://math.stackexchange.com/questions/521609/finding-expected-value-with-recursion.



              Let $N$ be the number of flips required until the first heads appears, and let $H_1$ be the indicator of a heads on the first flip; i.e. $H_1 = 1$ if the first flip is heads and $H_1 = 0$ if it is tails. We will compute $E(N^2)$ using the Law of Total Expectation:
              $$E(N^2) = E(E(N^2 | H_1)).$$
              The conditional expectation $E(N^2 | H_1)$ is a random variable; in particular it is a function of $H_1$. Let's find its distribution. Conditional on $H_1 = 1$ (i.e. when the first flip is heads), the number of flips until heads appears will of course be one, so $E(N^2 | H_1 = 1) = 1^2$. Conditional on $H_1 = 0$ (when the first flip is tails), the number of flips until heads appears will be one more than in the unconditional case, hence the conditional expectation is $E(N^2 | H_1 = 0) = E((N + 1)^2) = E(N^2) + 2E(N) + 1$. Thus
              beginalign E(N^2) & = E(E(N^2 | H_1)) \
              & = 1^2 cdot frac12 + (E(N^2) + 2E(N) + 1)cdot 1/2 \
              & = frac12 + (E(N^2) + 2(2) + 1)cdot 1/2. \
              endalign

              Solving the equation, we find that $E(N^2) = 6$ and then $Var(N) = 6 - 2^2 = 2$.






              share|cite|improve this answer


























                up vote
                3
                down vote



                accepted










                You are essentially using the Law of Total Expectation; see the accepted answer here for a review: https://math.stackexchange.com/questions/521609/finding-expected-value-with-recursion.



                Let $N$ be the number of flips required until the first heads appears, and let $H_1$ be the indicator of a heads on the first flip; i.e. $H_1 = 1$ if the first flip is heads and $H_1 = 0$ if it is tails. We will compute $E(N^2)$ using the Law of Total Expectation:
                $$E(N^2) = E(E(N^2 | H_1)).$$
                The conditional expectation $E(N^2 | H_1)$ is a random variable; in particular it is a function of $H_1$. Let's find its distribution. Conditional on $H_1 = 1$ (i.e. when the first flip is heads), the number of flips until heads appears will of course be one, so $E(N^2 | H_1 = 1) = 1^2$. Conditional on $H_1 = 0$ (when the first flip is tails), the number of flips until heads appears will be one more than in the unconditional case, hence the conditional expectation is $E(N^2 | H_1 = 0) = E((N + 1)^2) = E(N^2) + 2E(N) + 1$. Thus
                beginalign E(N^2) & = E(E(N^2 | H_1)) \
                & = 1^2 cdot frac12 + (E(N^2) + 2E(N) + 1)cdot 1/2 \
                & = frac12 + (E(N^2) + 2(2) + 1)cdot 1/2. \
                endalign

                Solving the equation, we find that $E(N^2) = 6$ and then $Var(N) = 6 - 2^2 = 2$.






                share|cite|improve this answer
























                  up vote
                  3
                  down vote



                  accepted







                  up vote
                  3
                  down vote



                  accepted






                  You are essentially using the Law of Total Expectation; see the accepted answer here for a review: https://math.stackexchange.com/questions/521609/finding-expected-value-with-recursion.



                  Let $N$ be the number of flips required until the first heads appears, and let $H_1$ be the indicator of a heads on the first flip; i.e. $H_1 = 1$ if the first flip is heads and $H_1 = 0$ if it is tails. We will compute $E(N^2)$ using the Law of Total Expectation:
                  $$E(N^2) = E(E(N^2 | H_1)).$$
                  The conditional expectation $E(N^2 | H_1)$ is a random variable; in particular it is a function of $H_1$. Let's find its distribution. Conditional on $H_1 = 1$ (i.e. when the first flip is heads), the number of flips until heads appears will of course be one, so $E(N^2 | H_1 = 1) = 1^2$. Conditional on $H_1 = 0$ (when the first flip is tails), the number of flips until heads appears will be one more than in the unconditional case, hence the conditional expectation is $E(N^2 | H_1 = 0) = E((N + 1)^2) = E(N^2) + 2E(N) + 1$. Thus
                  beginalign E(N^2) & = E(E(N^2 | H_1)) \
                  & = 1^2 cdot frac12 + (E(N^2) + 2E(N) + 1)cdot 1/2 \
                  & = frac12 + (E(N^2) + 2(2) + 1)cdot 1/2. \
                  endalign

                  Solving the equation, we find that $E(N^2) = 6$ and then $Var(N) = 6 - 2^2 = 2$.






                  share|cite|improve this answer














                  You are essentially using the Law of Total Expectation; see the accepted answer here for a review: https://math.stackexchange.com/questions/521609/finding-expected-value-with-recursion.



                  Let $N$ be the number of flips required until the first heads appears, and let $H_1$ be the indicator of a heads on the first flip; i.e. $H_1 = 1$ if the first flip is heads and $H_1 = 0$ if it is tails. We will compute $E(N^2)$ using the Law of Total Expectation:
                  $$E(N^2) = E(E(N^2 | H_1)).$$
                  The conditional expectation $E(N^2 | H_1)$ is a random variable; in particular it is a function of $H_1$. Let's find its distribution. Conditional on $H_1 = 1$ (i.e. when the first flip is heads), the number of flips until heads appears will of course be one, so $E(N^2 | H_1 = 1) = 1^2$. Conditional on $H_1 = 0$ (when the first flip is tails), the number of flips until heads appears will be one more than in the unconditional case, hence the conditional expectation is $E(N^2 | H_1 = 0) = E((N + 1)^2) = E(N^2) + 2E(N) + 1$. Thus
                  beginalign E(N^2) & = E(E(N^2 | H_1)) \
                  & = 1^2 cdot frac12 + (E(N^2) + 2E(N) + 1)cdot 1/2 \
                  & = frac12 + (E(N^2) + 2(2) + 1)cdot 1/2. \
                  endalign

                  Solving the equation, we find that $E(N^2) = 6$ and then $Var(N) = 6 - 2^2 = 2$.







                  share|cite|improve this answer














                  share|cite|improve this answer



                  share|cite|improve this answer








                  edited 59 mins ago

























                  answered 1 hour ago









                  Gordon Honerkamp-Smith

                  1546




                  1546






















                      up vote
                      1
                      down vote













                      Although this doesn't follow your recursive approach, you can use the geometric distribution's properties here.



                      You have $X$, which I will refer to as $flips$ from now on, is distributed according to $Geometric(p=0.5)$.



                      Recall the definition of Variance, $Var(flips)=E(flips^2) + [E(flips)]^2$



                      where,
                      $Var(flips)=frac1-pp^2$ and $E(flips)=frac1p$.



                      Thus, $E(flips^2)=Var(flips) + [E(flips)]^2 = 2+4 = 6$.






                      share|cite|improve this answer










                      New contributor




                      OUrista is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.





















                        up vote
                        1
                        down vote













                        Although this doesn't follow your recursive approach, you can use the geometric distribution's properties here.



                        You have $X$, which I will refer to as $flips$ from now on, is distributed according to $Geometric(p=0.5)$.



                        Recall the definition of Variance, $Var(flips)=E(flips^2) + [E(flips)]^2$



                        where,
                        $Var(flips)=frac1-pp^2$ and $E(flips)=frac1p$.



                        Thus, $E(flips^2)=Var(flips) + [E(flips)]^2 = 2+4 = 6$.






                        share|cite|improve this answer










                        New contributor




                        OUrista is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.



















                          up vote
                          1
                          down vote










                          up vote
                          1
                          down vote









                          Although this doesn't follow your recursive approach, you can use the geometric distribution's properties here.



                          You have $X$, which I will refer to as $flips$ from now on, is distributed according to $Geometric(p=0.5)$.



                          Recall the definition of Variance, $Var(flips)=E(flips^2) + [E(flips)]^2$



                          where,
                          $Var(flips)=frac1-pp^2$ and $E(flips)=frac1p$.



                          Thus, $E(flips^2)=Var(flips) + [E(flips)]^2 = 2+4 = 6$.






                          share|cite|improve this answer










                          New contributor




                          OUrista is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.









                          Although this doesn't follow your recursive approach, you can use the geometric distribution's properties here.



                          You have $X$, which I will refer to as $flips$ from now on, is distributed according to $Geometric(p=0.5)$.



                          Recall the definition of Variance, $Var(flips)=E(flips^2) + [E(flips)]^2$



                          where,
                          $Var(flips)=frac1-pp^2$ and $E(flips)=frac1p$.



                          Thus, $E(flips^2)=Var(flips) + [E(flips)]^2 = 2+4 = 6$.







                          share|cite|improve this answer










                          New contributor




                          OUrista is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.









                          share|cite|improve this answer



                          share|cite|improve this answer








                          edited 56 mins ago





















                          New contributor




                          OUrista is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.









                          answered 1 hour ago









                          OUrista

                          112




                          112




                          New contributor




                          OUrista is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.





                          New contributor





                          OUrista is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.






                          OUrista is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.




















                              Dan is a new contributor. Be nice, and check out our Code of Conduct.









                               

                              draft saved


                              draft discarded


















                              Dan is a new contributor. Be nice, and check out our Code of Conduct.












                              Dan is a new contributor. Be nice, and check out our Code of Conduct.











                              Dan is a new contributor. Be nice, and check out our Code of Conduct.













                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f373195%2fvariance-of-coin-flips-until-h%23new-answer', 'question_page');

                              );

                              Post as a guest













































































                              Comments

                              Popular posts from this blog

                              What does second last employer means? [closed]

                              Installing NextGIS Connect into QGIS 3?

                              One-line joke