Due to my recent misunderstandings regarding the 'expected value' concept I decided to post this question. Although I have easily found the answer on the internet I haven't managed to fully understand it.
I understood that the formula for the expected value is:
$$E(x) = x_1p_1 +x_2*p_2 +...+x_np_n$$
The x's are the possible value that the random variable can take and the p's are the probabilites that this certain value is taken.
So, if I get a head on the first try, then $ p_1 = \frac{1}{2} , x_1 = 1 $ If I get a head on the second try, then $ p_2 = \frac{1}{4} , x_2 = 2 $
And then, I woudl have that:
$$E(x) = \frac{1}{2}1+ \frac{1}{4}2 +...$$
So my reasoning led me to an inifnite sum which I don't think I can't evaluate it that easy. In the 'standard' solution of this problem, the expected value is found in a reccurisve manner. So the case in which the head doesn't appear in the first toss is treated reccursively. I haven't understood that step.
My questions are: is my judgement correct? How about that reccursion step? Could somebody explain it to me?
Let $X$ be the number of tosses, and let $e=E(X)$. It is clear that $e$ is finite.
We might get a head on the first toss. This happens with probability $\frac{1}{2}$, and in that case $X=1$.
Or else we might get a tail on the first toss. In that case, we have used up $1$ toss, and we are "starting all over again." So in that case the expected number of additional tosses is $e$. More formally, the conditional expectation of $X$ given that the first toss is a tail is $1+e$.
It follows (Law of Total Expectation) that $$e=(1)\cdot\frac{1}{2}+(1+e)\cdot\frac{1}{2}.$$
This is a linear equation in $e$. Solve.
Remark: The "infinite series" approach gives $$E(X)=1\cdot\frac{1}{2}+2\cdot\frac{1}{2^2}+3\cdot\frac{1}{2^3}+\cdots.$$ This series, and related ones, has been summed repeatedly on MSE.