Ceil and floor function












2












$begingroup$


Let $a$ and $b$ be positive integers.



If $b$ is even, then we have $$leftlfloor frac{a-b}{2} rightrfloor + leftlceil frac{a+b}{2} rightrceil = a$$



I thing the equality also hold when $b$ is odd. What could be a proof for it?



Thank you










share|cite|improve this question











$endgroup$












  • $begingroup$
    Write $b$ as $2k + 1$, where $k$ is a nonnegative integer. Then look at two cases: $a = 2s$ ($s$ a positive integer), and $a = 2s + 1$ ($s$ a nonnegative integer). What do you get for the left-hand side in each case? [You can show your work by clicking "edit" beneath your question.]
    $endgroup$
    – John Hughes
    22 mins ago
















2












$begingroup$


Let $a$ and $b$ be positive integers.



If $b$ is even, then we have $$leftlfloor frac{a-b}{2} rightrfloor + leftlceil frac{a+b}{2} rightrceil = a$$



I thing the equality also hold when $b$ is odd. What could be a proof for it?



Thank you










share|cite|improve this question











$endgroup$












  • $begingroup$
    Write $b$ as $2k + 1$, where $k$ is a nonnegative integer. Then look at two cases: $a = 2s$ ($s$ a positive integer), and $a = 2s + 1$ ($s$ a nonnegative integer). What do you get for the left-hand side in each case? [You can show your work by clicking "edit" beneath your question.]
    $endgroup$
    – John Hughes
    22 mins ago














2












2








2





$begingroup$


Let $a$ and $b$ be positive integers.



If $b$ is even, then we have $$leftlfloor frac{a-b}{2} rightrfloor + leftlceil frac{a+b}{2} rightrceil = a$$



I thing the equality also hold when $b$ is odd. What could be a proof for it?



Thank you










share|cite|improve this question











$endgroup$




Let $a$ and $b$ be positive integers.



If $b$ is even, then we have $$leftlfloor frac{a-b}{2} rightrfloor + leftlceil frac{a+b}{2} rightrceil = a$$



I thing the equality also hold when $b$ is odd. What could be a proof for it?



Thank you







floor-function ceiling-function






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited 26 mins ago







Adam54

















asked 31 mins ago









Adam54Adam54

615




615












  • $begingroup$
    Write $b$ as $2k + 1$, where $k$ is a nonnegative integer. Then look at two cases: $a = 2s$ ($s$ a positive integer), and $a = 2s + 1$ ($s$ a nonnegative integer). What do you get for the left-hand side in each case? [You can show your work by clicking "edit" beneath your question.]
    $endgroup$
    – John Hughes
    22 mins ago


















  • $begingroup$
    Write $b$ as $2k + 1$, where $k$ is a nonnegative integer. Then look at two cases: $a = 2s$ ($s$ a positive integer), and $a = 2s + 1$ ($s$ a nonnegative integer). What do you get for the left-hand side in each case? [You can show your work by clicking "edit" beneath your question.]
    $endgroup$
    – John Hughes
    22 mins ago
















$begingroup$
Write $b$ as $2k + 1$, where $k$ is a nonnegative integer. Then look at two cases: $a = 2s$ ($s$ a positive integer), and $a = 2s + 1$ ($s$ a nonnegative integer). What do you get for the left-hand side in each case? [You can show your work by clicking "edit" beneath your question.]
$endgroup$
– John Hughes
22 mins ago




$begingroup$
Write $b$ as $2k + 1$, where $k$ is a nonnegative integer. Then look at two cases: $a = 2s$ ($s$ a positive integer), and $a = 2s + 1$ ($s$ a nonnegative integer). What do you get for the left-hand side in each case? [You can show your work by clicking "edit" beneath your question.]
$endgroup$
– John Hughes
22 mins ago










4 Answers
4






active

oldest

votes


















0












$begingroup$

If $a$ and $b$ are both odd (or both even), then $a-b$ and $a+b$ are both even, and thus $$leftlfloor frac{a-b}{2} rightrfloor = frac{a-b}{2} quadtext{and}quad leftlceil frac{a+b}{2} rightrceil = frac{a+b}{2}.$$



Otherwise, if exactly one of $a$ and $b$ is odd, then $a-b$ and $a+b$ are both odd, and thus $$leftlfloor frac{a-b}{2} rightrfloor = frac{a-b}{2} - frac12 quadtext{and}quad leftlceil frac{a+b}{2} rightrceil = frac{a+b}{2} + frac12.$$



