Find expected value of a random rectangle in a square grid












0












$begingroup$


I've tried to solve the following problem. Could you please tell if I did it right.



Problem. Given a n x n square grid. We take a random rectangle so that every ractangle is equally likely.



Find expected value of area of this rectangle.



Solution.
The number of all rectangles is $sumlimits_{i=1}^{n}{i^2} = frac{n(n+1)(2n+1)}{6}$. Let $f((i,j))$ - number of rectangles which consist of square in i-th row and j-th column. $f((i,j)) = i(n-i+1)j(n-j+1)$. Let $X_{i,j} = 1$ if random rectangle consists of square in i-th row and j-th column and $X_{i,j} = 0$ otherwise. Expected value of area of a random rectangle is $E(sumlimits_{i=1}^{n}{sumlimits_{j=1}^{n}{X_{i,j}}}) = sumlimits_{i=1}^{n}{sumlimits_{j=1}^{n}{frac{f((i,j))}{frac{n(n+1)(2n+1)}{6}}}}$



$= sumlimits_{i=1}^{n}{frac{1}{frac{n(n+1)(2n+1)}{6}}sumlimits_{j=1}^{n}{i(n-i+1)j(n-j+1)}} = sumlimits_{i=1}^{n}{i(n-i+1)frac{6}{n(n+1)(2n+1)}sumlimits_{j=1}^{n}{j(n-j+1)}}$



$=sumlimits_{i=1}^{n}{i(n-i+1)frac{6}{n(n+1)(2n+1)}((n+1)sumlimits_{j=1}^{n}{j} - sumlimits_{j=1}^{n}{j^2})} = sumlimits_{i=1}^{n}{i(n-i+1)frac{6}{n(n+1)(2n+1)}(frac{(n+1)(1+n)}{2} - frac{n(n+1)(2n+1)}{6})}$



$=frac{6}{n(n+1)(2n+1)}(frac{(n+1)(1+n)}{2} - frac{n(n+1)(2n+1)}{6})sumlimits_{i=1}^{n}{i(n-i+1)} = frac{6}{n(n+1)(2n+1)}(frac{(n+1)(1+n)}{2} - frac{n(n+1)(2n+1)}{6})^2$










share|cite|improve this question









$endgroup$












  • $begingroup$
    If $n=2,$ your formula gives $5$ rectangles, but it seems to me there are $9$. Four $1times1,$ four $2times1,$ and one $2times2$ What am I missing?
    $endgroup$
    – saulspatz
    Feb 2 at 0:02












  • $begingroup$
    @saulspatz That indeed is not the correct formula for the number of all rectangles.
    $endgroup$
    – Math1000
    Feb 2 at 1:40
















0












$begingroup$


I've tried to solve the following problem. Could you please tell if I did it right.



Problem. Given a n x n square grid. We take a random rectangle so that every ractangle is equally likely.



Find expected value of area of this rectangle.



Solution.
The number of all rectangles is $sumlimits_{i=1}^{n}{i^2} = frac{n(n+1)(2n+1)}{6}$. Let $f((i,j))$ - number of rectangles which consist of square in i-th row and j-th column. $f((i,j)) = i(n-i+1)j(n-j+1)$. Let $X_{i,j} = 1$ if random rectangle consists of square in i-th row and j-th column and $X_{i,j} = 0$ otherwise. Expected value of area of a random rectangle is $E(sumlimits_{i=1}^{n}{sumlimits_{j=1}^{n}{X_{i,j}}}) = sumlimits_{i=1}^{n}{sumlimits_{j=1}^{n}{frac{f((i,j))}{frac{n(n+1)(2n+1)}{6}}}}$



$= sumlimits_{i=1}^{n}{frac{1}{frac{n(n+1)(2n+1)}{6}}sumlimits_{j=1}^{n}{i(n-i+1)j(n-j+1)}} = sumlimits_{i=1}^{n}{i(n-i+1)frac{6}{n(n+1)(2n+1)}sumlimits_{j=1}^{n}{j(n-j+1)}}$



$=sumlimits_{i=1}^{n}{i(n-i+1)frac{6}{n(n+1)(2n+1)}((n+1)sumlimits_{j=1}^{n}{j} - sumlimits_{j=1}^{n}{j^2})} = sumlimits_{i=1}^{n}{i(n-i+1)frac{6}{n(n+1)(2n+1)}(frac{(n+1)(1+n)}{2} - frac{n(n+1)(2n+1)}{6})}$



$=frac{6}{n(n+1)(2n+1)}(frac{(n+1)(1+n)}{2} - frac{n(n+1)(2n+1)}{6})sumlimits_{i=1}^{n}{i(n-i+1)} = frac{6}{n(n+1)(2n+1)}(frac{(n+1)(1+n)}{2} - frac{n(n+1)(2n+1)}{6})^2$










