Number of combinations of dice having different number of faces that add to $10$

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











up vote
3
down vote

favorite












A function $face_sum$ that takes a vector $f$ that represents the number of faces of each die, and a positive integer $s$ , and returns the probability that the sum of the top faces observed is $s$ .



For example, if $f=[3,4,5]$ and $s≤2$ or $s≥13$ , $face_sum$ returns $0$, and if $s=3$ or $s=12$ , it returns $frac13*frac14*frac15=frac160$



$face_sum([2,4,4,6], 10)$



I tried to solve this but I can't find the formula to calculate the number of combination of die faces that add to $10$, as the number of faces are different for each die.



Since max no of possible combination is $6*4*4*2=192$, all I need to find is the number of combination of die faces that add to $10$.



Thanks in advance.







share|cite|improve this question





















  • The generating function for $f([3,4,5],n)$ is $$x^3fracx^3-1x-1fracx^4-1x-1fracx^5-1x-1= x^12+3x^11+6x^10+9x^9+11x^8+11x^7+9x^6+6x^5+3x^4+x^3$$. The generating function for $f([2,4,4,6],n)$ is $$scriptsize x^4fracx^2-1x-1fracx^4-1x-1fracx^4-1x-1fracx^6-1x-1 =x^16+4x^15+9x^14+16x^13+23x^12+28x^11+30x^10+28x^9+23x^8+16x^7+9x^6+4x^5+x^4$$.
    – robjohn♦
    Jul 18 at 19:20











  • don't dice 2 and 3 have the same number of faces?
    – zhw.
    Jul 18 at 19:48










  • yep they have the same number of faces.
    – Udolf
    Jul 19 at 3:33














up vote
3
down vote

favorite












A function $face_sum$ that takes a vector $f$ that represents the number of faces of each die, and a positive integer $s$ , and returns the probability that the sum of the top faces observed is $s$ .



For example, if $f=[3,4,5]$ and $s≤2$ or $s≥13$ , $face_sum$ returns $0$, and if $s=3$ or $s=12$ , it returns $frac13*frac14*frac15=frac160$



$face_sum([2,4,4,6], 10)$



I tried to solve this but I can't find the formula to calculate the number of combination of die faces that add to $10$, as the number of faces are different for each die.



Since max no of possible combination is $6*4*4*2=192$, all I need to find is the number of combination of die faces that add to $10$.



Thanks in advance.







share|cite|improve this question





















  • The generating function for $f([3,4,5],n)$ is $$x^3fracx^3-1x-1fracx^4-1x-1fracx^5-1x-1= x^12+3x^11+6x^10+9x^9+11x^8+11x^7+9x^6+6x^5+3x^4+x^3$$. The generating function for $f([2,4,4,6],n)$ is $$scriptsize x^4fracx^2-1x-1fracx^4-1x-1fracx^4-1x-1fracx^6-1x-1 =x^16+4x^15+9x^14+16x^13+23x^12+28x^11+30x^10+28x^9+23x^8+16x^7+9x^6+4x^5+x^4$$.
    – robjohn♦
    Jul 18 at 19:20











  • don't dice 2 and 3 have the same number of faces?
    – zhw.
    Jul 18 at 19:48










  • yep they have the same number of faces.
    – Udolf
    Jul 19 at 3:33












up vote
3
down vote

favorite









up vote
3
down vote

favorite











A function $face_sum$ that takes a vector $f$ that represents the number of faces of each die, and a positive integer $s$ , and returns the probability that the sum of the top faces observed is $s$ .



For example, if $f=[3,4,5]$ and $s≤2$ or $s≥13$ , $face_sum$ returns $0$, and if $s=3$ or $s=12$ , it returns $frac13*frac14*frac15=frac160$



$face_sum([2,4,4,6], 10)$



I tried to solve this but I can't find the formula to calculate the number of combination of die faces that add to $10$, as the number of faces are different for each die.



Since max no of possible combination is $6*4*4*2=192$, all I need to find is the number of combination of die faces that add to $10$.



Thanks in advance.







share|cite|improve this question













A function $face_sum$ that takes a vector $f$ that represents the number of faces of each die, and a positive integer $s$ , and returns the probability that the sum of the top faces observed is $s$ .



For example, if $f=[3,4,5]$ and $s≤2$ or $s≥13$ , $face_sum$ returns $0$, and if $s=3$ or $s=12$ , it returns $frac13*frac14*frac15=frac160$



$face_sum([2,4,4,6], 10)$



I tried to solve this but I can't find the formula to calculate the number of combination of die faces that add to $10$, as the number of faces are different for each die.



Since max no of possible combination is $6*4*4*2=192$, all I need to find is the number of combination of die faces that add to $10$.



Thanks in advance.









share|cite|improve this question












