Calculating the probability that the sum of the 2 highest values of n dice is equal to x

combinatoricsdiceprobabilityprobability distributions

I'm trying to calculate the probability of the 2 highest values of n dice sum.

In these calculations i'm currently assuming a 7-sided die that is thrown 3 times.
With raw number i've found out through some form of logic and trial and error is that the sum of 2-5 can be calculated as

$$\text{sum to 2 = }(\frac{1}{7^3})$$
$$\text{sum to 3 = }(\frac{3}{7^3})$$
$$\text{sum to 4 = }(\frac{7}{7^3})$$
$$\text{sum to 5 = }(\frac{12}{7^3})$$

If i then increase the number of throws to 4 i get that

$$\text{sum to 2 = }(\frac{1}{7^3})$$
$$\text{sum to 3 = }(\frac{4}{7^3})$$
$$\text{sum to 4 = }(\frac{15}{7^3})$$
$$\text{sum to 5 = }(\frac{32}{7^3})$$

The only reason i've been able to calculate these is because i knew what the answer was supposed to be based on a spreadsheet.

My problem is that i can't figure out the logic to how i should derive the numerator in case of n throws

Best Answer

Outline:

  1. Find the joint cdf $F(x,y)$ for the highest and second highest rolls.

  2. Use this to find the joint pmf for the highest and second highest rolls.

  3. Use the joint pmf to find the pmf for the sum of these two rolls.

Let $X$ denote the highest roll, and $Y$ denote the second highest roll.

Joint cdf for $X$ and $Y$.

Given $x\ge y$, let $F(x,y)$ be the probability that the highest roll is at most $x$, and that the second highest roll is at most $y$. There are two ways this can happen; either exactly one of the rolls is at most $x$ yet greater than $y$, and the rest are at most $y$, or all of the rolls are at most $y$. The probability is then $$ F(x,y)=\frac{n(x-y)y^{n-1}+y^{n}}{7^n} $$ If instead $x<y$, then $F(x,y)=(x/7)^n$.

Joint pmf for $X$ and $Y$.

The probability that the highest roll is exactly $x$ and the lowest roll is exactly $y$ is $$ f(x,y) = F(x,y)-F(x-1,y)-F(x,y-1)+F(x-1,y-1) $$

Pmf of $X+Y$.

To find the probability $p(s)$ that the sum of the highest two rolls is $s$, just add up the probabilities $f(x,y)$ over all pairs $(x,y)$ for which $x+y=s$. For example, $$ p(5)=f(4,1)+f(3,2) $$ $$ \hspace{3.5cm}p(8)=f(7,1)+f(6,2)+f(5,3)+f(4,4) $$ $$ p(12)= f(7,5)+f(6,6) $$

Here is this solution implemented in Mathematica. You can verify the results are correct for the values you already know.

F[x_,y_] := If[x >= y, (n(x-y)y^(n-1)+y^n)/7^n, (x/7)^n];
f[x_,y_] := F[x,y] - F[x-1,y] - F[x,y-1] + F[x-1,y-1];
P[s_]    := Sum[f[x,s-x],{x,Max[1,s-7],Min[7,s-1]}];

For[s=2, s<= 14, s++,
 Print["P(",s,") = ",Simplify[P[s], Assumptions -> n>1]]
]

Output:

P(2) = 7^(-n)
P(3) = n/7^n
P(4) = (-1 + 2^n)/7^n
P(5) = (2^(-1 + n)*n)/7^n
P(6) = -(2/7)^n + (3/7)^n
P(7) = (3^(-1 + n)*n)/7^n
P(8) = -(3/7)^n + (4/7)^n
P(9) = ((-4 + 4^n)*n)/(4*7^n)
P(10) = -(2*(4^n - 5^n) + 2^n*n)/(2*7^n)
P(11) = ((-5*3^n + 3*5^n)*n)/(15*7^n)
P(12) = (4*(-5^n + 6^n) - 4^n*n)/(4*7^n)
P(13) = ((-6*5^n + 5*6^n)*n)/(30*7^n)
P(14) = (6 - (6/7)^n*(6 + n))/6
Related Question