I am having a hard time getting comfortable with random variables and expected values.
Here is the question:
I flip two fair and indepedent coins. If the first coin comes up tails you loose $\$1$ (ie. you win $-\$1$). If the second coin comes up heads you win $\$2$.
For example: First coin comes up tails and second coin comes up heads your total winning is $\$1$ ($-\$1$ + $\$2$ = $\$1$)
Define the random variable X to be the amount of dollars that you win. What is the expected value of X?
Here is what I think:
Possibilities:
- $\{T,T\}=-\$1$
- $\{T,H\}=\$1$
- $\{H,T\}=\$0$
- $\{H,H\}=\$2$
So I'll define $X$ as $X= amount\ won$
The probability of each winning amount is $\frac1 4$. So my expected value is calculated as:
$E(X) = -1 * \frac1 4 + 1*\frac1 4+0*\frac1 4+2*\frac1 4=\frac1 2$
Am I doing this correctly or is there a better way? Also what would happen in the case of if I flipped a fair coin n times, and after n times I stop with the same rules what would be the expected value?
Your computation is correct. An easier way might be to compute the expected winning of each flip separately, and then add them.
First flip: $(-1) \cdot (1/2) + 0 \cdot (1/2) = -1/2$.
Second flip: $2 \cdot (1/2) + 0 \cdot (1/2) = 1$.
Total: $-1/2+1=1/2$.
Regarding generalizing to $n$ flips, it is not clear how you want to generalize, so you should be more specific.