share|cite|improve this question




share|cite|improve this question








edited Jul 18 at 20:02









GuySa

402313




402313









asked Jul 18 at 19:10









Udolf

355




355











  • The generating function for $f([3,4,5],n)$ is $$x^3fracx^3-1x-1fracx^4-1x-1fracx^5-1x-1= x^12+3x^11+6x^10+9x^9+11x^8+11x^7+9x^6+6x^5+3x^4+x^3$$. The generating function for $f([2,4,4,6],n)$ is $$scriptsize x^4fracx^2-1x-1fracx^4-1x-1fracx^4-1x-1fracx^6-1x-1 =x^16+4x^15+9x^14+16x^13+23x^12+28x^11+30x^10+28x^9+23x^8+16x^7+9x^6+4x^5+x^4$$.
    – robjohn♦
    Jul 18 at 19:20











  • don't dice 2 and 3 have the same number of faces?
    – zhw.
    Jul 18 at 19:48










  • yep they have the same number of faces.
    – Udolf
    Jul 19 at 3:33
















  • The generating function for $f([3,4,5],n)$ is $$x^3fracx^3-1x-1fracx^4-1x-1fracx^5-1x-1= x^12+3x^11+6x^10+9x^9+11x^8+11x^7+9x^6+6x^5+3x^4+x^3$$. The generating function for $f([2,4,4,6],n)$ is $$scriptsize x^4fracx^2-1x-1fracx^4-1x-1fracx^4-1x-1fracx^6-1x-1 =x^16+4x^15+9x^14+16x^13+23x^12+28x^11+30x^10+28x^9+23x^8+16x^7+9x^6+4x^5+x^4$$.
    – robjohn♦
    Jul 18 at 19:20











  • don't dice 2 and 3 have the same number of faces?
    – zhw.
    Jul 18 at 19:48










  • yep they have the same number of faces.
    – Udolf
    Jul 19 at 3:33















The generating function for $f([3,4,5],n)$ is $$x^3fracx^3-1x-1fracx^4-1x-1fracx^5-1x-1= x^12+3x^11+6x^10+9x^9+11x^8+11x^7+9x^6+6x^5+3x^4+x^3$$. The generating function for $f([2,4,4,6],n)$ is $$scriptsize x^4fracx^2-1x-1fracx^4-1x-1fracx^4-1x-1fracx^6-1x-1 =x^16+4x^15+9x^14+16x^13+23x^12+28x^11+30x^10+28x^9+23x^8+16x^7+9x^6+4x^5+x^4$$.
– robjohn♦
Jul 18 at 19:20





The generating function for $f([3,4,5],n)$ is $$x^3fracx^3-1x-1fracx^4-1x-1fracx^5-1x-1= x^12+3x^11+6x^10+9x^9+11x^8+11x^7+9x^6+6x^5+3x^4+x^3$$. The generating function for $f([2,4,4,6],n)$ is $$scriptsize x^4fracx^2-1x-1fracx^4-1x-1fracx^4-1x-1fracx^6-1x-1 =x^16+4x^15+9x^14+16x^13+23x^12+28x^11+30x^10+28x^9+23x^8+16x^7+9x^6+4x^5+x^4$$.
– robjohn♦
Jul 18 at 19:20













don't dice 2 and 3 have the same number of faces?
– zhw.
Jul 18 at 19:48




don't dice 2 and 3 have the same number of faces?
– zhw.
Jul 18 at 19:48












yep they have the same number of faces.
– Udolf
Jul 19 at 3:33




yep they have the same number of faces.
– Udolf
Jul 19 at 3:33










2 Answers
2






active

oldest

votes

















up vote
1
down vote



accepted










The formula is a bit messy. Suppose there are $n$ dice, and the list is $f=[f_1,f_2,dots,f_n]$. You want to count the number of integer solutions to the constrained equation
$$
beginalign
x_1+x_2+dots+x_n &= s\ 1le x_i&le f_ihspace2cm text for i=1,2,dots,n
endalign
$$
To solve this, first, count the number of solutions without the constraint $x_ile f_i$. This can be shown to be $binoms-1n-1$ (imagine a line of $s$ dots, and you place dividers in $n-1$ of the $s-1$ spaces between the dots). Now, use inclusion exclusion to subtract out the "bad" solutions where some $x_i > f_i$. The result is this:
$$
boxedBbb P(n text dice with f_1,dots,f_n text faces sum to s) = frac1f_1timesdotstimes f_nsum_Ssubseteq 1,2,dots,n(-1)^binoms-1-sum_iin Sf_in-1.
$$
There are $2^n$ summands, one for each subset of $1,2,dots,n$ (i.e. subset of the available dice).



