Skip to main content
5 of 5
Commonmark migration

Analysis

Let's answer all the questions at once by supposing you are independently throwing an $m$-sided die (call it $X$) and an $n$-sided die (call it $Y$), where each die has faces numbered 1, 2, 3, etc. and all faces have equal probabilities of occurring.

The independence assumption means that any particular outcome where the first die shows the value $i$ (between $1$ and $m$) and the second die shows the value $j$ (between $1$ and $n$) is $1/(nm).$

The Law of Total Probability says you can break down the event "$Y$ is greater than $X$" into separate events corresponding to the value shown by $X$ and sum the probabilities of each separate event. Here goes:

  1. $X$ shows a 1. For $Y$ to exceed $X,$ it must therefore show a 2, 3, etc, up to $n.$ There are $n-1$ ways in which this can happen, each of which with probability $1/(nm),$ so the chance is $(n-1)/(nm).$

  2. $X$ shows a 2. For $Y$ to exceed $X,$ it must therefore show a 3, 4, etc, up to $n.$ There are $n-2$ ways in which this can happen, each of which with probability $1/(nm),$ so the chance is $(n-2)/(nm).$

  3. The pattern potentially continues up to the case where $X$ shows the value $n,$ in which case there's no way $Y$ can exceed $X.$

  4. Obviously we need to stop with the case $X=m,$ because it cannot result in any larger number. The probability that $Y$ exceeds $X$ in this case is $(n-m)/(nm).$


Solution

Summing all these possibilities and assuming $n \ge m$ (as in the question) gives

When $n \ge m,$ $$\eqalign{\Pr(Y \gt X) &= \frac{n-1}{nm} + \frac{n-2}{nm} + \cdots + \frac{n-m}{nm} \\&= \frac{n(n-1) - (n-m)(n-m-1)}{2} \times \frac{1}{nm}.}$$

The left hand factor counts the number of outcomes where $Y$ exceeds $X$ while the right hand factor of $1/(nm)$ converts that to a probability. (The count can be simplified to $m(2n-m-1)$ for computational purposes, but that simpler formula obscures the idea that led to the answer.)

In case $m$ is the larger number, the sum stops with $n-m=0$ giving a simpler value:

When $n \lt m,$ $$\Pr(Y \gt X) = \frac{n(n-1)}{2} \times \frac{1}{nm}.$$


Illustration

For example, the $4(2(6)-4-1)/2 = 14$ possible ways in which a d6 can exceed a d4 are

d4 (X): 1 1 1 1 1 | 2 2 2 2 | 3 3 3 | 4 4 
d6 (Y): 2 3 4 5 6 | 3 4 5 6 | 4 5 6 | 5 6

and indeed the count is $5+4+3+2 = 14.$ The chance therefore is $14/(4\times 6)= 7/12.$ Similarly, the answers in the other two cases are $27/48$ (d8 vs d6) and $44/80=11/20$ (d10 vs d8).

If you're interested in the chance that a d4 will exceed a d6 (an example of where $n$ is less than $m,$ here are the possibilities:

d6 (X): 1 1 1 | 2 2 | 3
d4 (Y): 2 3 4 | 3 4 | 4

and indeed the count is $3+2+1 = 6 = 4(4-1)/2.$


Comments

Notice that $14/24$ and $6/24$ do not sum to $1,$ because there's a third possibility of a tie. Evidently there are four ways a tie can occur in the case, giving a chance of $4/(4\times6).$ The chances to add to $1$: $14/24 + 6/24 + 4/24 = 24/24=1,$ as they ought. This is a helpful check of the formulas and the arithmetic.


Brute force calculation

Finally, since you have a good SO reputation, you must have an aptitude for programming. With smallish values of $m$ and $n$ you can just generate all the possibilities and count them up. Here's an R implementation to illustrate:

f <- function(m, n) nrow(subset(expand.grid(Y=1:n, X=1:m), Y > X))

This does not do the division by $nm$ so that you can obtain the count of possibilities directly. Examples:

> f(4,6)
[1] 14

> f(6,8)
[1] 27

> f(8,10)
[1] 44

> f(6,4)
[1] 6
whuber
  • 333.5k
  • 63
  • 792
  • 1.3k