# Coin flip deal (stats/probability)

1. Jan 29, 2015

### bowlbase

1. The problem statement, all variables and given/known data
Coin flip problem. I'm given the probability distribution of how many times a coin is heads out of 5 flips. From this, I need to determine if the following deal is worth it and, if not, how much it costs using variance:

After flipping the coin 20 times I need to pay my friend the square of the total number of heads results. But, no matter what, they have to pay me $15. 2. Relevant equations 3. The attempt at a solution I got the expectation value from the distribution to be exactly 2. Meaning, out of 5 flips two results can be expected to be heads. This means I have a 2/5 probability of heads (40%). Out of 20 flips this means 8 are likely to be heads and since 64>15 this is a terrible deal. So immediately I know he'll have to pay around$49 dollars to his friend.

My issue is with variance. The problem hints that the variance of any variable is the E(X2)-E(X)2 and that I already have a simple formula for variance of the probability distribution. I calculated the variance of the expectation using the above equation and got 3.2. But I really don't know what to do with this or what other variance he is speaking about. Can anyone point me in the right direction?

2. Jan 30, 2015

### Orodruin

Staff Emeritus
Please state the problem exactly as it was given to you, including the data you were given.

The expectation value of a distribution is a number and not a stochastic variable. As such its variance will be zero. Did you intend to say that you calculated the variance of the distribution?

Hint: How would you express the expectation value of money lost in terms of your stochastic variable X (i.e., the number of heads)?

3. Jan 30, 2015

### Stephen Tashi

You'll get a clearer idea of concepts if you are careful with your language. It isn't "likely" that exactly 8 of the 20 flips will be heads. You mean "the expected" number of heads is 8. In many situations the probability of "the expected number" actually happening is quite small.

You've assumed that because "the expected number of heads" is 8 that "the expected number of (heads squared) " must be 8 squared. That isn't true, in general.

In general,
(the expected value of x^2) $\ne$ (the expected value of x)^2

( Look at the distribution you were given for 5 flips and see if the expected number of (heads squared) is 4.)

You can see from that formula that if E(X^2) = (E(X))^2 then the variance would be zero. The "random" variable would need to have a constant outcome.

Your were directed to consider the variance in order to help figure out the expected number of (heads^2).

Have you studied a formula for the variance of the sum of independent random variables? The 20 tosses can be regarded as a sum of 4 groups of 5 tosses each.

4. Jan 30, 2015

### bowlbase

(I couldnt get a latex table to work on here for some reason)
X:-------- 0---------1---------2---------3---------4--------5
Pr(X): 0.07776 | 0.2592 | 0.3456 | 0.2304 | 0.0768 | 0.01024

X is the number of times heads appears in 5 rolls. From this I used the summation $∑_{i=0}^5 i(Pr(x))$ and this gave me an expectation of 2. So, it is expected that 2 of the 5 flips will end in heads.

This much is clear. But when it comes to the next part I simply don't understand how/why it needs to be so complicated. I expect 2/5 to be heads so I expect to pay 64-15=$49. I say this only because I don't understand and want a deeper explanation of the purpose of it. This isn't a stats course homework but rather a class that, apparently, expected that I know all of this already. Yes, this is what I meant. Given the above table I used Var=E(X2)-E(X)2 and got a distribution variance of 3.2. This might be the wrong way because the Hint says that "The variance of any random variable X is =E(X2)-E(X)2 and also we know a simple formula for the variance of a distribution." I'm not sure what formula this is suggesting but I wonder if it is from the Binomial distribution where Var(X)=Kp(1-p). Where Kp is suppose to be the Expectation p is the probability of heads. This would give variance of 1.2 for 2/5 or 4.8 for 8/20. I understand that E(X^2) = (E(X))^2 isn't true here. But I'm stuck on why this matters. If I expect 8 heads then I should expect to pay 82. My understanding of statistics fails here, clearly. Your last question seems like exactly what I did at the beginning to get the variance of the 5 tosses. If I was suppose to get the expectation squared of that distribution (4) or (16/20) I'd end up with a variance of 8. Meaning, I suppose, that he'd pay anywhere from nothing (gets$15) to \$(256-15). But I can't imagine this is right. This variance seems super high to me.

Thanks for the help.

5. Jan 30, 2015

### Stephen Tashi

Yes, last time I tried them, latex tables didn't work on the forum. You can try matrices.

Let Y = X^2 and use the corresponding table:

Y:-------- 0---------1---------4---------9---------16-------25
Pr(Y): 0.07776 | 0.2592 | 0.3456 | 0.2304 | 0.0768 | 0.01024

Find the expected value of Y

6. Jan 30, 2015

### bowlbase

For some reason I said 3.2 before, I think. But it is E(Y)=5.2. The variance was 3.2. Not sure if that was clear before.

