<s>[INST] 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) = ?
 [/INST] 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$.  
</s>