Solving the Expected Value I have a word problem,
A game is played where a fair coin is tossed until the first tail occurs. The probability  tosses will x tosses will be needed is $ f(x) = 0.5^x;x=1,2,3,4,5$. You win $2^x$ dollars if x tosses are needed for x=1,2,3,4,5 but lose $256 if x > 5. Determine the expected winnings.
I started the question off like so,
let Z be the number of wins (1 <= x <= 5)
let Y be the number of losses (x > 5)
$E(Z) = \displaystyle\sum\limits_{x=1}^5 x * 0.5^x$
I am wondering my expected value function is setup correctly. 
 A: Let the winnings given $x$ tosses be $w(x)$
$$w(x)=\begin{cases}
2^x & x\leq 5\\
-256 & x>5
\end{cases}
$$
Let $W$ be the winnings pr game. This can now be calculated as
$$E(W)=\sum_{n=1}^{\infty} w(x)0.5^x=-3$$
Does this answer your question?
A: Let $X$ be the number of tosses until the first head. Let $W$ be the amount of money that we "win."
If $X=1$ (probability $0.5$) we win $2^1$. So $W=2^1$. 
If $X=2$ (probability $(0.5)^2$) we win $2^2$. So $W=2^2$. 
If $X=3$ (probability $(0.5)^3$) we win $2^3$. If $X=4$ (probability $(0.5)^4$) we win $2^4$. If $X=5$ (probability $(0.5)^5$) we win $2^5$.
If $X\gt 5$ (probability $(0.5)^5$, five tails in a row), we "win" $-256$. So $W=-256$. 
Now calculate $E(W)$. The first five terms each give a contribution of $1$, and the last term gives a contribution of $(-256)(0.5)^5=-8$. Add up.
A: I'm afraid not, though you've started out okay. Let's define your value function $v(x)$ to be the number of dollars you receive if the first tail occurs on the $x$th toss. Then given the information, we have $$v(x)=\begin{cases}2^x & \text{if }x=1,2,3,4,5\\-256 & \text{if }x=6,7,8,9,....\end{cases}$$ Your expected value, then, is given by $$E=\sum_{x=1}^\infty v(x)\cdot f(x)=\sum_{x=1}^52^x\cdot(0.5)^x-\sum_{x=6}^\infty 256\cdot(0.5)^x.$$ Can you take it from there, perhaps using the fact that $256=2^8$?
