Expectation and children What is the expected number of children if the probability of having a child(boy or girl) = 1/2 and if you want a boy and a girl?
E(No of children) = ?
 A: Whatever sex the first-born kid is, our waiting time after that until a child of the opposite sex is born is $\frac{1}{1/2}=2$. So the expected number of children is $3$.
For more detail, we can assume without loss of generality that the first-born is a boy. Let $y$ be the expected additional number of children  until a girl is born.
The second child is a girl with probability $\frac{1}{2}$. In that case the additional number of children  was $1$. And with probability $\frac{1}{2}$, the second child is a boy, in which case the expected number of additional children is $1+y$. Thus
$$y=\frac{1}{1}+\frac{1}{2}(1+y).$$
Solve for $y$. We get $y=2$, so the expected total number of children is $1+2$. 
Or else we can do the problem the hard way. Let $X$ be the total number of children. Then $X=2$ with probability $\frac{1}{2}$, $3$ with probability $\frac{1}{2^2}$, $4$ with probability $\frac{1}{2^3}$, and so on. Thus
$$E(X)=2\cdot\frac{1}{2}+3\cdot\frac{1}{2^2}+4\cdot\frac{1}{2^3}+\cdots.$$
We leave it at that. The infinite sum turns out to be $3$, but a summation of series argument for that is quite a bit longer than the first way we solved the problem. 
Solve for $y$. We get $y=2$.  
A: We need at least one child. When we know the gender of this child, we keep having children until we get one of the opposite gender. There is a $1/2$ chance the first extra kid is the one we need, a $1/4$ chance it's the second, and so on.
Hence we need $1+1/2+2/4+3/8+4/16+\cdots=3$ children.