share|cite|improve this question









$endgroup$












  • $begingroup$
    If $n=2,$ your formula gives $5$ rectangles, but it seems to me there are $9$. Four $1times1,$ four $2times1,$ and one $2times2$ What am I missing?
    $endgroup$
    – saulspatz
    Feb 2 at 0:02












  • $begingroup$
    @saulspatz That indeed is not the correct formula for the number of all rectangles.
    $endgroup$
    – Math1000
    Feb 2 at 1:40














0












0








0





$begingroup$


I've tried to solve the following problem. Could you please tell if I did it right.



Problem. Given a n x n square grid. We take a random rectangle so that every ractangle is equally likely.



Find expected value of area of this rectangle.



Solution.
The number of all rectangles is $sumlimits_{i=1}^{n}{i^2} = frac{n(n+1)(2n+1)}{6}$. Let $f((i,j))$ - number of rectangles which consist of square in i-th row and j-th column. $f((i,j)) = i(n-i+1)j(n-j+1)$. Let $X_{i,j} = 1$ if random rectangle consists of square in i-th row and j-th column and $X_{i,j} = 0$ otherwise. Expected value of area of a random rectangle is $E(sumlimits_{i=1}^{n}{sumlimits_{j=1}^{n}{X_{i,j}}}) = sumlimits_{i=1}^{n}{sumlimits_{j=1}^{n}{frac{f((i,j))}{frac{n(n+1)(2n+1)}{6}}}}$



$= sumlimits_{i=1}^{n}{frac{1}{frac{n(n+1)(2n+1)}{6}}sumlimits_{j=1}^{n}{i(n-i+1)j(n-j+1)}} = sumlimits_{i=1}^{n}{i(n-i+1)frac{6}{n(n+1)(2n+1)}sumlimits_{j=1}^{n}{j(n-j+1)}}$



$=sumlimits_{i=1}^{n}{i(n-i+1)frac{6}{n(n+1)(2n+1)}((n+1)sumlimits_{j=1}^{n}{j} - sumlimits_{j=1}^{n}{j^2})} = sumlimits_{i=1}^{n}{i(n-i+1)frac{6}{n(n+1)(2n+1)}(frac{(n+1)(1+n)}{2} - frac{n(n+1)(2n+1)}{6})}$



$=frac{6}{n(n+1)(2n+1)}(frac{(n+1)(1+n)}{2} - frac{n(n+1)(2n+1)}{6})sumlimits_{i=1}^{n}{i(n-i+1)} = frac{6}{n(n+1)(2n+1)}(frac{(n+1)(1+n)}{2} - frac{n(n+1)(2n+1)}{6})^2$










share|cite|improve this question









$endgroup$




I've tried to solve the following problem. Could you please tell if I did it right.



Problem. Given a n x n square grid. We take a random rectangle so that every ractangle is equally likely.



Find expected value of area of this rectangle.



Solution.
The number of all rectangles is $sumlimits_{i=1}^{n}{i^2} = frac{n(n+1)(2n+1)}{6}$. Let $f((i,j))$ - number of rectangles which consist of square in i-th row and j-th column. $f((i,j)) = i(n-i+1)j(n-j+1)$. Let $X_{i,j} = 1$ if random rectangle consists of square in i-th row and j-th column and $X_{i,j} = 0$ otherwise. Expected value of area of a random rectangle is $E(sumlimits_{i=1}^{n}{sumlimits_{j=1}^{n}{X_{i,j}}}) = sumlimits_{i=1}^{n}{sumlimits_{j=1}^{n}{frac{f((i,j))}{frac{n(n+1)(2n+1)}{6}}}}$



$= sumlimits_{i=1}^{n}{frac{1}{frac{n(n+1)(2n+1)}{6}}sumlimits_{j=1}^{n}{i(n-i+1)j(n-j+1)}} = sumlimits_{i=1}^{n}{i(n-i+1)frac{6}{n(n+1)(2n+1)}sumlimits_{j=1}^{n}{j(n-j+1)}}$



$=sumlimits_{i=1}^{n}{i(n-i+1)frac{6}{n(n+1)(2n+1)}((n+1)sumlimits_{j=1}^{n}{j} - sumlimits_{j=1}^{n}{j^2})} = sumlimits_{i=1}^{n}{i(n-i+1)frac{6}{n(n+1)(2n+1)}(frac{(n+1)(1+n)}{2} - frac{n(n+1)(2n+1)}{6})}$



$=frac{6}{n(n+1)(2n+1)}(frac{(n+1)(1+n)}{2} - frac{n(n+1)(2n+1)}{6})sumlimits_{i=1}^{n}{i(n-i+1)} = frac{6}{n(n+1)(2n+1)}(frac{(n+1)(1+n)}{2} - frac{n(n+1)(2n+1)}{6})^2$







