Given is the following question: Person x gives birth to children until two children with the same gender are born in succession. What is the expected number of children?
So, if (G= girl, B=boy):
- GG or BB, then the probability is: $2*(1/2)^2$
- BGG or GBB: $(1/2)^3$
- GBGG or BGBB: $(1/2)^4$
and so on. Hence we have:
E(X) = $2*2(1/2)^2+3*(1/2)^3+4*(1/2)^4+...$
which can be written as
(1) E(X) = $1/2*(2+3*(1/2)+4*(1/2)^2+5*(1/2)^3+...)$
or as
(2) $1/2*E(X) = 1/2*(2*(1/2)+3*(1/2)^2+4*(1/2)^3+5*(1/2)^4+...)$
what I do not understand is then the following line in the script:
(3) $1/2*E(X) = 1/2*(2+\mathbf{1/2}+(1/2)^2...)$
Is the prof subtracting (2) from (1)? If so, where is the (1/2) in bold in (3) coming from?
Yes, the professor is subtracting (2) from (1), and letting the $2$ term in (1) stand on its own (thus the $2$ term in (3)), then aligning the terms afterward. So the $\frac{1}{2}$ comes from $3 \cdot \frac{1}{2} - 2 \cdot \frac{1}{2}$. Similarly, the $\left(\frac{1}{2}\right)^2$ comes from $4 \cdot \left(\frac{1}{2}\right)^2 - 3 \cdot \left(\frac{1}{2}\right)^2$. Etc.