Another Math Question

[quote]legendaryblaze wrote:
I found an interesting link.

[/quote]

Cool link.

I am not aware of any other way to do this besides brute force like malonetd started. There is a formula that relates to this here: http://www.madandmoonly.com/doctormatt/mathematics/dice1.pdf (see appendix C)

It doesn’t really make it any easier when dealing with 5 dice, it still takes alot of work.

This is really a better computer programming question than math question, and any math teacher that would put a question like this on a timed exam must be insane.

To finish Malone’s work and add in the number of times each combination of numbers occurs:

6 6 6 1 1 10=C(5,2)
6 6 5 2 1 60=P(5,3)
6 6 4 3 1 60=P(5,3)
6 6 4 2 2 30=5C(4,2)
6 6 3 3 2 30=5
C(4,2)
6 5 5 3 1 60=P(5,3)
6 5 5 2 2 30=5C(4,2)
6 5 4 4 1 60=P(5,3)
6 5 4 3 2 120=P(5,4)
6 5 3 3 3 20=P(5,2)
6 4 4 4 2 20=P(5,2)
6 4 4 3 3 30=5
C(4,2)
5 5 5 4 1 20=P(5,2)
5 5 5 3 2 20=P(5,2)
5 5 4 4 2 30=5C(4,2)
5 5 4 3 3 30=5
C(4,2)
5 4 4 4 3 20=P(5,2)
4 4 4 4 4 1

Which gives a total of 651. I’ll leave it to you to figure why I used the combinations and permutations that I did.

EDIT: Fixed a couple typos and added = signs to try and make it easier to read.

[quote]LiveFromThe781 wrote:
isnt there a formula for figuring out probability that involves multiplying all the numbers in linear form?

i took a math course last semester that focused on weird stuff like that and i remember we did something along those lines, i think we only worked on it like one morning so of course i dont remember any of it now.[/quote]

It’s not probability, it’s the different face value combinations of each dye that will produce a total sum of 20 across all 5 die, so if xi represents each of the 5 dice, an example would be
x1 = 6
x2 = 6
x3 = 6
x4 = 1
x5 = 1
Total = 20

[quote]tomg wrote:
You want the number of positive integer solutions to the equation

x1 + x2 + x3 + x4 + x5 = 20

subject to the constraints:

xi <= 6 for i = 1, 2, … , 5.

The number of positive integer solutions to the equation

x1 + x2 + x3 + x4 + x5 = 20

is C(19,4).

You have to use the Inclusion/Exclusion Principle to weed out the solutions you don’t want to finish off the original problem. I’ll try to put up a more detailed solution tomorrow if you still need it.[/quote]

The formula r + n - 1 choose r that I originally posted would give the solution to what you posted (x1 + x2 +x3 + x4 + x5 = 20) however I don’t think this is correct since that formula would also account for invalid rolls such as x1=0, x2=0, x3=0, x4=0, x5=20 just to name one, please correct me if I’m wrong. Can I ask where you came up with 19 choose 4? I have no idea where you came up with that number.

Thanks for all the responses, I believe malonetd is correct with 18, since as far as I can tell we’re assuming we care not about order and only distinct combinations of face values. I’m sure there’s a very simple and elegant solution to finding this quickly and I may ask my prof later in the week and post the answer for anyone interested. I realized soon after posting this that one reason I was having so much trouble with it is we never did problems of this type very much, so hopefully something like this won’t come up on the exam, I’ll keep my fingers crossed :confused:

Honestly, the world made more sense after I took differential equations and statistics.

They’re like the brussel sprouts of math courses.

I fucking hate brussel sprouts.

It is a simple computer problem - Less than a minute to program in python. Pretty stupid brute force but takes no time to execute.

count = 0
for i1 in range(1,7):
for i2 in range(1,7):
for i3 in range(1,7):
for i4 in range(1,7):
for i5 in range(1,7):
if sum((i1, i2, i3, i4, i5)) == 20:
count += 1
print(count)

[quote]tcpoint wrote:
It is a simple computer problem - Less than a minute to program in python. Pretty stupid brute force but takes no time to execute.

count = 0
for i1 in range(1,7):
for i2 in range(1,7):
for i3 in range(1,7):
for i4 in range(1,7):
for i5 in range(1,7):
if sum((i1, i2, i3, i4, i5)) == 20:
count += 1
print(count)[/quote]

I don’t know what the hell you just typed, but it took this thread to get you to finally post after 7 years?!

[quote]PonceDeLeon wrote:
Honestly, the world made more sense after I took differential equations and statistics.

They’re like the brussel sprouts of math courses.[/quote]

X2

[quote]malonetd wrote:
tcpoint wrote:
It is a simple computer problem - Less than a minute to program in python. Pretty stupid brute force but takes no time to execute.

