Expected no. of children "at least one boy and at least one girl, with boy older than girl"

1.5k Views Asked by At

A couple decides to keep having children until

  1. Cond1: they have at least one boy and at least one girl,
  2. Cond2: with boy older than girl

and then stop. Assume they never have twins, that the “trials” are independent with probability $1/2$ of a boy, and that they are fertile enough to keep producing children indefinitely. What is the expected number of children?

Note: updated

If we consider just Cond1, answer would be Let $X$ be the number of children needed, starting with the 2nd child, to obtain one whose gender is not the same as that of the firstborn. Then $X − 1$ is Geom(1/2), so $E(X) = 2$. This does not include the firstborn, so the expected total number of children is $E(X + 1) = E(X) + 1 = 3$.

3

There are 3 best solutions below

1
On

Hint:

  • You want a boy born and then a girl
  • What is the expected number of children until the first boy is born?
  • Given that the first boy has been born, how many additional children are expected until the next girl is born?
  • Use linearity of expectation.
0
On

The two conditions essentially translate into the fact that couple are looking for following birth sequence $BG$ where event $B$ is birth of a boy and event $G$ is birth of a girl.

Till the $BG$ is achieved, lets say that the expected number of births needed are $e$.

Lets say that the expected number of births from the point when last born was a boy, i.e., event $B$ occurred is $f$.

There is $\frac{1}{2}$ probability of each event $B$ and $G$ (mutually exclusive and exhaustive events). Therefore at start,

$e = \frac{1}{2}(1 + e) + \frac{1}{2}(1 + f)$ [$\because$ first term signifies if $G$ happens with $\frac{1}{2}$ probability then from that point state is restored and expected number of births are still $e$]

At point $f$,

$f = \frac{1}{2}(1 + f) + \frac{1}{2}(1)$ [$\because$ first term signifies if $B$ happens with $\frac{1}{2}$ probability then from that point state is restored to point where expected number of births are $f$. Second term corresponds to event $G$]

Solving the two equations, $e = 4$ and $f =2$

$\therefore$ the expected no. of children “at least one boy and at least one girl, with boy older than girl” is $4$

0
On

Let the expectation value of a sequence of births whose starting sequence is S as E[S], where S is a string of B (boy) or G (girl). Under the given condition, we have

E[BG] = 2
E[B] = E[BB]/2 + E[BG]/2 = (1 + E[B])/2 + 1
E[G] = E[GB]/2 + E[GG]/2 = (1 + E[B])/2 + (1 + E[G])/2

From the 2nd eq. we got E[B] = 3, and then from 3rd eq. E[G] = 5
Therefore the expectation value is:

E(X) = E[B]/2 + E[G]/2 = 3/2 + 5/2 = 4

I wrote a small python program to validate the answer.

import random

nexp = 0  # number of experiment
sum = 0   # sum of kids, expectation value is sum / nexp
while nexp < 500000:
  nexp += 1  # new couple
  B = False  # we have a boy
  S = ''     # kids storage
  while True:      # fertility never ends until break
    g = random.randint(0,1)  # its gender
    S += 'GB'[g] # add new born

    if B and g == 0: # have a boy and new born is a girl
        break

    B |= g == 1  # at least one boy
  sum += len(S)

  if nexp % 1000 == 0:
    print("{}: {} {} {:.4f}".format(nexp, S, len(S), sum/nexp))

# output 
# ....
# 497000: GBBBG 5 4.0004
# 498000: BBBBG 5 4.0005
# 499000: BG 2 4.0004
# 500000: GBBG 4 4.0003 
# We get three digits accuracy after six digits experiments. 
# If one wants six digits accuracy, he or she will do twelve digits experiments.