Expected values of squares Question A fair coin is tossed three times. Let Y be the random variable that denotes the square of the number of heads. For example, in the outcome HTH, there are two heads and Y = 4. What is E[Y]?
My answer: 
possible outcomes to toss a coin three times : 0, 1, 2, 3
possible outcomes of Y : 0, 1, 4, 9
E[Y] = (1/6 * 0) + (1/6 * 1) + (1/6 * 4) + (1/6 * 9)
Is it ok? Thanks! 

In general for $n$ tosses
$$
 \mathbf{E} = \sum_{i=0}^n{n \choose i}\left(\frac1{2}\right)^{\!\!n} i^2
$$