count = 0
for i1 in range(1,7):
for i2 in range(1,7):
for i3 in range(1,7):
for i4 in range(1,7):
for i5 in range(1,7):
if sum((i1, i2, i3, i4, i5)) == 20:
count += 1
print(count)

I don’t know what the hell you just typed, but it took this thread to get you to finally post after 7 years?![/quote]

LOL…he just couldn’t take it anymore!

[quote]JLu wrote:
Can I ask where you came up with 19 choose 4? I have no idea where you came up with that number. [/quote]

It’s similar to the number of ways you could give 20 identical coins to 5 kids so that each kid gets at least one coin.

First, you start off by just giving each kid one coin. That leaves you with 15 coins to give out.

To give out the remaining 15 coins, you could line them up like so:

OOOOOOOOOOOOOOO

and then insert 4 sticks in different spots. Here is just one example of how you could do this:

OO|OOOOO|OOO|OOO|OO

For this particular placement of the four sticks, Kid 1 would get two of the remaining coins, Kid 2 would get 5 of the remaining coins, Kid 3 would get 3, Kid 4 would get 3, and Kid 5 would get 2.

So the number of ways of distributing the remaining coins is the same as the number of arrangements of this type you could make. You’ve got 19 things in the arrangement, 15 coins and 4 sticks, so there are 19 places where either a stick or coin can be placed. Of those 19 places, you need to choose 4 places for the sticks to go make the arrangement.

I’ve got to head out in a few minutes, but when I get some downtime in the office today, I can check out the answer to your original question.

If we’re counting the number of distinct ways we can write 20 as the sum of values on the faces of 5 dice, then the answer is 18.

Essentially this problem requires you to count integer partitions of 20 into 5 parts. That would be easy to do (using software like Mathematica, by hand using a recurrence relation, or if you’re a masochist, the generating function) if the partitions were not limited to having parts less than or equal to 6.

What we want is to count the number of solutions to

(1) a_1 + 2 * a_2 + … + 6 * a_6 = 20

with a_1, a_2, …, a_6 non-negative integers subject to the restriction

(2) a_1 + a_2 + … + a_6 = 5.

Note that if we subtract (2) from (1) we’re left with

a_2 + 2 * a_3 + … + 5 * a_6 = 15.

Therefore we want to count all partitions of 15 into parts less than or equal to 5. Set p_k (m, n) = #{partitions of m into n parts with parts <= k}. Then

p_6 (20, 5) = sum_{j=1}^5 p_5 (15, j) = 12 + 5 + 1 + 0 + 0 = 18.

You could calculate everything recursively here. I used Wolfram Alpha to list partitions of 15, and counted the relevant ones manually.

[quote]tomg wrote:
JLu wrote:
Can I ask where you came up with 19 choose 4? I have no idea where you came up with that number.

It’s similar to the number of ways you could give 20 identical coins to 5 kids so that each kid gets at least one coin.

First, you start off by just giving each kid one coin. That leaves you with 15 coins to give out.

To give out the remaining 15 coins, you could line them up like so:

OOOOOOOOOOOOOOO

and then insert 4 sticks in different spots. Here is just one example of how you could do this:

OO|OOOOO|OOO|OOO|OO

For this particular placement of the four sticks, Kid 1 would get two of the remaining coins, Kid 2 would get 5 of the remaining coins, Kid 3 would get 3, Kid 4 would get 3, and Kid 5 would get 2.

So the number of ways of distributing the remaining coins is the same as the number of arrangements of this type you could make. You’ve got 19 things in the arrangement, 15 coins and 4 sticks, so there are 19 places where either a stick or coin can be placed. Of those 19 places, you need to choose 4 places for the sticks to go make the arrangement.

I’ve got to head out in a few minutes, but when I get some downtime in the office today, I can check out the answer to your original question.
[/quote]

You’re are forgetting that each kid also cannot receive more than 6 coins, or in other words each die cannot have more than six dots.

Also, if one would continue on your path, it would be C(16,4). You only need to consider how many spaces are available to put your sticks, including the ends. You would then need to subtract out all results that allow for one die to have over 6 dots, which would itself lead to a brute force approach.

If I’m missing something here, I’d be very curious to see what it is.

[quote]tedro wrote:
You’re are forgetting that each kid also cannot receive more than 6 coins, or in other words each die cannot have more than six dots.
[/quote]

You are correct in that the C(19,4) number does not take into account the fact that each die cannot have more than six dots.

This is incorrect. I suppose you could consider the spaces that you put the sticks in, but there are more than 16. All of the sticks could be before all of the coins or after all of the coins.

This is correct, but you don’t have to brute force it if you use the Inclusion/Exclusion Principle. Hopefully, I’ll be able to finish writing it up soon.

Yeah, malonted is correct with 651.

