What is the expected number of children until having at least a girl and a boy? Source: (Harvard Statistics 110: see #17, p. 29 of  pdf).

A couple decides to keep having children until they have at least one boy and at least one 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?
Solution: 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.$

My argument: Because of symmetry and for concreteness, we can assume that the firstborn is a girl. Let $X$ be the number of girls before the first boy. Then, $X$ is Geom (1/2). So, the expected total number of children is $E(X)+1=(1-p)/p +1= (1-0.5)/0.5+1=2.$ QED.
Why would mine be incorrect?
 A: See here: https://en.wikipedia.org/wiki/Geometric_distribution. There are two parametrization of the geometric distribution:


*

*You compute the number of trials before success, here the mean is $1/p$;

*You compute the number of failures before success, here the mean is $(1-p)/p$.
In the first case, you have $P(X = 0) = 0$ and in the second case $P(X = 0) = 1/2$. All this to say you simply use the wrong formula for the mean.
Once you have set the gender of the first child, you then look for the number of trials you need to get the other, letting that be $X$. Hence you should have $E(X) + 1 = (1/.5) + 1 = 3$.
A: The problem is actually formulated as a negative binomial distribution with $r=1$ and $p=1/2$: number of successes with probability $p$ before $r$ failures. In this case you say that a success is a child of the same gender as the first one. The trick in applying neg binomial is related to the mistake you made in the solution: adding the first child. You do not have a definition of a success until you get the first child.
So, the solution is set up as follows. We get the first child, note the gender G. Then we start the negative binomial experiment cranking up children until a child of an opposite gender "not G" arrives, a failure.
This way the solution is: 1 (first child of gender G) + mean number of children of the gender G + 1 (first child of opposite gender "not G"). 
The mean of negative binomial is $\frac p {1-p}$, hence the solution:
$$1+\frac p {1-p}+1=\frac {2-p} {1-p}=3$$
