1. Expected family size

An event has probability p of success and q(=1-p) of failure. Independent trials are carried out until at least one success and one failure has occurred. Find the probability that r trials are necessary $(r\geq2)$ and show that this probability equals $(\frac{1}{2})^{r-1}$ when $p=\frac{1}{2}$.
A couple decide that they will continue to have children until they have both a boy and girl or they have four children. Assuming boys and girls are equally likely to be born, what will be the expected size of the completed family.

$P(p)=p+pq+pq^2+pq^3+...+pq^{r-1}$
$P(q)=q+qp+qp^2+qp^3+...+qp^{r-1}$
Sum of the general term = $P(p)+P(q)=pq(p^{r-2}+q^{r-2})$
when $p=\frac{1}{2} \rightarrow q=\frac{1}{2}$
$\frac{1}{4}[(\frac{1}{2})^{r-2}+(\frac{1}{2})^{r-2}]$
$=(\frac{1}{2})^r+(\frac{1}{2})^r$
$=2(\frac{1}{2})^r$
$=(\frac{1}{2})^{r-1}$
So I have gotten these parts right, but about the last part, how do I do it?
Because I suppose I use $(\frac{1}{2})^{r-1}$ to find the probability of having a boy and girl after r trials. So I find the value when r is 2, 3, and 4? and then each of those multiply by the number of children?
Thanks

2. There are only three possibilities.
Define the random variable X=number of children.

$P(X=2)=P(\{{\rm boy, girl\} \quad or \quad\{ girl,boy}\})=2pq$

Next obtain $P(X=3)$ and $P(X=4)$.

3. Originally Posted by matheagle
There are only three possibilities.
Define the random variable X=number of children.

$P(X=2)=P(\{{\rm boy, girl\} \quad or \quad\{ girl,boy}\})=2pq$

Next obtain $P(X=3)$ and $P(X=4)$.
X? so X is the number of children or in other words r in $(\frac{1}{2})^{r-1}$?
thanks