This might be kind of a dumb question but I'm having a troubled time of grasping something with the expected value.

I've seen many examples where in expected value problems where if you get a six sided die you sum up the multiplication of the probability and its value number, like for instance a 1 or 6 if that's the roll. Why and how do you determine that sort of value number in expectation?

For instance there are questions right now on my homework: we flip a pair of fair coins, and we flip until the the pair show the same face. If X is the number of trials (flips till the same face), what is the expected value? I know for a fact that since the only options are HH,TT,HT,TH, the summation is going to be 1/2 x A + 1/2 x B, but what is A and Band how do I give value to things like Heads or Tails?

Like these rolls of 1's and I saw some problem of seeing 0 cars as a .44 chance, but why do you multiply or even disregard (in the case of seeing 0 cars) these chances?

edit: I should add, how do I give numerical value to heads and tails or any outcome like this in general when finding out how to do these problems.

  • $\begingroup$ You have a slight misinterpretation of the question in the third paragraph: you are not trying to find the "expected pair of coin flips", but rather the expected value for: the number of coin flips until the pair show the same face. As you suspected, expected value requires a random variable which takes numerical values, although that number may depend on a non-numerical random variable. $\endgroup$ – Eric Stucky Apr 7 '15 at 7:31
  • $\begingroup$ Huh...? Isn't that the same thing because I'm trying to find the expected number of times that I need to flip to get both heads? $\endgroup$ – rezey Apr 7 '15 at 7:34
  • $\begingroup$ They aren't the same, because one random variable is a string of Hs and Ts, and the other random variable is a number. However, the rest of your comment is correct. (My comment was meant to address "how do I give value to things like Heads or Tails?".) $\endgroup$ – Eric Stucky Apr 7 '15 at 7:35
  • $\begingroup$ Oh then I mean how do I give the numeric values of those and not in strings? $\endgroup$ – rezey Apr 7 '15 at 7:42

There is a distinction you need to make between an event and a random variable. An event, very loosely speaking, is something that occurs with some probability, such as "I got two heads when I flipped the pair of coins in your example."

A random variable, however, is a number attached to an event or outcome. In your coin example, the random variable is not the event of seeing the coins land with the same face, but rather, it is the number of times you have to flip the pair of coins until you first get the same face showing on both. So if you happen to flip the coins once and on the very first try, you got heads/heads, then the value of the random variable is $1$.

Now, we can reason that the chance that you get heads/heads or tails/tails on the first pair of flips is exactly $1/2$: this is because there are four elementary outcomes for the pair of coin flips, $$\{HH, HT, TH, TT\},$$ and of these four outcomes, which each occur with equal probability, exactly two of them exhibit the event of interest--i.e., the same face is showing. Thus the probability is computed as $2$ out of $4$, or $2/4 = 1/2$. So if $X$ is the random variable that counts the number of times the pair of coins is flipped, we can express this idea as $$\Pr[X = 1] = 1/2.$$

What is the probability that it takes exactly two pairs of flips? That is to say, what is the probability that you fail to get the same face showing on the first try, and then succeed on the second? Some thought should show you that this $$\Pr[X = 2] = 1/4.$$

What about the probability in the general case; that is, what is the probability you will be successful on exactly the $n^{\rm th}$ try?

Now, the expected value of $X$ is simply the weighted sum of all of the possible values of $X$, where the weight corresponds to the probability of each value. That is to say, $$\operatorname{E}[X] = \sum_{x = 1}^\infty x \Pr[X = x].$$ Note here that I let $X$ take on the integer values $1, 2, 3, \ldots$, because it is not possible to observe $X = 0$ or $X = 1.2355$ or $X = -10$; the support of $X$ is precisely $X \in \{1, 2, 3, \ldots\}$, the set of positive integers. The expectation is a sum (or integral) of a random variable over its support--the set of all values that $X$ can attain.

We can get the expected value of $X$ in your coin flip example using a technique called "conditioning." Suppose that $\operatorname{E}[X] = \mu$. This value represents in some sense the "average" number of pairs of coin flips needed to observe the event of interest.

Now, this "average" is contingent on two possible outcomes of the first pair of flips: either the first pair is successful, or it is not. If it is successful with probability $1/2$, the number of tries is $1$, which we already discussed above; hence the "average" number of tries in this case is also $1$. But if we are not successful on the first try, then the state of affairs is now that we have $1$ failed attempt, and the average number of additional attempts is no different than the average number we would need from the outset. This is because the coins don't remember what they did before. So if you failed before, the coins don't know--their future random behavior is unaffected by past outcomes. So you could argue that $$\mu = 1 \cdot \frac{1}{2} + (1 + \mu) \cdot \frac{1}{2}.$$ The first term is the expected number of attempts (one) if successful on the first try, times the probability of success on the first try; plus the expected number of attempts (one plus the average number of additional attempts) if unsuccessful on the first try, times the probability of being unsuccessful on the first try. Then solving this equation gives $\mu = 2$.

Formally, the above equation is a case of applying the law of total expectation: $$\operatorname{E}[X] = \operatorname{E}[X \mid S]\Pr[S] + \operatorname{E}[X \mid \bar S]\Pr[\bar S],$$ where $S$ is the event of being successful on the first try, and $\bar S$ is the complementary event of being unsuccessful on the first try. The key insight is to recognize that $\operatorname{E}[X \mid S] = 1$ (if successful at the outset, you only needed one try), and $\operatorname{E}[X \mid \bar S] = 1 + \operatorname{E}[X]$ (if unsuccessful at the outset, you are back at square one but you've got that additional failure to count).

  • $\begingroup$ Ooh, so in further cases like 3 it would be 1/8, 4 would be 1/16... But then without using calculus (this is for a discrete mathematics course for comp. sci majors) how would I formulate the sum to n? $\endgroup$ – rezey Apr 7 '15 at 8:02
  • $\begingroup$ @Rezey Now that you can see that $$\Pr[X = n] = \frac{1}{2^n},$$ then the expected value of $X$ is $$\operatorname{E}[X] = \sum_{n=1}^\infty \frac{n}{2^n}.$$ There are many ways to evaluate this sum algebraically; however, there is a probability-based argument that I will furnish shortly in an update to my answer. $\endgroup$ – heropup Apr 7 '15 at 8:14
  • $\begingroup$ So for every case where I need to use conditioning, I can just use something in the retrospect of (a = 1 * prob + (1+a) *prob) because this entails both the complement and success of the expected value? $\endgroup$ – rezey Apr 7 '15 at 9:01
  • $\begingroup$ No; conditioning on another event (in this case, the first pair of tosses) is a technique that can be broadly applied, but a critical component of the solution is that we exploited a property called memorylessness. This property exists only for two parametric distributions; the geometric distribution (this case), and the exponential distribution. That's what allowed us to write $\operatorname{E}[X \mid \bar S] = 1 + \operatorname{E}[X]$. Other kinds of problems may possess different relationships between the conditional and unconditional expectations. $\endgroup$ – heropup Apr 7 '15 at 9:23

It's a similar concept to limit points from topology that don't belong to $X$. For example a limit point of $1/n$ is $0$, but $0\notin(0,1]$. If we had an equal number of red and blue cars, the expected value is neither a red or blue car, but then again we can't pick anything else but red or blue cars.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.