# When throwing a die $3$ times, what is the probability of the product of the three results being a multiple of $9$?

When throwing a die $$3$$ times, find the probability of the product of the three results being a multiple of $$9$$.

I tried drawing a table for the possible outcomes of the first TWO dice. Then I tried considering the cases for each when the third die is rolled - as you can imagine not very efficient. Perhaps I could use $$x+y+z = 9k$$ as a divisibility test, where $$k$$ is an integer. I'm pretty sure this would involve stars and bars, but I'm not sure how to implement it in this case. Would I have to solve for $$k$$?

I also worked out the boundaries but I'm not sure if that will help either: $$9≤x+y+z≤216$$.

Do I need to use stars and bars for this question?

• The product is a multiple of $9$ if and only if at least two of the rolls are a multiple of $3$. Does that help? – diracdeltafunk Mar 7 at 4:53
• Take two of the rolls as 3 or 6, then multiply all cases of the third roll. – Righter Mar 7 at 4:55
• You can't use stars and bars as assignments using stars and bars aren't equiprobable – true blue anil Mar 7 at 5:03
• Where did you get $x + y + z$? Nothing is added in this problem. The numbers on each roll of the die are multiplied. – David K Mar 7 at 5:53
• @DavidK oh yes sorry, I was using the divisibility rule that if the sum of the digits is divisible by $9$, then the entire number is divisible by $9$. Hence $𝑥+𝑦+𝑧=9𝑘$ where $k$ is integral – user71207 Mar 7 at 6:32

I do not agree with this solution.

I obtained the result $$\frac{7}{27}$$

In fact, the probability to have a product divisible by 9 means that, among 3 die's rolls, at least 2 must be #$$3$$ or #$$6$$, thus

$$\binom{3}{2}\left(\frac{1}{3}\right)^2\cdot\frac{2}{3}+\left(\frac{1}{3}\right)^3=\frac{7}{27}$$

• Thanks, this makes it look so easy. For some reason divisibility by $9$ meaning two threes or two sixes didn't come across to me – user71207 Mar 7 at 10:13

You can solve it quickly by counting the cases when the product is not divisible by $$9$$.

• Number of all throws: $$\color{blue}{6^3}$$
• Number of throws containing neither $$3$$ nor $$6$$: $$\color{blue}{4^3}$$
• Number of throws containing exactly one $$3$$: $$\color{blue}{3\cdot 4^2}$$
• Number of throws containing exactly one $$6$$: $$\color{blue}{3\cdot 4^2}$$

Hence, the probability $$P$$ of a throw with a product divisible by $$9$$ is

$$P = \color{blue}{\frac{6^3-4^3 -3\cdot 4^2 - 3\cdot 4^2}{6^3}}= \frac{7}{27}$$

I agree with tommik's solution. Here is a simulation in R to verify.

# Number of simulations
nsims <- 1e7

roll <- function() sample(1:6, size=1)

# Generate products
products <- purrr::map_dbl(1:nsims, ~roll()*roll()*roll())

# Get proportion divisible by 9
sum((products %% 9) == 0) / nsims

0.2592488


which is about $$\frac{7}{27} = 0.259259259...$$