[quote]tomg wrote:
Also, if one would continue on your path, it would be C(16,4). You only need to consider how many spaces are available to put your sticks, including the ends.

This is incorrect. I suppose you could consider the spaces that you put the sticks in, but there are more than 16. All of the sticks could be before all of the coins or after all of the coins.
[/quote]

Oops. Good catch, I forgot that you had already distributed one “coin” to each child, thus allowing you to put sticks next to each other. IMO, it would have been easier to just stick with 20 coins and not allow sticks next to each other or on the ends, ie start with 20 coins and have the prerequisite that each child gets at least one, which gives the trivial solution C(19,4).

Call me skeptical. I think I know what you are trying to do, and you will find that the inclusion/exclusion principle doesnt really apply, nor is the set with C(19,4) [I’ll denote this A from here on] cardinality particularly helpful.

You are looking for the subset of A that includes all subsets with no elements greater than 6, and do not yet know the elements of A, only its cardinality. Inclusion/exclusion cannot help you find this subset.

If you have the set of 18 unique solutions, you can define each solution as a set with elements x1,x2,x3,x4,x5; but you will have to find each set in the same manner as malonetd. You can then count the different possible sequences of each of the 18 sets (which are not derangements by the way, so inclusion/exclusion won’t help here either), and you will also have to consider that all elements of the set are not unique(with the one exception), which will ultimately lead to the same permutations/combinations that I posted.

Fact 1

The number of positive integer solutions to the equation

x1 + x2 + … + xn = r

is C(r-1,n-1).

Solution to the OP’s question:

We want The number of positive integer solutions to the equation

x1 + x2 + x3 + x4 + x5 = 20

subject to the constraints:

x1 <= 6, x2 <= 6, x3 <= 6, x4 <= 6, x5 <= 6.

The number of positive integer solutions to the unconstrained equation

x1 + x2 + x3 + x4 + x5 = 20

is C(19,4) as we’ve talked about before.

However, the C(19,4) number takes too many solutions into account so we have to subtract some of them out. We’ll start by subtracting out the number of solutions where one of the numbers is bigger than 6.

Consider the number of positive integer solutions to the equation

x1 + x2 + x3 + x4 + x5 = 20

subject to the constraint x1 > 6.

This would be exactly the same as the number of postive integer solutions to the unconstrained equation

x1 + x2 + x3 + x4 + x5 = 14

According to Fact 1, that number would be C(13,4). We need to subtract these solutions from the C(19,4) number which will give us: C(19,4) - [ C(13,4) + … ] + …

We could run through exactly the same argument where the only constraint is x2 > 6. Again, for x3 > 6. For each of the 5 = C(5,1) possibilities where we use one constraint, there are exactly C(13,4) solutions, again by Fact 1. Now we have:
C(19,4) - 5C(13,4) = C(19,4)-C(5,1)C(13,4).

Great. The only problem is that we have actually subtracted out too many solutions! If you think about it, we subtracted out the ones where x1 > 6 and x2 > 6 twice! Same thing for all of the other combinations of the five variables taken two at a time. Now we have to go back and add those back in.

Consider the number of positive integer solutions to the equation

x1 + x2 + x3 + x4 + x5 = 20

subject to the constraint x1 > 6 and x2 > 6.

This would be exactly the same as the number of positive integer solutions to the unconstrained equation

x1 + x2 + x3 + x4 + x5 = 8 which by Fact 1 is C(7,4). We can go through this argument for each 2-combination of the five variables or C(5,2). Now let’s add these solutions back in:

C(19,4) - C(5,1)C(13,4) + C(5,2)C(7,4)

There is no problem regarding have three or more of the variables bigger than 6 because three sevens already add up to 21. So the final answer is:

C(19,4) - C(5,1)C(13,4) + C(5,2)C(7,4) = 651.

I missed your earlier post with the 651 figure Tedro! That would have saved me some time. I was also wondering what kind of test this was. Anyways, what I posted above was the Inclusion/Exclusion thing I was thinking of. There is also the generating function method somebody mentioned before:

Find the coefficient of x^20 in the expanded form of (x+x^2+x^3+x^4+x^5+x^6)^5.

I suppose that you could use this method to find a formula involving the sum and the number of die.

[quote]tomg wrote:
I missed your earlier post with the 651 figure Tedro! That would have saved me some time. I was also wondering what kind of test this was. Anyways, what I posted above was the Inclusion/Exclusion thing I was thinking of. There is also the generating function method somebody mentioned before:

Find the coefficient of x^20 in the expanded form of (x+x^2+x^3+x^4+x^5+x^6)^5.

I suppose that you could use this method to find a formula involving the sum and the number of die.[/quote]

Nice work, I’ll eat my crow now. That was an interesting approach.

I too posted a link to the generating function and it does indeed work, but I figured that would have been even more cumbersome than the original method we ran through here.