7. Jan 30, 2015

### Ray Vickson

You are misleading yourself (or being mislead) by use of the word "expectation". In probability it does not mean the same thing that it means in ordinary conversation; it is a technical term, and you should avoid ascribing too much "ordinary" meaning to it.

You ask "why this matters here". It matters because you would NOT "expect to" pay $8^2 = 64$ when you "expect to" get 8 heads; that is not how expectation works in probability. As I said already, you must guard against a too literal interpretation of the word "expect".

You can just look at your data for n = 5 to see that the expected value of $X^2$ is NOT the square of the expected value of $X$. Your data give
$$E(X^2) = \sum_{x=0}^5 x^2 p(x) = 5.20, \;\; (EX)^2 = 2^2 = 4$$

We ALWAYS have $E(X^2) > (EX)^2$ unless $X$ is a constant, non-random quantity. Sometimes the difference is relatively minor, but in other cases in can be huge.

8. Jan 30, 2015

### Stephen Tashi

So E(Y) = 5.2 is the expected amount you pay for (heads)^2. It isn't equal to (expected number of heads)^2 = (2)^2 = 4.

The variance of the 5 toss distribution is E(X^2) - (E(X))^2 = E(Y) - (E(X))^2 = 5.2 - 4.

The 20 tosses T can be represented as T = X1 + X2 + X3 + X4 ,where the X's are each a result of doing 5 tosses.

Find the variance of T from the fact you know the variance of each of the X's.

-------------------------

Suppose we have a random variable X and another random variable Y that is a function of X, Y = F(X). Then, in general, the expected value of Y is not equal to F evaluated at the expected value of X. An important exception to this case is when F is a linear function of X like F(X) = 3X + 5. In the linear case E( F(X)) = F(E(X)).

In your problem, the cost Y is not a linear function of the number of heads. So, unless you can show otherwise, you should assume the expected value of the cost will require some effort to compute. As to why things should be so complicated, that's a philosophical question. It's just the way they are.

Computing with mathematical expected values is more complicated than thinking in terms of "the typical case". If you think of 8 heads as the "the typical number of heads", you will think of 64 as "the typical cost". But this kind of thinking doesn't work if you want to compute the "expected cost" in the sense of the average cost.

9. Jan 31, 2015

### bowlbase

I honestly don't know what to do with this. I get that I know the variance of each Xn (1.2). But I don't know the total number of heads for each. I the expected value is 2, I think, but this just brings me in a giant circle. Somehow I need to get E(T) without know any X values... I feel like this is exactly the same table as before just done 4 times. The variance would be exactly the same. Or is T the sum of variances (4.8)?

I'm not getting this at all.

10. Jan 31, 2015

### Stephen Tashi

Have you studied sums of random variables? ( It seems like you have missed an important lecture.)

T = X1 + X2 + X3 + X4 is an equation involving random variables, not ordinary variables. Random variables don't have specific values. They do have specific expectations and variances. The expectation of a sum is the sum of the expectations E(T) = E(X1) + E(X2) + E(X3) + E(X4) Each the Xi is random number of heads in 5 tosses of the coin. So each Xi has expectaion 2.

The variance of a sum of independent random variables is the sum of the variances.

Var(T) = Var(X1) + Var(X2) + Var(X3) + Var(X4)

11. Jan 31, 2015

### haruspex

The expected value of X2 means its average value (what you will pay out on average here). That means it's the sum $\Sigma x^2 P[X=x]$, usually written E(X2). What equation relates that to the variance?

12. Jan 31, 2015

### bowlbase

I promise I haven't missed a lecture (there was only 1 on this), we just didn't discuss anything in great detail as, apparently, it was expected that I have some background in this.

It makes sense to me that the V(T) is the sum of the variances for each Xn and, likewise, it makes sense that E(T) is the sum of E(Xn). So, I should be able to say, I think, that $V(T)=4.8=E(T^2)-E(T)^2$ Where $E(T)^2=64$. Meaning that $E(T^2)=59.2$ And this is the expected payout. Have I got it now?

13. Jan 31, 2015

### Stephen Tashi

That explains the situation. The problem looks like the kind that would be given to students after they'd studied random variables, sums of random variables, and expectations and variances of sums. (There are also important results concerning the expectation of products of random variables.)

Yes

From the above equation E(T^2) = E(T)^2 + 4.8 instead of -4.8.

14. Jan 31, 2015

### Ray Vickson

Not quite: $4.8+64 \neq 59.2$.

15. Jan 31, 2015

### bowlbase

Oh geez, I dunno why I did that. I got it, now. I'm going to think on this a bit and come back if I have any other questions. This is going to take some amount of googling to figure out.

Thanks for the help, everyone!