<s>[INST] advanced expected value？ 

*David repeatedly flips a fair coin. Find the expected value of the total number of heads he will flip before flipping two consecutive tails.


I know that expected value is the sum of value multiplied by probability and all the probability sums up to $1$, however I find this somehow hard to approach so can anyone help me..
 [/INST] $E(X)=(1(\frac{1}{2}+\frac{1}{2^2})+2(\frac{1}{2^2}+2C_1(\frac{1}{2^3})+\frac{1}{2^4})+3(\frac{1}{2^3}+3C_1(\frac{1}{2^4})+3C_2(\frac{1}{2^5})+3C_3(\frac{1}{2^6}))+.......)\frac{1}{2^2}
$
$= (\sum_{n=1}^\infty n(\frac{1}{2^n})(nC_0(\frac{1}{2^0})+nC_1(\frac{1}{2^1})+nC_2(\frac{1}{2^2})+nC_3(\frac{1}{2^3})+.....+nC_n(\frac{1}{2^n})))\frac{1}{2^2}$
$=(\sum_{n=1}^\infty n(\frac{1}{2^n})(\frac{3}{2^n}))\frac{1}{2^2}$
$=(\sum_{n=1}^\infty n(\frac{3}{4^n}))\frac{1}{2^2}$
$=3$
</s>