[Math] Probability of number formed from dice rolls being multiple of 8

combinatoricselementary-number-theoryprobability

A fair 6-sided die is tossed 8 times. The sequence of 8 results is recorded to form an 8-digit number. For example if the tosses give {3, 5, 4, 2, 1, 1, 6, 5}, the resultant number is $35421165$. What is the probability that the number formed is a multiple of 8.

I solved this by listing all possibilities for the last 3 digits that give multiples of 8, and found this to be $\frac{1}{8}$.

The solution key agrees with my answer, but also says that "There are quicker ways to solve the problem using a more advanced knowledge of number theory"


What would be a faster way to solve this using number theory?

Best Answer

Here's a generalization:

The sample space for a six-sided die is $S = \{1,2,3,4,5,6\}$.

Theorem: There are exactly $\color{blue}{3}^n$ n-tuples $(x_{n-1}, x_{n-2}, \cdots, x_1, x_0)$ that satisfy $f(n) = 10^{n-1}x_{n-1} + 10^{n-2}x_{n-2} + \cdots + 10x_1 + x_0 \equiv 0 \mod{2^n}$ for $x_i \in S$

Proof by induction:

Base case $n=1$: We have $f(1) = x_0 \equiv 0 \mod{2}$ which is clearly satisfied by exactly $\color{blue}{3}$ 1-tuples $(2), (4)$ and $(6)$.

Inductive step: Assume true for $n$. Now for $n+1$ we have $\begin{array}{l}f(n+1) &= 10^nx_n &+ & 10^{n-1}x_{n-1} + \cdots + 10x_1 + x_0 \equiv 0 \mod{2^{n+1}} &\text{(i)}\\&\Rightarrow 0 &+ & 10^{n-1}x_{n-1} + \cdots + 10x_1 + x_0 \equiv 0 \mod{2^{n}}\\&\Rightarrow & & 10^{n-1}x_{n-1} + \cdots + 10x_1 + x_0 \equiv 0 \mod{2^{n}}& \text{(ii)}\end{array}$

But $\text{(ii)}$ has exactly $\color{blue}{3}^n$ n-tuple solutions from our inductive hypothesis.

For each such n-tuple $(x_{n-1}, x_{n-2}, \cdots, x_1, x_0)$ , there are $\color{blue}{3}$ unique $x_n \in S$ that satisfy $\text{(i)}$ per Lemma below. So, the number of (n+1)-tuple solutions $(x_n, x_{n-1}, \cdots, x_1, x_0)$ is $\color{blue}{3} \cdot \color{blue}{3}^n = \color{blue}{3}^{n+1}$ and this completes the proof by induction.

Answer:

The probability of forming an n-digit number $x_{n-1}x_{n-2}\cdots x_1x_0 = f(n)$ divisible by $2^n$ is thus $\frac{\text{count of n-digit numbers } \equiv 0 \mod{2^n}}{\text{total count of n-digit numbers}} = \frac{3^n}{6^n} = \frac{1}{2^n}$. In your case, $n=3$, giving the probability of $\frac{1}{8}$.


Lemma: $10^n x + m \equiv 0 \mod{2^{n+1}} $ has exactly $\color{blue}{3}$ unique solutions $x\in S$ given that $m \equiv 0 \mod{2^n}$.

Proof: We have $m \equiv 0 \mod{2^n} \implies m = 2^n\ell$ where $\ell \in \mathbb{Z}$.

$\begin{array}{cl} \therefore &10^n x + m &\equiv 0\mod{2^{n+1}}&\\ \iff & 10^n x + 2^n\ell &= 2^{n+1} q & (q \in \mathbb{Z})\\ \iff & 5^nx + \ell &= 2q &(\text{divide by } 2^n)\\\iff & x + \ell &\equiv 0 \mod{2} & (5^n \equiv 1 \mod{2})\end{array}$

And this has exactly $\color{blue}{3}$ unique solutions $x\in S$ since,

$\mod{2}:\begin{cases}\ell \equiv 0 \implies x + 0 \equiv 0 \implies x \equiv 0 &\implies x \in \{2, 4, 6\} \\ \ell \equiv 1 \implies x + 1 \equiv 0 \implies x \equiv 1 &\implies x \in \{1, 3, 5\}\end{cases}$

Related Question