How does one calculate the expected value? Suppose a fair coin is flipped twice. Define two random variables $X$ and $Y$ , where $X$ counts the number of heads, and $Y$ counts the number of tails, in the two flips.


*

*Evaluate $\Bbb E(X), \Bbb E(Y)$. 

*From these values, can you decide whether $X$ and $Y$ are dependent or independent?

 A: These expected values will be the same if the coin is fair and the two flips are independent. For example X=2 for HH only, X=1 for HT and TH, and X=0 for TT only. That gives 2*(1/4)+1*(1/2)+0*(1/4)=1 for E(X). If you do it, E(Y) also comes out 1. 
But from these alone one cannot conclude whether X,Y are independent, and they are not, since given X=2 it must be that Y=0.
A: $$E(X) = E(Y) = 1$$
You cannot say $$E(XY) = E(X)E(Y)$$ implies independence. You need to check the conditional probabilities to be sure.
A: The expected value of X is 1, because the theoretical probability of X is 1/2, and vice versa for Y. 
As for deciding whether X and Y are independent or not, they are independent because the expected value of X is 1/2 and the expected value of Y is 1/2 and there is no overlap in probability and getting heads or tails does not affect the later outcome.
A: So our sample space is 
S={HH, HT, TH, TT}, where H=Heads and T=Tails.  
The probabilities of X being 0, 1 and 2 are:
P(X=0)=1/4 ; P(X=1)=2/4 ; P(X=2)=1/4
Similarly we have Y as:
P(Y=0)=1/4 ; P(Y=1)=2/4 ; P(Y=2)=1/4
The expected value of the probability X is:
$$E(X)=\sum_{i=0}^3 xP(X=x) = 0(1/4) + 1(2/4) + 2(1/4) = 1$$
And the same goes for E(Y)=1.
Lastly, we can conclude that X and Y are in fact dependant. Because if, say, X=1 we know for a fact that Y must be 1, etc.