probability expected-value






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Feb 1 at 23:46









Novak DjokovicNovak Djokovic

45038




45038












  • $begingroup$
    If $n=2,$ your formula gives $5$ rectangles, but it seems to me there are $9$. Four $1times1,$ four $2times1,$ and one $2times2$ What am I missing?
    $endgroup$
    – saulspatz
    Feb 2 at 0:02












  • $begingroup$
    @saulspatz That indeed is not the correct formula for the number of all rectangles.
    $endgroup$
    – Math1000
    Feb 2 at 1:40


















  • $begingroup$
    If $n=2,$ your formula gives $5$ rectangles, but it seems to me there are $9$. Four $1times1,$ four $2times1,$ and one $2times2$ What am I missing?
    $endgroup$
    – saulspatz
    Feb 2 at 0:02












  • $begingroup$
    @saulspatz That indeed is not the correct formula for the number of all rectangles.
    $endgroup$
    – Math1000
    Feb 2 at 1:40
















$begingroup$
If $n=2,$ your formula gives $5$ rectangles, but it seems to me there are $9$. Four $1times1,$ four $2times1,$ and one $2times2$ What am I missing?
$endgroup$
– saulspatz
Feb 2 at 0:02






$begingroup$
If $n=2,$ your formula gives $5$ rectangles, but it seems to me there are $9$. Four $1times1,$ four $2times1,$ and one $2times2$ What am I missing?
$endgroup$
– saulspatz
Feb 2 at 0:02














$begingroup$
@saulspatz That indeed is not the correct formula for the number of all rectangles.
$endgroup$
– Math1000
Feb 2 at 1:40




$begingroup$
@saulspatz That indeed is not the correct formula for the number of all rectangles.
$endgroup$
– Math1000
Feb 2 at 1:40










1 Answer
1






active

oldest

votes


















0












$begingroup$

The expected area is the expected base times the expected height. If, for example, $n=10$, there are $10$ bases of length $1$, and $9$ of length $2$, on up to $1$ of length $n$: $sum_{k=1}^n k$ in all. Thus the expected base length is $$b = frac{sum_{k=1}^n k ( n+1-k)}{sum_{k=1}^n k}$$ and the expected height length is the same. So the expected area is $b^2$.






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%2f3096871%2ffind-expected-value-of-a-random-rectangle-in-a-square-grid%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0












    $begingroup$

    The expected area is the expected base times the expected height. If, for example, $n=10$, there are $10$ bases of length $1$, and $9$ of length $2$, on up to $1$ of length $n$: $sum_{k=1}^n k$ in all. Thus the expected base length is $$b = frac{sum_{k=1}^n k ( n+1-k)}{sum_{k=1}^n k}$$ and the expected height length is the same. So the expected area is $b^2$.






    share|cite|improve this answer









    $endgroup$


















      0












      $begingroup$

      The expected area is the expected base times the expected height. If, for example, $n=10$, there are $10$ bases of length $1$, and $9$ of length $2$, on up to $1$ of length $n$: $sum_{k=1}^n k$ in all. Thus the expected base length is $$b = frac{sum_{k=1}^n k ( n+1-k)}{sum_{k=1}^n k}$$ and the expected height length is the same. So the expected area is $b^2$.






      share|cite|improve this answer









      $endgroup$
















        0












        0








        0





        $begingroup$

        The expected area is the expected base times the expected height. If, for example, $n=10$, there are $10$ bases of length $1$, and $9$ of length $2$, on up to $1$ of length $n$: $sum_{k=1}^n k$ in all. Thus the expected base length is $$b = frac{sum_{k=1}^n k ( n+1-k)}{sum_{k=1}^n k}$$ and the expected height length is the same. So the expected area is $b^2$.






        share|cite|improve this answer









        $endgroup$



        The expected area is the expected base times the expected height. If, for example, $n=10$, there are $10$ bases of length $1$, and $9$ of length $2$, on up to $1$ of length $n$: $sum_{k=1}^n k$ in all. Thus the expected base length is $$b = frac{sum_{k=1}^n k ( n+1-k)}{sum_{k=1}^n k}$$ and the expected height length is the same. So the expected area is $b^2$.







        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered Feb 2 at 2:59









        kimchi loverkimchi lover

        11.8k31229




        11.8k31229






























            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%2f3096871%2ffind-expected-value-of-a-random-rectangle-in-a-square-grid%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

            MongoDB - Not Authorized To Execute Command

            How to fix TextFormField cause rebuild widget in Flutter

            Npm cannot find a required file even through it is in the searched directory