Number of labelled trees with exactly 3 leaves

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











up vote
5
down vote

favorite
1












I have seen some relevant questions here about that matter [1], [2] but I am getting a different result and I cannot understand if I am wrong. So the question is:




Find the number of labelled trees on $ngeq 4$ vertices that have exactly $3$ leaves.




This problem can be translated as follows: From the Prüfer code we want to count the number of codewords in which exactly $n-3$ different numbers appear. We know that a Prüfer code for $n$ vertices will have a length of $n-2$. So we have to place $n$ items in $n-3$ positions without repetitions and this can be done in $fracn!(n-3)!$ times their permutations ($(n-3)!$) and then we have 1 position to choose from $n-3$ numbers (because we have $3$ leaves) and therefore $binomn-31$ ways to fill that position. So in total we have $fracn!(n-3)!(n-3)!(n-3)!(n-4)!=n!(n-3)$ trees with exactly three leaves.



Am I missing something in my enumeration?







share|cite|improve this question


























    up vote
    5
    down vote

    favorite
    1












    I have seen some relevant questions here about that matter [1], [2] but I am getting a different result and I cannot understand if I am wrong. So the question is:




    Find the number of labelled trees on $ngeq 4$ vertices that have exactly $3$ leaves.




    This problem can be translated as follows: From the Prüfer code we want to count the number of codewords in which exactly $n-3$ different numbers appear. We know that a Prüfer code for $n$ vertices will have a length of $n-2$. So we have to place $n$ items in $n-3$ positions without repetitions and this can be done in $fracn!(n-3)!$ times their permutations ($(n-3)!$) and then we have 1 position to choose from $n-3$ numbers (because we have $3$ leaves) and therefore $binomn-31$ ways to fill that position. So in total we have $fracn!(n-3)!(n-3)!(n-3)!(n-4)!=n!(n-3)$ trees with exactly three leaves.



    Am I missing something in my enumeration?







    share|cite|improve this question
























      up vote
      5
      down vote

      favorite
      1









      up vote
      5
      down vote

      favorite
      1






      1





      I have seen some relevant questions here about that matter [1], [2] but I am getting a different result and I cannot understand if I am wrong. So the question is:




      Find the number of labelled trees on $ngeq 4$ vertices that have exactly $3$ leaves.




      This problem can be translated as follows: From the Prüfer code we want to count the number of codewords in which exactly $n-3$ different numbers appear. We know that a Prüfer code for $n$ vertices will have a length of $n-2$. So we have to place $n$ items in $n-3$ positions without repetitions and this can be done in $fracn!(n-3)!$ times their permutations ($(n-3)!$) and then we have 1 position to choose from $n-3$ numbers (because we have $3$ leaves) and therefore $binomn-31$ ways to fill that position. So in total we have $fracn!(n-3)!(n-3)!(n-3)!(n-4)!=n!(n-3)$ trees with exactly three leaves.



      Am I missing something in my enumeration?







      share|cite|improve this question














      I have seen some relevant questions here about that matter [1], [2] but I am getting a different result and I cannot understand if I am wrong. So the question is:




      Find the number of labelled trees on $ngeq 4$ vertices that have exactly $3$ leaves.




      This problem can be translated as follows: From the Prüfer code we want to count the number of codewords in which exactly $n-3$ different numbers appear. We know that a Prüfer code for $n$ vertices will have a length of $n-2$. So we have to place $n$ items in $n-3$ positions without repetitions and this can be done in $fracn!(n-3)!$ times their permutations ($(n-3)!$) and then we have 1 position to choose from $n-3$ numbers (because we have $3$ leaves) and therefore $binomn-31$ ways to fill that position. So in total we have $fracn!(n-3)!(n-3)!(n-3)!(n-4)!=n!(n-3)$ trees with exactly three leaves.



      Am I missing something in my enumeration?









      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Aug 21 at 14:33

























      asked Aug 21 at 12:47









      koygian

      1167




      1167




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          You have the right Prufer codes, but you have made some mistakes in counting. It's easy to check your formula doesn't work: for $n=4$ there are $4$ labelled trees with this property, because the tree must be a star and the only choice you have is which label goes in the middle.



          First, to choose $n-3$ from $n$ elements in order is $binom n3times (n-3)!=fracn!6$.



          Secondly, when you choose an element to duplicate, you not only need to choose which element is duplicated ($n-3$ options) but also where to put the duplicate ($n-2$ possible places). However, this actually counts each code twice, because it distinguishes the "original" and "duplicate" version of the label that appears twice, meaning you need to divide by $2$.



          So overall there are $fracn!6timesfrac(n-3)(n-2)2=fracn!(n-2)(n-3)12$ such trees.






          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',
            convertImagesToLinks: true,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            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%2f2889822%2fnumber-of-labelled-trees-with-exactly-3-leaves%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            2
            down vote



            accepted










            You have the right Prufer codes, but you have made some mistakes in counting. It's easy to check your formula doesn't work: for $n=4$ there are $4$ labelled trees with this property, because the tree must be a star and the only choice you have is which label goes in the middle.



            First, to choose $n-3$ from $n$ elements in order is $binom n3times (n-3)!=fracn!6$.



            Secondly, when you choose an element to duplicate, you not only need to choose which element is duplicated ($n-3$ options) but also where to put the duplicate ($n-2$ possible places). However, this actually counts each code twice, because it distinguishes the "original" and "duplicate" version of the label that appears twice, meaning you need to divide by $2$.



            So overall there are $fracn!6timesfrac(n-3)(n-2)2=fracn!(n-2)(n-3)12$ such trees.






            share|cite|improve this answer
























              up vote
              2
              down vote



              accepted










              You have the right Prufer codes, but you have made some mistakes in counting. It's easy to check your formula doesn't work: for $n=4$ there are $4$ labelled trees with this property, because the tree must be a star and the only choice you have is which label goes in the middle.



              First, to choose $n-3$ from $n$ elements in order is $binom n3times (n-3)!=fracn!6$.



              Secondly, when you choose an element to duplicate, you not only need to choose which element is duplicated ($n-3$ options) but also where to put the duplicate ($n-2$ possible places). However, this actually counts each code twice, because it distinguishes the "original" and "duplicate" version of the label that appears twice, meaning you need to divide by $2$.



              So overall there are $fracn!6timesfrac(n-3)(n-2)2=fracn!(n-2)(n-3)12$ such trees.






              share|cite|improve this answer






















                up vote
                2
                down vote



                accepted







                up vote
                2
                down vote



                accepted






                You have the right Prufer codes, but you have made some mistakes in counting. It's easy to check your formula doesn't work: for $n=4$ there are $4$ labelled trees with this property, because the tree must be a star and the only choice you have is which label goes in the middle.



                First, to choose $n-3$ from $n$ elements in order is $binom n3times (n-3)!=fracn!6$.



                Secondly, when you choose an element to duplicate, you not only need to choose which element is duplicated ($n-3$ options) but also where to put the duplicate ($n-2$ possible places). However, this actually counts each code twice, because it distinguishes the "original" and "duplicate" version of the label that appears twice, meaning you need to divide by $2$.



                So overall there are $fracn!6timesfrac(n-3)(n-2)2=fracn!(n-2)(n-3)12$ such trees.






                share|cite|improve this answer












                You have the right Prufer codes, but you have made some mistakes in counting. It's easy to check your formula doesn't work: for $n=4$ there are $4$ labelled trees with this property, because the tree must be a star and the only choice you have is which label goes in the middle.



                First, to choose $n-3$ from $n$ elements in order is $binom n3times (n-3)!=fracn!6$.



                Secondly, when you choose an element to duplicate, you not only need to choose which element is duplicated ($n-3$ options) but also where to put the duplicate ($n-2$ possible places). However, this actually counts each code twice, because it distinguishes the "original" and "duplicate" version of the label that appears twice, meaning you need to divide by $2$.



                So overall there are $fracn!6timesfrac(n-3)(n-2)2=fracn!(n-2)(n-3)12$ such trees.







                share|cite|improve this answer












                share|cite|improve this answer



                share|cite|improve this answer










                answered Aug 21 at 14:29









                Especially Lime

                19.3k22252




                19.3k22252






















                     

                    draft saved


                    draft discarded


























                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2889822%2fnumber-of-labelled-trees-with-exactly-3-leaves%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    這個網誌中的熱門文章

                    How to combine Bézier curves to a surface?

                    Mutual Information Always Non-negative

                    Why am i infinitely getting the same tweet with the Twitter Search API?