Expected value of half normal using gamma function












0














Let $X$ be $N(0,1)$. I want to compute $E(|X|)$. This is what I tried:



$$E(|X|)=frac{1}{sqrt{2pi}}int_{-infty}^infty|x|e^{frac{-x^2}{2}}dx=frac{2}{sqrt{2pi}}int_{0}^infty xe^{frac{-x^2}{2}}dx$$



In order to aim for the gamma function, I do the change of variables $x^2/2=y.$ This results in



$$frac{2}{sqrt{2pi}}int_{0}^infty xe^{frac{-x^2}{2}}dx=frac{2}{sqrt{pi}}int_{0}^infty y^{1/2}e^{-y}dy=frac{2}{sqrt{pi}}Gamma(1/2+1)=frac{2}{sqrt{pi}}frac{sqrt pi}{2}=1$$



This is obviously wrong, but I cannot find my mistake.










share|cite|improve this question





























    0














    Let $X$ be $N(0,1)$. I want to compute $E(|X|)$. This is what I tried:



    $$E(|X|)=frac{1}{sqrt{2pi}}int_{-infty}^infty|x|e^{frac{-x^2}{2}}dx=frac{2}{sqrt{2pi}}int_{0}^infty xe^{frac{-x^2}{2}}dx$$



    In order to aim for the gamma function, I do the change of variables $x^2/2=y.$ This results in



    $$frac{2}{sqrt{2pi}}int_{0}^infty xe^{frac{-x^2}{2}}dx=frac{2}{sqrt{pi}}int_{0}^infty y^{1/2}e^{-y}dy=frac{2}{sqrt{pi}}Gamma(1/2+1)=frac{2}{sqrt{pi}}frac{sqrt pi}{2}=1$$



    This is obviously wrong, but I cannot find my mistake.










    share|cite|improve this question



























      0












      0








      0







      Let $X$ be $N(0,1)$. I want to compute $E(|X|)$. This is what I tried:



      $$E(|X|)=frac{1}{sqrt{2pi}}int_{-infty}^infty|x|e^{frac{-x^2}{2}}dx=frac{2}{sqrt{2pi}}int_{0}^infty xe^{frac{-x^2}{2}}dx$$



      In order to aim for the gamma function, I do the change of variables $x^2/2=y.$ This results in



      $$frac{2}{sqrt{2pi}}int_{0}^infty xe^{frac{-x^2}{2}}dx=frac{2}{sqrt{pi}}int_{0}^infty y^{1/2}e^{-y}dy=frac{2}{sqrt{pi}}Gamma(1/2+1)=frac{2}{sqrt{pi}}frac{sqrt pi}{2}=1$$



      This is obviously wrong, but I cannot find my mistake.










      share|cite|improve this question















      Let $X$ be $N(0,1)$. I want to compute $E(|X|)$. This is what I tried:



      $$E(|X|)=frac{1}{sqrt{2pi}}int_{-infty}^infty|x|e^{frac{-x^2}{2}}dx=frac{2}{sqrt{2pi}}int_{0}^infty xe^{frac{-x^2}{2}}dx$$



      In order to aim for the gamma function, I do the change of variables $x^2/2=y.$ This results in



      $$frac{2}{sqrt{2pi}}int_{0}^infty xe^{frac{-x^2}{2}}dx=frac{2}{sqrt{pi}}int_{0}^infty y^{1/2}e^{-y}dy=frac{2}{sqrt{pi}}Gamma(1/2+1)=frac{2}{sqrt{pi}}frac{sqrt pi}{2}=1$$



      This is obviously wrong, but I cannot find my mistake.







      probability-distributions moment-problem






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Nov 26 at 17:28









      mrtaurho

      3,3982932




      3,3982932










      asked Nov 26 at 17:25









      julian.marr

      349112




      349112






















          2 Answers
          2






          active

          oldest

          votes


















          1














          Its just a slight mistake within your substitution. In fact by replacing $x^2/2$ with $y$ you have to consider that your differential changes to $xdx=dy$ and not only to $dy$. Therefore the single $x$ is absorbed within the $dy$ instead of remaining as $y^{1/2}$. This finally leads to



          $$int_0^{infty}e^{-frac{x^2}2}(xdx)=int_0^{infty}e^{-y}dy$$



          where the last integral turns out to equal $1$ instead of $Gamma(1/2+1)$. Therefore your evaluation has to be finished as



          $$E(|X|)=frac{2}{sqrt{2pi}}int_{0}^infty xe^{frac{-x^2}{2}}dx=frac{2}{sqrt{2pi}}int_{0}^infty e^{-y}dy=sqrt{frac{2}{pi}}$$






          share|cite|improve this answer























          • I see. Now it all makes sense.
            – julian.marr
            Nov 26 at 17:34






          • 1




            @julian.marr In this case you can mark my answer as accepted to show that you are satisfied with the given :)
            – mrtaurho
            Nov 26 at 17:35



















          0














          Change of variable is wrong, you should have $int (ldots) frac{dx}{dy} , dy$ and you have omitted the (jacobian) $frac{dx}{dy}$.






          share|cite|improve this answer





















            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%2f3014628%2fexpected-value-of-half-normal-using-gamma-function%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














            Its just a slight mistake within your substitution. In fact by replacing $x^2/2$ with $y$ you have to consider that your differential changes to $xdx=dy$ and not only to $dy$. Therefore the single $x$ is absorbed within the $dy$ instead of remaining as $y^{1/2}$. This finally leads to



            $$int_0^{infty}e^{-frac{x^2}2}(xdx)=int_0^{infty}e^{-y}dy$$



            where the last integral turns out to equal $1$ instead of $Gamma(1/2+1)$. Therefore your evaluation has to be finished as



            $$E(|X|)=frac{2}{sqrt{2pi}}int_{0}^infty xe^{frac{-x^2}{2}}dx=frac{2}{sqrt{2pi}}int_{0}^infty e^{-y}dy=sqrt{frac{2}{pi}}$$






            share|cite|improve this answer























            • I see. Now it all makes sense.
              – julian.marr
              Nov 26 at 17:34






            • 1




              @julian.marr In this case you can mark my answer as accepted to show that you are satisfied with the given :)
              – mrtaurho
              Nov 26 at 17:35
















            1














            Its just a slight mistake within your substitution. In fact by replacing $x^2/2$ with $y$ you have to consider that your differential changes to $xdx=dy$ and not only to $dy$. Therefore the single $x$ is absorbed within the $dy$ instead of remaining as $y^{1/2}$. This finally leads to



            $$int_0^{infty}e^{-frac{x^2}2}(xdx)=int_0^{infty}e^{-y}dy$$



            where the last integral turns out to equal $1$ instead of $Gamma(1/2+1)$. Therefore your evaluation has to be finished as



            $$E(|X|)=frac{2}{sqrt{2pi}}int_{0}^infty xe^{frac{-x^2}{2}}dx=frac{2}{sqrt{2pi}}int_{0}^infty e^{-y}dy=sqrt{frac{2}{pi}}$$






            share|cite|improve this answer























            • I see. Now it all makes sense.
              – julian.marr
              Nov 26 at 17:34






            • 1




              @julian.marr In this case you can mark my answer as accepted to show that you are satisfied with the given :)
              – mrtaurho
              Nov 26 at 17:35














            1












            1








            1






            Its just a slight mistake within your substitution. In fact by replacing $x^2/2$ with $y$ you have to consider that your differential changes to $xdx=dy$ and not only to $dy$. Therefore the single $x$ is absorbed within the $dy$ instead of remaining as $y^{1/2}$. This finally leads to



            $$int_0^{infty}e^{-frac{x^2}2}(xdx)=int_0^{infty}e^{-y}dy$$



            where the last integral turns out to equal $1$ instead of $Gamma(1/2+1)$. Therefore your evaluation has to be finished as



            $$E(|X|)=frac{2}{sqrt{2pi}}int_{0}^infty xe^{frac{-x^2}{2}}dx=frac{2}{sqrt{2pi}}int_{0}^infty e^{-y}dy=sqrt{frac{2}{pi}}$$






            share|cite|improve this answer














            Its just a slight mistake within your substitution. In fact by replacing $x^2/2$ with $y$ you have to consider that your differential changes to $xdx=dy$ and not only to $dy$. Therefore the single $x$ is absorbed within the $dy$ instead of remaining as $y^{1/2}$. This finally leads to



            $$int_0^{infty}e^{-frac{x^2}2}(xdx)=int_0^{infty}e^{-y}dy$$



            where the last integral turns out to equal $1$ instead of $Gamma(1/2+1)$. Therefore your evaluation has to be finished as



            $$E(|X|)=frac{2}{sqrt{2pi}}int_{0}^infty xe^{frac{-x^2}{2}}dx=frac{2}{sqrt{2pi}}int_{0}^infty e^{-y}dy=sqrt{frac{2}{pi}}$$







            share|cite|improve this answer














            share|cite|improve this answer



            share|cite|improve this answer








            edited Nov 26 at 17:34

























            answered Nov 26 at 17:32









            mrtaurho

            3,3982932




            3,3982932












            • I see. Now it all makes sense.
              – julian.marr
              Nov 26 at 17:34






            • 1




              @julian.marr In this case you can mark my answer as accepted to show that you are satisfied with the given :)
              – mrtaurho
              Nov 26 at 17:35


















            • I see. Now it all makes sense.
              – julian.marr
              Nov 26 at 17:34






            • 1




              @julian.marr In this case you can mark my answer as accepted to show that you are satisfied with the given :)
              – mrtaurho
              Nov 26 at 17:35
















            I see. Now it all makes sense.
            – julian.marr
            Nov 26 at 17:34




            I see. Now it all makes sense.
            – julian.marr
            Nov 26 at 17:34




            1




            1




            @julian.marr In this case you can mark my answer as accepted to show that you are satisfied with the given :)
            – mrtaurho
            Nov 26 at 17:35




            @julian.marr In this case you can mark my answer as accepted to show that you are satisfied with the given :)
            – mrtaurho
            Nov 26 at 17:35











            0














            Change of variable is wrong, you should have $int (ldots) frac{dx}{dy} , dy$ and you have omitted the (jacobian) $frac{dx}{dy}$.






            share|cite|improve this answer


























              0














              Change of variable is wrong, you should have $int (ldots) frac{dx}{dy} , dy$ and you have omitted the (jacobian) $frac{dx}{dy}$.






              share|cite|improve this answer
























                0












                0








                0






                Change of variable is wrong, you should have $int (ldots) frac{dx}{dy} , dy$ and you have omitted the (jacobian) $frac{dx}{dy}$.






                share|cite|improve this answer












                Change of variable is wrong, you should have $int (ldots) frac{dx}{dy} , dy$ and you have omitted the (jacobian) $frac{dx}{dy}$.







                share|cite|improve this answer












                share|cite|improve this answer



                share|cite|improve this answer










                answered Nov 26 at 17:32









                Richard Martin

                1,63618




                1,63618






























                    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.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • 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.


                    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%2f3014628%2fexpected-value-of-half-normal-using-gamma-function%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

                    How do I know what Microsoft account the skydrive app is syncing to?

                    When does type information flow backwards in C++?

                    Grease: Live!