Calculate the variance of $f_X(x)$












0












$begingroup$


We have $$fleft(xright)=0.8left(frac{1}{5sqrt{2pi}}e^{-frac{1}{50}left(x-50right)^2}right)+0.2left(frac{1}{8sqrt{2pi}}e^{-frac{1}{128}left(x-60right)^2}right)$$



This can be written in a more nicer way:



$$gleft(xright)=0.8left(frac{1}{5sqrt{2pi}}e^{-frac{1}{2}left(frac{x-50}{5}right)^2}right)+0.2left(frac{1}{8sqrt{2pi}}e^{-frac{1}{2}left(frac{x-60}{8}right)^2}right)$$



To calculate the expectation, it is equal to $0.8(50) + 0.2(60)=52$, since we see that this is essentially $0.8N(mu=50, sigma^2=25)+0.2N(mu=60, sigma^2=64)$



We get confirmation from desmos:



enter image description here



What about variance though?



$var(0.8N(mu=50, sigma^2=25)+0.2N(mu=60, sigma^2=64)=0.8^2(25)+0.2^2(64)=18.56$



But also, $v(x)=E(x^2)-(E(x))^2$



Verifying the above on desmos, I get a different answer:



About $48.8$, so I am not sure where I went wrong. I know the integral is entered correctly on desmos, but where have I gone wrong with the variance?



enter image description here










share|cite|improve this question









$endgroup$

















    0












    $begingroup$


    We have $$fleft(xright)=0.8left(frac{1}{5sqrt{2pi}}e^{-frac{1}{50}left(x-50right)^2}right)+0.2left(frac{1}{8sqrt{2pi}}e^{-frac{1}{128}left(x-60right)^2}right)$$



    This can be written in a more nicer way:



    $$gleft(xright)=0.8left(frac{1}{5sqrt{2pi}}e^{-frac{1}{2}left(frac{x-50}{5}right)^2}right)+0.2left(frac{1}{8sqrt{2pi}}e^{-frac{1}{2}left(frac{x-60}{8}right)^2}right)$$



    To calculate the expectation, it is equal to $0.8(50) + 0.2(60)=52$, since we see that this is essentially $0.8N(mu=50, sigma^2=25)+0.2N(mu=60, sigma^2=64)$



    We get confirmation from desmos:



    enter image description here



    What about variance though?



    $var(0.8N(mu=50, sigma^2=25)+0.2N(mu=60, sigma^2=64)=0.8^2(25)+0.2^2(64)=18.56$



    But also, $v(x)=E(x^2)-(E(x))^2$



    Verifying the above on desmos, I get a different answer:



    About $48.8$, so I am not sure where I went wrong. I know the integral is entered correctly on desmos, but where have I gone wrong with the variance?



    enter image description here










    share|cite|improve this question









    $endgroup$















      0












      0








      0





      $begingroup$


      We have $$fleft(xright)=0.8left(frac{1}{5sqrt{2pi}}e^{-frac{1}{50}left(x-50right)^2}right)+0.2left(frac{1}{8sqrt{2pi}}e^{-frac{1}{128}left(x-60right)^2}right)$$



      This can be written in a more nicer way:



      $$gleft(xright)=0.8left(frac{1}{5sqrt{2pi}}e^{-frac{1}{2}left(frac{x-50}{5}right)^2}right)+0.2left(frac{1}{8sqrt{2pi}}e^{-frac{1}{2}left(frac{x-60}{8}right)^2}right)$$



      To calculate the expectation, it is equal to $0.8(50) + 0.2(60)=52$, since we see that this is essentially $0.8N(mu=50, sigma^2=25)+0.2N(mu=60, sigma^2=64)$



      We get confirmation from desmos:



      enter image description here



      What about variance though?



      $var(0.8N(mu=50, sigma^2=25)+0.2N(mu=60, sigma^2=64)=0.8^2(25)+0.2^2(64)=18.56$



      But also, $v(x)=E(x^2)-(E(x))^2$



      Verifying the above on desmos, I get a different answer:



      About $48.8$, so I am not sure where I went wrong. I know the integral is entered correctly on desmos, but where have I gone wrong with the variance?



      enter image description here










      share|cite|improve this question









      $endgroup$




      We have $$fleft(xright)=0.8left(frac{1}{5sqrt{2pi}}e^{-frac{1}{50}left(x-50right)^2}right)+0.2left(frac{1}{8sqrt{2pi}}e^{-frac{1}{128}left(x-60right)^2}right)$$



      This can be written in a more nicer way:



      $$gleft(xright)=0.8left(frac{1}{5sqrt{2pi}}e^{-frac{1}{2}left(frac{x-50}{5}right)^2}right)+0.2left(frac{1}{8sqrt{2pi}}e^{-frac{1}{2}left(frac{x-60}{8}right)^2}right)$$



      To calculate the expectation, it is equal to $0.8(50) + 0.2(60)=52$, since we see that this is essentially $0.8N(mu=50, sigma^2=25)+0.2N(mu=60, sigma^2=64)$



      We get confirmation from desmos:



      enter image description here



      What about variance though?



      $var(0.8N(mu=50, sigma^2=25)+0.2N(mu=60, sigma^2=64)=0.8^2(25)+0.2^2(64)=18.56$



      But also, $v(x)=E(x^2)-(E(x))^2$



      Verifying the above on desmos, I get a different answer:



      About $48.8$, so I am not sure where I went wrong. I know the integral is entered correctly on desmos, but where have I gone wrong with the variance?



      enter image description here







      probability probability-distributions normal-distribution variance






      share|cite|improve this question













      share|cite|improve this question











      share|cite|improve this question




      share|cite|improve this question










      asked Dec 16 '18 at 22:26









      K Split XK Split X

      4,30421233




      4,30421233






















          2 Answers
          2






          active

          oldest

          votes


















          1












          $begingroup$

          $f_X$ is the density of the random variable $UZ_1+(1-U)Z_2$ where $Usim Bernoulli(0.8), Z_1sim N(50,25)$ and $Z_2sim N(60,64)$ and they are mutually independent.



          Then $Var(UZ_1+(1-U)Z_2)=E[Var(UZ_1+(1-U)Z_2|U)]+Var[E(UZ_1+(1-U)Z_2|U)].$



          $E[Var(UZ_1+(1-U)Z_2|U)]=E[U^2Var(Z_1|U)+(1-U)^2Var(Z_2|U)]=E[U^2]Var(Z_1)+E[(1-U)^2]Var(Z_2)=E[U]times 25+E[1-U]times 64=0.8times 25+0.2times 64=32.8.$



          $Var[E(UZ_1+(1-U)Z_2|U)]=Var[UE(Z_1)+(1-U)E(Z_2)]=Var[50U+60(1-U)]=Var[-10U]=100times 0.8times 0.2=16.$






          share|cite|improve this answer









          $endgroup$





















            0












            $begingroup$

            for a function of the form



            $$
            f(x) = a frac{1}{sqrt{2pi sigma_1^2}}e^{(x - mu_1)^2/2sigma_1^2} + (1- a)frac{1}{sqrt{2pi sigma_2^2}}e^{(x - mu_2)^2/2sigma_2^2}
            $$



            you have



            $$
            int_{-infty}^{+infty} {rm d}x~ f(x) = a + (1 - a) = 1
            $$



            $$
            int_{-infty}^{+infty} {rm d}x~ x f(x) = amu_1 + (1 - a)mu_2 tag{1}
            $$



            and



            $$
            int_{-infty}^{+infty} {rm d}x~ x^2 f(x) = a(mu_1^2 + sigma_1^2) + (1 - a)(mu_2^2 + sigma_2^2) tag{2}
            $$



            So that



            $$
            mathbb{V}{rm ar}[X] = int_{-infty}^{+infty} {rm d}x~ x^2 f(x) - left(
            int_{-infty}^{+infty} {rm d}x~ x f(x) right)^2 = a(sigma_1 - sigma_2)(sigma_1 + sigma_2) + sigma_2^2 + a(1 - a)(mu_1 - mu_2)^2 tag{3}
            $$






            share|cite|improve this answer









            $endgroup$













              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',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              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%2f3043266%2fcalculate-the-variance-of-f-xx%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1












              $begingroup$

              $f_X$ is the density of the random variable $UZ_1+(1-U)Z_2$ where $Usim Bernoulli(0.8), Z_1sim N(50,25)$ and $Z_2sim N(60,64)$ and they are mutually independent.



              Then $Var(UZ_1+(1-U)Z_2)=E[Var(UZ_1+(1-U)Z_2|U)]+Var[E(UZ_1+(1-U)Z_2|U)].$



              $E[Var(UZ_1+(1-U)Z_2|U)]=E[U^2Var(Z_1|U)+(1-U)^2Var(Z_2|U)]=E[U^2]Var(Z_1)+E[(1-U)^2]Var(Z_2)=E[U]times 25+E[1-U]times 64=0.8times 25+0.2times 64=32.8.$



              $Var[E(UZ_1+(1-U)Z_2|U)]=Var[UE(Z_1)+(1-U)E(Z_2)]=Var[50U+60(1-U)]=Var[-10U]=100times 0.8times 0.2=16.$






              share|cite|improve this answer









              $endgroup$


















                1












                $begingroup$

                $f_X$ is the density of the random variable $UZ_1+(1-U)Z_2$ where $Usim Bernoulli(0.8), Z_1sim N(50,25)$ and $Z_2sim N(60,64)$ and they are mutually independent.



                Then $Var(UZ_1+(1-U)Z_2)=E[Var(UZ_1+(1-U)Z_2|U)]+Var[E(UZ_1+(1-U)Z_2|U)].$



                $E[Var(UZ_1+(1-U)Z_2|U)]=E[U^2Var(Z_1|U)+(1-U)^2Var(Z_2|U)]=E[U^2]Var(Z_1)+E[(1-U)^2]Var(Z_2)=E[U]times 25+E[1-U]times 64=0.8times 25+0.2times 64=32.8.$



                $Var[E(UZ_1+(1-U)Z_2|U)]=Var[UE(Z_1)+(1-U)E(Z_2)]=Var[50U+60(1-U)]=Var[-10U]=100times 0.8times 0.2=16.$






                share|cite|improve this answer









                $endgroup$
















                  1












                  1








                  1





                  $begingroup$

                  $f_X$ is the density of the random variable $UZ_1+(1-U)Z_2$ where $Usim Bernoulli(0.8), Z_1sim N(50,25)$ and $Z_2sim N(60,64)$ and they are mutually independent.



                  Then $Var(UZ_1+(1-U)Z_2)=E[Var(UZ_1+(1-U)Z_2|U)]+Var[E(UZ_1+(1-U)Z_2|U)].$



                  $E[Var(UZ_1+(1-U)Z_2|U)]=E[U^2Var(Z_1|U)+(1-U)^2Var(Z_2|U)]=E[U^2]Var(Z_1)+E[(1-U)^2]Var(Z_2)=E[U]times 25+E[1-U]times 64=0.8times 25+0.2times 64=32.8.$



                  $Var[E(UZ_1+(1-U)Z_2|U)]=Var[UE(Z_1)+(1-U)E(Z_2)]=Var[50U+60(1-U)]=Var[-10U]=100times 0.8times 0.2=16.$






                  share|cite|improve this answer









                  $endgroup$



                  $f_X$ is the density of the random variable $UZ_1+(1-U)Z_2$ where $Usim Bernoulli(0.8), Z_1sim N(50,25)$ and $Z_2sim N(60,64)$ and they are mutually independent.



                  Then $Var(UZ_1+(1-U)Z_2)=E[Var(UZ_1+(1-U)Z_2|U)]+Var[E(UZ_1+(1-U)Z_2|U)].$



                  $E[Var(UZ_1+(1-U)Z_2|U)]=E[U^2Var(Z_1|U)+(1-U)^2Var(Z_2|U)]=E[U^2]Var(Z_1)+E[(1-U)^2]Var(Z_2)=E[U]times 25+E[1-U]times 64=0.8times 25+0.2times 64=32.8.$



                  $Var[E(UZ_1+(1-U)Z_2|U)]=Var[UE(Z_1)+(1-U)E(Z_2)]=Var[50U+60(1-U)]=Var[-10U]=100times 0.8times 0.2=16.$







                  share|cite|improve this answer












                  share|cite|improve this answer



                  share|cite|improve this answer










                  answered Dec 16 '18 at 23:30









                  John_WickJohn_Wick

                  1,616111




                  1,616111























                      0












                      $begingroup$

                      for a function of the form



                      $$
                      f(x) = a frac{1}{sqrt{2pi sigma_1^2}}e^{(x - mu_1)^2/2sigma_1^2} + (1- a)frac{1}{sqrt{2pi sigma_2^2}}e^{(x - mu_2)^2/2sigma_2^2}
                      $$



                      you have



                      $$
                      int_{-infty}^{+infty} {rm d}x~ f(x) = a + (1 - a) = 1
                      $$



                      $$
                      int_{-infty}^{+infty} {rm d}x~ x f(x) = amu_1 + (1 - a)mu_2 tag{1}
                      $$



                      and



                      $$
                      int_{-infty}^{+infty} {rm d}x~ x^2 f(x) = a(mu_1^2 + sigma_1^2) + (1 - a)(mu_2^2 + sigma_2^2) tag{2}
                      $$



                      So that



                      $$
                      mathbb{V}{rm ar}[X] = int_{-infty}^{+infty} {rm d}x~ x^2 f(x) - left(
                      int_{-infty}^{+infty} {rm d}x~ x f(x) right)^2 = a(sigma_1 - sigma_2)(sigma_1 + sigma_2) + sigma_2^2 + a(1 - a)(mu_1 - mu_2)^2 tag{3}
                      $$






                      share|cite|improve this answer









                      $endgroup$


















                        0












                        $begingroup$

                        for a function of the form



                        $$
                        f(x) = a frac{1}{sqrt{2pi sigma_1^2}}e^{(x - mu_1)^2/2sigma_1^2} + (1- a)frac{1}{sqrt{2pi sigma_2^2}}e^{(x - mu_2)^2/2sigma_2^2}
                        $$



                        you have



                        $$
                        int_{-infty}^{+infty} {rm d}x~ f(x) = a + (1 - a) = 1
                        $$



                        $$
                        int_{-infty}^{+infty} {rm d}x~ x f(x) = amu_1 + (1 - a)mu_2 tag{1}
                        $$



                        and



                        $$
                        int_{-infty}^{+infty} {rm d}x~ x^2 f(x) = a(mu_1^2 + sigma_1^2) + (1 - a)(mu_2^2 + sigma_2^2) tag{2}
                        $$



                        So that



                        $$
                        mathbb{V}{rm ar}[X] = int_{-infty}^{+infty} {rm d}x~ x^2 f(x) - left(
                        int_{-infty}^{+infty} {rm d}x~ x f(x) right)^2 = a(sigma_1 - sigma_2)(sigma_1 + sigma_2) + sigma_2^2 + a(1 - a)(mu_1 - mu_2)^2 tag{3}
                        $$






                        share|cite|improve this answer









                        $endgroup$
















                          0












                          0








                          0





                          $begingroup$

                          for a function of the form



                          $$
                          f(x) = a frac{1}{sqrt{2pi sigma_1^2}}e^{(x - mu_1)^2/2sigma_1^2} + (1- a)frac{1}{sqrt{2pi sigma_2^2}}e^{(x - mu_2)^2/2sigma_2^2}
                          $$



                          you have



                          $$
                          int_{-infty}^{+infty} {rm d}x~ f(x) = a + (1 - a) = 1
                          $$



                          $$
                          int_{-infty}^{+infty} {rm d}x~ x f(x) = amu_1 + (1 - a)mu_2 tag{1}
                          $$



                          and



                          $$
                          int_{-infty}^{+infty} {rm d}x~ x^2 f(x) = a(mu_1^2 + sigma_1^2) + (1 - a)(mu_2^2 + sigma_2^2) tag{2}
                          $$



                          So that



                          $$
                          mathbb{V}{rm ar}[X] = int_{-infty}^{+infty} {rm d}x~ x^2 f(x) - left(
                          int_{-infty}^{+infty} {rm d}x~ x f(x) right)^2 = a(sigma_1 - sigma_2)(sigma_1 + sigma_2) + sigma_2^2 + a(1 - a)(mu_1 - mu_2)^2 tag{3}
                          $$






                          share|cite|improve this answer









                          $endgroup$



                          for a function of the form



                          $$
                          f(x) = a frac{1}{sqrt{2pi sigma_1^2}}e^{(x - mu_1)^2/2sigma_1^2} + (1- a)frac{1}{sqrt{2pi sigma_2^2}}e^{(x - mu_2)^2/2sigma_2^2}
                          $$



                          you have



                          $$
                          int_{-infty}^{+infty} {rm d}x~ f(x) = a + (1 - a) = 1
                          $$



                          $$
                          int_{-infty}^{+infty} {rm d}x~ x f(x) = amu_1 + (1 - a)mu_2 tag{1}
                          $$



                          and



                          $$
                          int_{-infty}^{+infty} {rm d}x~ x^2 f(x) = a(mu_1^2 + sigma_1^2) + (1 - a)(mu_2^2 + sigma_2^2) tag{2}
                          $$



                          So that



                          $$
                          mathbb{V}{rm ar}[X] = int_{-infty}^{+infty} {rm d}x~ x^2 f(x) - left(
                          int_{-infty}^{+infty} {rm d}x~ x f(x) right)^2 = a(sigma_1 - sigma_2)(sigma_1 + sigma_2) + sigma_2^2 + a(1 - a)(mu_1 - mu_2)^2 tag{3}
                          $$







                          share|cite|improve this answer












                          share|cite|improve this answer



                          share|cite|improve this answer










                          answered Dec 16 '18 at 22:52









                          caveraccaverac

                          14.8k31130




                          14.8k31130






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Mathematics Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              Use MathJax to format equations. MathJax reference.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3043266%2fcalculate-the-variance-of-f-xx%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Plaza Victoria

                              In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

                              How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...