# Geometric distribution in a dice case

Say, for a particular case (e.g. getting out of jail in the Monopoly game) our success is two dice showing the same number i.e. (1,1), (2,2) etc. So, there are 6 cases out of 36 possible outcomes. Thus, the probability of success is 1/6 and that of failure is 5/6.

I am trying to understand the geometric distribution in such an example. Will, the count of trials until success, become data points for the geometric distribution? And after every success, do you start counting from 1 again?

Is this the right understanding of the geometric distribution?

• Yes, you are right. But need to pay attention that there are two definitions: The final trial with success is counted or not. For example, after 2 failures, the 3rd trial is success. If count success, X=3, if not, X=2. Both definitions are popular. So when deal with geometric distribution, to make sure which definition is used. Jul 27, 2019 at 15:52

if $$X$$ counts the trial (roll) on which you finally get a Success, the expected number of trials required is $$E(X) = 1/p = \frac{1}{1/6} = 6.$$ See Wikipedia for both of the definitions mentioned by @user158565. The first definition there is the one I used just now.

Usually, an analytic proof for $$E(X)$$ uses moment generating functions or some sort of 'trick' using differentiation. (The Wikipedia article linked above shows such an analytic proof of the expectation for the second definition.)

However, using R as a calculator for your example, I can sum the first one thousand terms is the infinite series for $$E(X) = p + 2qp + 3q^2p + 4q^3p + \dots = \frac 1p,$$ where $$p = 1/6, q = 1-p = 5/6.$$ The remaining terms (beyond $$x = 1000)$$ are so small that the difference between the finite sum and the infinite sum is negligible. (Summing the first 100 terms is not quite good enough.)

p = 1/6;  q = 1-p
x = 1:1000;  PDF = q^(x-1)*p
sum(x*PDF)
 6
sum(PDF)
 1


R statistical software uses the second definition, where $$Y$$ is the number of failures before the first success. So in the following simulation to demonstrate $$E(X),$$ I use $$E(Y+1) = E(X).$$

I use a million iterations (to get out of jail a million times) in the simulation, so we can expect about 2-place accuracy.

set.seed(727)  # for reproducibility
mean(rgeom(10^6, 1/6)+1)
 5.992297  # aprx $$E(X) = 6.$$