In either case, it's easy to check that your equation holds.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    Thank you very much for the odd case, made very simple!
    $endgroup$
    – Adam54
    14 mins ago



















2












$begingroup$

The equality only depends on the parity of $a+b$, as it is the same as that of $a-b$. Then



$$leftlfloorfrac02rightrfloor+leftlceilfrac02rightrceil=0$$
and
$$leftlfloorfrac12rightrfloor+leftlceilfrac12rightrceil=1$$
are enough as a proof.






share|cite|improve this answer









$endgroup$





















    2












    $begingroup$

    If $a$ and $b$ are both odd then we have $a=2m+1$ and $b=2n+1$ where $m$ and $n$ are positive integers.



    Then, we have begin{align}leftlfloorfrac{a-b}2rightrfloor+leftlceilfrac{a+b}2rightrceil &= leftlfloorfrac{(2m+1)-(2n+1)}2rightrfloor+ leftlceilfrac{(2m+1)+(2n+1)}2rightrceil\
    &=leftlfloorfrac{2m-2n}2rightrfloor+ leftlceilfrac{2m+2n+2}2rightrceil\
    &=lfloor m-nrfloor + lceil m+n+1rceil\
    &= m-n + m+n+1tag{$*$}\
    &= 2m+1\
    &=aend{align}



    We can get to $(*)$ because $m$ and $n$ are integers and so their floor (or ceiling) is just the number inside (two integers added or subtracted will always give an integer answer).



    If $a$ is even and $b$ is odd, then we have $a=2m$ and $b=2n+1$, again for $m$ and $n$ integers.



    So we have begin{align}leftlfloorfrac{a-b}2rightrfloor+leftlceilfrac{a+b}2rightrceil &= leftlfloorfrac{(2m)-(2n+1)}2rightrfloor+ leftlceilfrac{(2m)+(2n+1)}2rightrceil\
    &=leftlfloorfrac{2m-2n-1}2rightrfloor+ leftlceilfrac{2m+2n+1}2rightrceil\
    &=leftlfloor m-n-frac 12rightrfloor + leftlceil m+n+frac12rightrceil\
    &= m-n -1+ m+n+1tag{$dagger$}\
    &= 2m\
    &=aend{align}



    Here we get to $(dagger)$ because we round the first half down and the second half up to their respective nearest integers






    share|cite|improve this answer









    $endgroup$





















      0












      $begingroup$

      As $s:=a+b$ and $a-b$ have the same parity, we can write



      $$leftlfloorfrac{s-2b}2rightrfloor+leftlceilfrac s2rightrceil=leftlfloorfrac s2rightrfloor+leftlceilfrac s2rightrceil-b=s-b=a.$$






      share|cite









      $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%2f3087071%2fceil-and-floor-function%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        4 Answers
        4






        active

        oldest

        votes








        4 Answers
        4






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        0












        $begingroup$

        If $a$ and $b$ are both odd (or both even), then $a-b$ and $a+b$ are both even, and thus $$leftlfloor frac{a-b}{2} rightrfloor = frac{a-b}{2} quadtext{and}quad leftlceil frac{a+b}{2} rightrceil = frac{a+b}{2}.$$



        Otherwise, if exactly one of $a$ and $b$ is odd, then $a-b$ and $a+b$ are both odd, and thus $$leftlfloor frac{a-b}{2} rightrfloor = frac{a-b}{2} - frac12 quadtext{and}quad leftlceil frac{a+b}{2} rightrceil = frac{a+b}{2} + frac12.$$



        In either case, it's easy to check that your equation holds.






        share|cite|improve this answer









        $endgroup$













        • $begingroup$
          Thank you very much for the odd case, made very simple!
          $endgroup$
          – Adam54
          14 mins ago
















        0












        $begingroup$

        If $a$ and $b$ are both odd (or both even), then $a-b$ and $a+b$ are both even, and thus $$leftlfloor frac{a-b}{2} rightrfloor = frac{a-b}{2} quadtext{and}quad leftlceil frac{a+b}{2} rightrceil = frac{a+b}{2}.$$



        Otherwise, if exactly one of $a$ and $b$ is odd, then $a-b$ and $a+b$ are both odd, and thus $$leftlfloor frac{a-b}{2} rightrfloor = frac{a-b}{2} - frac12 quadtext{and}quad leftlceil frac{a+b}{2} rightrceil = frac{a+b}{2} + frac12.$$



        In either case, it's easy to check that your equation holds.






        share|cite|improve this answer









        $endgroup$













        • $begingroup$
          Thank you very much for the odd case, made very simple!
          $endgroup$
          – Adam54
          14 mins ago














        0












        0








        0





        $begingroup$

        If $a$ and $b$ are both odd (or both even), then $a-b$ and $a+b$ are both even, and thus $$leftlfloor frac{a-b}{2} rightrfloor = frac{a-b}{2} quadtext{and}quad leftlceil frac{a+b}{2} rightrceil = frac{a+b}{2}.$$



        Otherwise, if exactly one of $a$ and $b$ is odd, then $a-b$ and $a+b$ are both odd, and thus $$leftlfloor frac{a-b}{2} rightrfloor = frac{a-b}{2} - frac12 quadtext{and}quad leftlceil frac{a+b}{2} rightrceil = frac{a+b}{2} + frac12.$$



        In either case, it's easy to check that your equation holds.






        share|cite|improve this answer









        $endgroup$



        If $a$ and $b$ are both odd (or both even), then $a-b$ and $a+b$ are both even, and thus $$leftlfloor frac{a-b}{2} rightrfloor = frac{a-b}{2} quadtext{and}quad leftlceil frac{a+b}{2} rightrceil = frac{a+b}{2}.$$



        Otherwise, if exactly one of $a$ and $b$ is odd, then $a-b$ and $a+b$ are both odd, and thus $$leftlfloor frac{a-b}{2} rightrfloor = frac{a-b}{2} - frac12 quadtext{and}quad leftlceil frac{a+b}{2} rightrceil = frac{a+b}{2} + frac12.$$



        In either case, it's easy to check that your equation holds.







        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered 17 mins ago









        Ilmari KaronenIlmari Karonen

        19.7k25183




        19.7k25183












        • $begingroup$
          Thank you very much for the odd case, made very simple!
          $endgroup$
          – Adam54
          14 mins ago


















        • $begingroup$
          Thank you very much for the odd case, made very simple!
          $endgroup$
          – Adam54
          14 mins ago
















        $begingroup$
        Thank you very much for the odd case, made very simple!
        $endgroup$
        – Adam54
        14 mins ago




        $begingroup$
        Thank you very much for the odd case, made very simple!
        $endgroup$
        – Adam54
        14 mins ago











        2












        $begingroup$

        The equality only depends on the parity of $a+b$, as it is the same as that of $a-b$. Then



        $$leftlfloorfrac02rightrfloor+leftlceilfrac02rightrceil=0$$
        and
        $$leftlfloorfrac12rightrfloor+leftlceilfrac12rightrceil=1$$
        are enough as a proof.






        share|cite|improve this answer









        $endgroup$


















          2












          $begingroup$

          The equality only depends on the parity of $a+b$, as it is the same as that of $a-b$. Then



          $$leftlfloorfrac02rightrfloor+leftlceilfrac02rightrceil=0$$
          and
          $$leftlfloorfrac12rightrfloor+leftlceilfrac12rightrceil=1$$
          are enough as a proof.






          share|cite|improve this answer









          $endgroup$
















            2












            2








            2





            $begingroup$

            The equality only depends on the parity of $a+b$, as it is the same as that of $a-b$. Then



            $$leftlfloorfrac02rightrfloor+leftlceilfrac02rightrceil=0$$
            and
            $$leftlfloorfrac12rightrfloor+leftlceilfrac12rightrceil=1$$
            are enough as a proof.






            share|cite|improve this answer









            $endgroup$



            The equality only depends on the parity of $a+b$, as it is the same as that of $a-b$. Then



            $$leftlfloorfrac02rightrfloor+leftlceilfrac02rightrceil=0$$
            and
            $$leftlfloorfrac12rightrfloor+leftlceilfrac12rightrceil=1$$
            are enough as a proof.







            share|cite|improve this answer












            share|cite|improve this answer



            share|cite|improve this answer










            answered 19 mins ago









            Yves DaoustYves Daoust

            125k671223




            125k671223























                2












                $begingroup$

                If $a$ and $b$ are both odd then we have $a=2m+1$ and $b=2n+1$ where $m$ and $n$ are positive integers.



                Then, we have begin{align}leftlfloorfrac{a-b}2rightrfloor+leftlceilfrac{a+b}2rightrceil &= leftlfloorfrac{(2m+1)-(2n+1)}2rightrfloor+ leftlceilfrac{(2m+1)+(2n+1)}2rightrceil\
                &=leftlfloorfrac{2m-2n}2rightrfloor+ leftlceilfrac{2m+2n+2}2rightrceil\
                &=lfloor m-nrfloor + lceil m+n+1rceil\
                &= m-n + m+n+1tag{$*$}\
                &= 2m+1\
                &=aend{align}



                We can get to $(*)$ because $m$ and $n$ are integers and so their floor (or ceiling) is just the number inside (two integers added or subtracted will always give an integer answer).



                If $a$ is even and $b$ is odd, then we have $a=2m$ and $b=2n+1$, again for $m$ and $n$ integers.



                So we have begin{align}leftlfloorfrac{a-b}2rightrfloor+leftlceilfrac{a+b}2rightrceil &= leftlfloorfrac{(2m)-(2n+1)}2rightrfloor+ leftlceilfrac{(2m)+(2n+1)}2rightrceil\
                &=leftlfloorfrac{2m-2n-1}2rightrfloor+ leftlceilfrac{2m+2n+1}2rightrceil\
                &=leftlfloor m-n-frac 12rightrfloor + leftlceil m+n+frac12rightrceil\
                &= m-n -1+ m+n+1tag{$dagger$}\
                &= 2m\
                &=aend{align}



                Here we get to $(dagger)$ because we round the first half down and the second half up to their respective nearest integers






                share|cite|improve this answer









                $endgroup$


















                  2












                  $begingroup$

                  If $a$ and $b$ are both odd then we have $a=2m+1$ and $b=2n+1$ where $m$ and $n$ are positive integers.



                  Then, we have begin{align}leftlfloorfrac{a-b}2rightrfloor+leftlceilfrac{a+b}2rightrceil &= leftlfloorfrac{(2m+1)-(2n+1)}2rightrfloor+ leftlceilfrac{(2m+1)+(2n+1)}2rightrceil\
                  &=leftlfloorfrac{2m-2n}2rightrfloor+ leftlceilfrac{2m+2n+2}2rightrceil\
                  &=lfloor m-nrfloor + lceil m+n+1rceil\
                  &= m-n + m+n+1tag{$*$}\
                  &= 2m+1\
                  &=aend{align}



                  We can get to $(*)$ because $m$ and $n$ are integers and so their floor (or ceiling) is just the number inside (two integers added or subtracted will always give an integer answer).



                  If $a$ is even and $b$ is odd, then we have $a=2m$ and $b=2n+1$, again for $m$ and $n$ integers.



                  So we have begin{align}leftlfloorfrac{a-b}2rightrfloor+leftlceilfrac{a+b}2rightrceil &= leftlfloorfrac{(2m)-(2n+1)}2rightrfloor+ leftlceilfrac{(2m)+(2n+1)}2rightrceil\
                  &=leftlfloorfrac{2m-2n-1}2rightrfloor+ leftlceilfrac{2m+2n+1}2rightrceil\
                  &=leftlfloor m-n-frac 12rightrfloor + leftlceil m+n+frac12rightrceil\
                  &= m-n -1+ m+n+1tag{$dagger$}\
                  &= 2m\
                  &=aend{align}



                  Here we get to $(dagger)$ because we round the first half down and the second half up to their respective nearest integers






                  share|cite|improve this answer









                  $endgroup$
















                    2












                    2








                    2





                    $begingroup$

                    If $a$ and $b$ are both odd then we have $a=2m+1$ and $b=2n+1$ where $m$ and $n$ are positive integers.



                    Then, we have begin{align}leftlfloorfrac{a-b}2rightrfloor+leftlceilfrac{a+b}2rightrceil &= leftlfloorfrac{(2m+1)-(2n+1)}2rightrfloor+ leftlceilfrac{(2m+1)+(2n+1)}2rightrceil\
                    &=leftlfloorfrac{2m-2n}2rightrfloor+ leftlceilfrac{2m+2n+2}2rightrceil\
                    &=lfloor m-nrfloor + lceil m+n+1rceil\
                    &= m-n + m+n+1tag{$*$}\
                    &= 2m+1\
                    &=aend{align}



                    We can get to $(*)$ because $m$ and $n$ are integers and so their floor (or ceiling) is just the number inside (two integers added or subtracted will always give an integer answer).



                    If $a$ is even and $b$ is odd, then we have $a=2m$ and $b=2n+1$, again for $m$ and $n$ integers.



                    So we have begin{align}leftlfloorfrac{a-b}2rightrfloor+leftlceilfrac{a+b}2rightrceil &= leftlfloorfrac{(2m)-(2n+1)}2rightrfloor+ leftlceilfrac{(2m)+(2n+1)}2rightrceil\
                    &=leftlfloorfrac{2m-2n-1}2rightrfloor+ leftlceilfrac{2m+2n+1}2rightrceil\
                    &=leftlfloor m-n-frac 12rightrfloor + leftlceil m+n+frac12rightrceil\
                    &= m-n -1+ m+n+1tag{$dagger$}\
                    &= 2m\
                    &=aend{align}



                    Here we get to $(dagger)$ because we round the first half down and the second half up to their respective nearest integers






                    share|cite|improve this answer









                    $endgroup$



                    If $a$ and $b$ are both odd then we have $a=2m+1$ and $b=2n+1$ where $m$ and $n$ are positive integers.



                    Then, we have begin{align}leftlfloorfrac{a-b}2rightrfloor+leftlceilfrac{a+b}2rightrceil &= leftlfloorfrac{(2m+1)-(2n+1)}2rightrfloor+ leftlceilfrac{(2m+1)+(2n+1)}2rightrceil\
                    &=leftlfloorfrac{2m-2n}2rightrfloor+ leftlceilfrac{2m+2n+2}2rightrceil\
                    &=lfloor m-nrfloor + lceil m+n+1rceil\
                    &= m-n + m+n+1tag{$*$}\
                    &= 2m+1\
                    &=aend{align}



                    We can get to $(*)$ because $m$ and $n$ are integers and so their floor (or ceiling) is just the number inside (two integers added or subtracted will always give an integer answer).



                    If $a$ is even and $b$ is odd, then we have $a=2m$ and $b=2n+1$, again for $m$ and $n$ integers.



                    So we have begin{align}leftlfloorfrac{a-b}2rightrfloor+leftlceilfrac{a+b}2rightrceil &= leftlfloorfrac{(2m)-(2n+1)}2rightrfloor+ leftlceilfrac{(2m)+(2n+1)}2rightrceil\
                    &=leftlfloorfrac{2m-2n-1}2rightrfloor+ leftlceilfrac{2m+2n+1}2rightrceil\
                    &=leftlfloor m-n-frac 12rightrfloor + leftlceil m+n+frac12rightrceil\
                    &= m-n -1+ m+n+1tag{$dagger$}\
                    &= 2m\
                    &=aend{align}



                    Here we get to $(dagger)$ because we round the first half down and the second half up to their respective nearest integers







                    share|cite|improve this answer












                    share|cite|improve this answer



                    share|cite|improve this answer










                    answered 16 mins ago









                    lioness99alioness99a

                    3,6842727




                    3,6842727























                        0












                        $begingroup$

                        As $s:=a+b$ and $a-b$ have the same parity, we can write



                        $$leftlfloorfrac{s-2b}2rightrfloor+leftlceilfrac s2rightrceil=leftlfloorfrac s2rightrfloor+leftlceilfrac s2rightrceil-b=s-b=a.$$






                        share|cite









                        $endgroup$


















                          0












                          $begingroup$

                          As $s:=a+b$ and $a-b$ have the same parity, we can write



                          $$leftlfloorfrac{s-2b}2rightrfloor+leftlceilfrac s2rightrceil=leftlfloorfrac s2rightrfloor+leftlceilfrac s2rightrceil-b=s-b=a.$$






                          share|cite









                          $endgroup$
















                            0












                            0








                            0





                            $begingroup$

                            As $s:=a+b$ and $a-b$ have the same parity, we can write



                            $$leftlfloorfrac{s-2b}2rightrfloor+leftlceilfrac s2rightrceil=leftlfloorfrac s2rightrfloor+leftlceilfrac s2rightrceil-b=s-b=a.$$






                            share|cite









                            $endgroup$



                            As $s:=a+b$ and $a-b$ have the same parity, we can write



                            $$leftlfloorfrac{s-2b}2rightrfloor+leftlceilfrac s2rightrceil=leftlfloorfrac s2rightrfloor+leftlceilfrac s2rightrceil-b=s-b=a.$$







                            share|cite












                            share|cite



                            share|cite










                            answered 4 mins ago









                            Yves DaoustYves Daoust

                            125k671223




                            125k671223






























                                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%2f3087071%2fceil-and-floor-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 to label and detect the document text images

                                Vallis Paradisi

                                Tabula Rosettana