The Student Room Group

S1 Geometric Distribution Question

I'm a bit confused about how to solve the following question:
A random number generator on a computer is used to produce integers from 1 to 5, inclusive. Ahmed writes a program which will produce a sequence of these integers which ends when 5 has been obtained. The number, n, of integers in the sequence is counted and stored. This procedure is repeated 1000 times and (sigma-n) obtained. On a particular run of this program the value of (sigma-n) was 5096. Estimate the probability of the computer generating 5.

My attempt:
A ~ Geo(0.2)
n = E(A) = 1/p = 1/0.2 = 5
sigma n = 1000n = 1000 * 5 = 5000

Then I tried using '5096/5000' as the number of attempts required and calculating an average using the geometric distribution. I got 0.1991, which is very close to, but not, 0.196 (the textbook answer).

Any help would be much appreciated.
Original post by petrus123
I'm a bit confused about how to solve the following question:
A random number generator on a computer is used to produce integers from 1 to 5, inclusive. Ahmed writes a program which will produce a sequence of these integers which ends when 5 has been obtained. The number, n, of integers in the sequence is counted and stored. This procedure is repeated 1000 times and (sigma-n) obtained. On a particular run of this program the value of (sigma-n) was 5096. Estimate the probability of the computer generating 5.

My attempt:
A ~ Geo(0.2)
n = E(A) = 1/p = 1/0.2 = 5
sigma n = 1000n = 1000 * 5 = 5000

Then I tried using '5096/5000' as the number of attempts required and calculating an average using the geometric distribution. I got 0.1991, which is very close to, but not, 0.196 (the textbook answer).

Any help would be much appreciated.


Your initial method was along the right lines - you just need to use "p", rather than 0.2.

Suppose the probability of generating a 5 is p,

Then A ~ Geo(p)
E(A) = 1/p
E(Sum of 1000 n's) = 1000 x (1/p)

which equals 5096 in this case.

And solve for p.
Reply 2
Original post by ghostwalker
Your initial method was along the right lines - you just need to use "p", rather than 0.2.

Suppose the probability of generating a 5 is p,

Then A ~ Geo(p)
E(A) = 1/p
E(Sum of 1000 n's) = 1000 x (1/p)

which equals 5096 in this case.

And solve for p.


Thanks - I assumed an S1 textbook wouldn't include a question involving the randomness/pseudorandomness distinction (i.e. computers can't produce truly random integers), but that was a bad assumption.
Reply 3
Original post by ghostwalker
Your initial method was along the right lines - you just need to use "p", rather than 0.2.

Suppose the probability of generating a 5 is p,

Then A ~ Geo(p)
E(A) = 1/p
E(Sum of 1000 n's) = 1000 x (1/p)

which equals 5096 in this case.

And solve for p.


I have another question that I'm a bit stuck on.

In some families the parents to continue to have children until at least one child of each sex is born. It may be assumed that for such families, the probability of having a child of either sex is 0.5 independently of any other child. Find, for these families, the expected number of children.
Original post by petrus123
I have another question that I'm a bit stuck on.

In some families the parents to continue to have children until at least one child of each sex is born. It may be assumed that for such families, the probability of having a child of either sex is 0.5 independently of any other child. Find, for these families, the expected number of children.


Hint: There is a first child, then there are subsequent children.
Reply 5
Original post by ghostwalker
Hint: There is a first child, then there are subsequent children.


Thanks for the hint.

So the expectation would be 1/2 + 2/2 + 3/4 + 4/8 + 5/16 + 6/32 + 7/64 + 8/128 ...
= 0.5 + 1 + 0.75 + 0.5 + 0.3125 + 0.1875 + 0.109375 + 0.0625 + ...

How do I sum that? I know that the series is a convergent geometric series, but the expectation also involves the increasing integers...
Original post by petrus123
Thanks for the hint.

So the expectation would be 1/2 + 2/2 + 3/4 + 4/8 + 5/16 + 6/32 + 7/64 + 8/128 ...
= 0.5 + 1 + 0.75 + 0.5 + 0.3125 + 0.1875 + 0.109375 + 0.0625 + ...

How do I sum that? I know that the series is a convergent geometric series, but the expectation also involves the increasing integers...


Rather than look at every possibility, think about the situation in terms of a geometric distribution.

You have the first child - now forget about it, for now.

Then they will continue to have additional children until they have a child of the opposite sex. What's the distribution and expectation for the number of additional children?

Then add 1 for the first child to get the number of expected children.
Reply 7
Original post by ghostwalker
Rather than look at every possibility, think about the situation in terms of a geometric distribution.

You have the first child - now forget about it, for now.

Then they will continue to have additional children until they have a child of the opposite sex. What's the distribution and expectation for the number of additional children?

Then add 1 for the first child to get the number of expected children.


Geometric progression, with a=0.5 and r=0.5 --> geometric distribution p=0.5 --> expectation 1/0.5 = 2.

2 + 1*1 = 2 + 1 = 3.

I see :-)

Thank you!
(edited 7 years ago)

Quick Reply

Latest