# Expected value of X and Y for a given problem

A couple decides to have children until they get a girl, but they agree to stop with a maximum of 5 children even if they haven't gotten a girl. If X and Y denote the number of children and number of girls, respectively, then what are E(X) and E(Y)?

What I have tried, though it is incorrect:

If X denotes the number of children. Then

f(1) = P(X = 1) = P(girl at first try) = $\frac{1}{2}$,

f(2) = P(X = 2) = P(1 boy and 1 girl) = $\frac{1}{2}\frac{1}{2}$ = $\frac{1}{4}$,

f(3) = P(X = 3) = P(2 boys and 1 girl) = $\frac{1}{4}\frac{1}{2}$ = $\frac{1}{8}$,

f(4) = P(X = 4) = P(3 boys and 1 girl) = $\frac{1}{8}\frac{1}{2}$ = $\frac{1}{16}$,

f(5) = P(X = 5) = P(4 boys and 1 girl) + P(no girl in 5 tries) = $\frac{1}{32}\frac{1}{32}$ = $\frac{1}{16}$

Then \begin{align} \begin{split} E(X) = \sum_{x= 1}^{5} x\;f(x)=f(1) + 2 f(2) + 3 f(3) + 4f(4) + 5f(5)\\ &= \frac{1}{2} + \frac{2}{4} + \frac{3}{8} + \frac{4}{16} + \frac{5}{16}\\ \approx 1.9375 \end{split} \end{align}

• Why do you say that is incorrect? It looks fine as far as I can see. Have voted to reopen. May 25 '16 at 1:38
• @David Because I got the question from a book that says $E(X) = \frac{7}{4}$ and $E(Y) = \frac{7}{8}$ though the author did not explain why is that the answer. May 25 '16 at 2:19
• I don't agree with the book, I think your answer is correct. Perhaps you should check with the book to make absolutely sure you read the question correctly. May 25 '16 at 2:27

They will have either 1 or 0 girls. Let $y$ be the probability that a child is a girl, then $E(Y) = 1-(1-y)^5$.
$E(X) = 5 (1-y)^4 + 4 (1-y)^3y + 3 (1-y)^2y + 2 (1-y)y + y$
• Do you mean y = 1/2 and $E(Y) \approx 0.9688$? May 24 '16 at 22:50