For example, when $f=[2,4,4,6]$ and $s=10$, you get
$$
1over 2cdot 4cdot 4cdot 6left[
beginarraylbinom10-14-1\
-binom10-2-14-1-binom10-4-14-1
-binom10-4-14-1-binom10-6-14-1\
+binom10-2-4-14-1+binom10-2-4-14-1
endarrayright].
$$
Terms with $sum_iin Sf_i>s-n$ have been omitted, since in these cases the binomial coefficient is zero.






share|cite|improve this answer























  • Thank you for this detailed answer.
    – Udolf
    Jul 19 at 3:30

















up vote
0
down vote













Do you know how to find the number of solutions for an equation like the following?
$$
x_1 + x_2 + ... + x_n = k
$$
given $forall i in [n]: x_i in S_i$ for some set $S_i$.






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%2f2855897%2fnumber-of-combinations-of-dice-having-different-number-of-faces-that-add-to-10%23new-answer', 'question_page');

    );

    Post as a guest






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    The formula is a bit messy. Suppose there are $n$ dice, and the list is $f=[f_1,f_2,dots,f_n]$. You want to count the number of integer solutions to the constrained equation
    $$
    beginalign
    x_1+x_2+dots+x_n &= s\ 1le x_i&le f_ihspace2cm text for i=1,2,dots,n
    endalign
    $$
    To solve this, first, count the number of solutions without the constraint $x_ile f_i$. This can be shown to be $binoms-1n-1$ (imagine a line of $s$ dots, and you place dividers in $n-1$ of the $s-1$ spaces between the dots). Now, use inclusion exclusion to subtract out the "bad" solutions where some $x_i > f_i$. The result is this:
    $$
    boxedBbb P(n text dice with f_1,dots,f_n text faces sum to s) = frac1f_1timesdotstimes f_nsum_Ssubseteq 1,2,dots,n(-1)^binoms-1-sum_iin Sf_in-1.
    $$
    There are $2^n$ summands, one for each subset of $1,2,dots,n$ (i.e. subset of the available dice).



    For example, when $f=[2,4,4,6]$ and $s=10$, you get
    $$
    1over 2cdot 4cdot 4cdot 6left[
    beginarraylbinom10-14-1\
    -binom10-2-14-1-binom10-4-14-1
    -binom10-4-14-1-binom10-6-14-1\
    +binom10-2-4-14-1+binom10-2-4-14-1
    endarrayright].
    $$
    Terms with $sum_iin Sf_i>s-n$ have been omitted, since in these cases the binomial coefficient is zero.






    share|cite|improve this answer























    • Thank you for this detailed answer.
      – Udolf
      Jul 19 at 3:30














    up vote
    1
    down vote



    accepted










    The formula is a bit messy. Suppose there are $n$ dice, and the list is $f=[f_1,f_2,dots,f_n]$. You want to count the number of integer solutions to the constrained equation
    $$
    beginalign
    x_1+x_2+dots+x_n &= s\ 1le x_i&le f_ihspace2cm text for i=1,2,dots,n
    endalign
    $$
    To solve this, first, count the number of solutions without the constraint $x_ile f_i$. This can be shown to be $binoms-1n-1$ (imagine a line of $s$ dots, and you place dividers in $n-1$ of the $s-1$ spaces between the dots). Now, use inclusion exclusion to subtract out the "bad" solutions where some $x_i > f_i$. The result is this:
    $$
    boxedBbb P(n text dice with f_1,dots,f_n text faces sum to s) = frac1f_1timesdotstimes f_nsum_Ssubseteq 1,2,dots,n(-1)^binoms-1-sum_iin Sf_in-1.
    $$
    There are $2^n$ summands, one for each subset of $1,2,dots,n$ (i.e. subset of the available dice).



    For example, when $f=[2,4,4,6]$ and $s=10$, you get
    $$
    1over 2cdot 4cdot 4cdot 6left[
    beginarraylbinom10-14-1\
    -binom10-2-14-1-binom10-4-14-1
    -binom10-4-14-1-binom10-6-14-1\
    +binom10-2-4-14-1+binom10-2-4-14-1
    endarrayright].
    $$
    Terms with $sum_iin Sf_i>s-n$ have been omitted, since in these cases the binomial coefficient is zero.






    share|cite|improve this answer























    • Thank you for this detailed answer.
      – Udolf
      Jul 19 at 3:30












    up vote
    1
    down vote



    accepted







    up vote
    1
    down vote



    accepted






    The formula is a bit messy. Suppose there are $n$ dice, and the list is $f=[f_1,f_2,dots,f_n]$. You want to count the number of integer solutions to the constrained equation
    $$
    beginalign
    x_1+x_2+dots+x_n &= s\ 1le x_i&le f_ihspace2cm text for i=1,2,dots,n
    endalign
    $$
    To solve this, first, count the number of solutions without the constraint $x_ile f_i$. This can be shown to be $binoms-1n-1$ (imagine a line of $s$ dots, and you place dividers in $n-1$ of the $s-1$ spaces between the dots). Now, use inclusion exclusion to subtract out the "bad" solutions where some $x_i > f_i$. The result is this:
    $$
    boxedBbb P(n text dice with f_1,dots,f_n text faces sum to s) = frac1f_1timesdotstimes f_nsum_Ssubseteq 1,2,dots,n(-1)^binoms-1-sum_iin Sf_in-1.
    $$
    There are $2^n$ summands, one for each subset of $1,2,dots,n$ (i.e. subset of the available dice).



    For example, when $f=[2,4,4,6]$ and $s=10$, you get
    $$
    1over 2cdot 4cdot 4cdot 6left[
    beginarraylbinom10-14-1\
    -binom10-2-14-1-binom10-4-14-1
    -binom10-4-14-1-binom10-6-14-1\
    +binom10-2-4-14-1+binom10-2-4-14-1
    endarrayright].
    $$
    Terms with $sum_iin Sf_i>s-n$ have been omitted, since in these cases the binomial coefficient is zero.






    share|cite|improve this answer















    The formula is a bit messy. Suppose there are $n$ dice, and the list is $f=[f_1,f_2,dots,f_n]$. You want to count the number of integer solutions to the constrained equation
    $$
    beginalign
    x_1+x_2+dots+x_n &= s\ 1le x_i&le f_ihspace2cm text for i=1,2,dots,n
    endalign
    $$
    To solve this, first, count the number of solutions without the constraint $x_ile f_i$. This can be shown to be $binoms-1n-1$ (imagine a line of $s$ dots, and you place dividers in $n-1$ of the $s-1$ spaces between the dots). Now, use inclusion exclusion to subtract out the "bad" solutions where some $x_i > f_i$. The result is this:
    $$
    boxedBbb P(n text dice with f_1,dots,f_n text faces sum to s) = frac1f_1timesdotstimes f_nsum_Ssubseteq 1,2,dots,n(-1)^binoms-1-sum_iin Sf_in-1.
    $$
    There are $2^n$ summands, one for each subset of $1,2,dots,n$ (i.e. subset of the available dice).



    For example, when $f=[2,4,4,6]$ and $s=10$, you get
    $$
    1over 2cdot 4cdot 4cdot 6left[
    beginarraylbinom10-14-1\
    -binom10-2-14-1-binom10-4-14-1
    -binom10-4-14-1-binom10-6-14-1\
    +binom10-2-4-14-1+binom10-2-4-14-1
    endarrayright].
    $$
    Terms with $sum_iin Sf_i>s-n$ have been omitted, since in these cases the binomial coefficient is zero.







    share|cite|improve this answer















    share|cite|improve this answer



    share|cite|improve this answer








    edited Jul 24 at 18:08


























    answered Jul 18 at 19:40









    Mike Earnest

    15.4k11644




    15.4k11644











    • Thank you for this detailed answer.
      – Udolf
      Jul 19 at 3:30
















    • Thank you for this detailed answer.
      – Udolf
      Jul 19 at 3:30















    Thank you for this detailed answer.
    – Udolf
    Jul 19 at 3:30




    Thank you for this detailed answer.
    – Udolf
    Jul 19 at 3:30










    up vote
    0
    down vote













    Do you know how to find the number of solutions for an equation like the following?
    $$
    x_1 + x_2 + ... + x_n = k
    $$
    given $forall i in [n]: x_i in S_i$ for some set $S_i$.






    share|cite|improve this answer

























      up vote
      0
      down vote













      Do you know how to find the number of solutions for an equation like the following?
      $$
      x_1 + x_2 + ... + x_n = k
      $$
      given $forall i in [n]: x_i in S_i$ for some set $S_i$.






      share|cite|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        Do you know how to find the number of solutions for an equation like the following?
        $$
        x_1 + x_2 + ... + x_n = k
        $$
        given $forall i in [n]: x_i in S_i$ for some set $S_i$.






        share|cite|improve this answer













        Do you know how to find the number of solutions for an equation like the following?
        $$
        x_1 + x_2 + ... + x_n = k
        $$
        given $forall i in [n]: x_i in S_i$ for some set $S_i$.







        share|cite|improve this answer













        share|cite|improve this answer



        share|cite|improve this answer











        answered Jul 18 at 19:25









        GuySa

        402313




        402313






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2855897%2fnumber-of-combinations-of-dice-having-different-number-of-faces-that-add-to-10%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            What is the equation of a 3D cone with generalised tilt?

            Color the edges and diagonals of a regular polygon

            Relationship between determinant of matrix and determinant of adjoint?