# How does expected value work with multiple probabilities?

I'm familiar with how expected value works normally (EV = probability * value of event) but I'm not sure how to handle a situation with multiple probabilities.

As a simple example, let's say that I'm trying to calculate how much time I will take to park a car. I can either park at the end of the road, which takes only 1 minute or I can park in a big parking garage but that will take me at least 10 minutes of driving around in circles and riding the elevator.

Due to the time of day, there's an 80% chance that I'll snag a spot at the end of the road. The parking garage is huge so there's a 100% chance of getting a spot there.

How would this work?

Feel free to ask for additional information.

-
It depends on what your strategy is. Your strategy might be to try for the end of the road with probability $p$, and (if you don't find a space) settle for the parking garage with probability $1-p$. – André Nicolas May 21 '12 at 5:18

Andre's answer is correct if it takes you exactly 10 minutes to get from the end of the road to the parking space in the lot and you flip a coin to decide which way to go. But you said it takes at least ten minutes. If the is a continuous distribution starting at 10 minutes then it would change. Also from the way you worded the problem i think you will automatically try the end of the road first and then move on to the parking lot if a space is not available (which you said happens with probability 0.2). The answer to this problem is 1+(0.2)∫xf(x)dx where f is the density of times to go from the end of the road to the parking space in the lot. The limits of integration are 10 to ∞. In practical terms there is probably a time T > 10 at which a parking spaced would have been found no matter how much circling you had to do. So f is 0 beyond T and you could make the upper limit T. Note that the result depends on what you select for the density f. This is the additional information needed that Robert referred to.

-
Your guess that I'd try the end of the road first is probably right. :) – Zian Choy Jun 2 '12 at 18:46

I assume you mean that you take the spot at the end of the road if it is available, and checking whether this is available takes no time; if this spot is not available, you go to the parking garage. So if $X$ is the time you take, $X=1$ with probability $0.8$ and $X=10$ with probability $0.2$ (you did say "at least $10$", but we don't know how much more than $10$, so without further information this might be a reasonable assumption).

-

Let us assume that you flip a possibly unfair coin that has probability $p$ of landing heads. If it does, you try first for the end of the road, and if that fails, you head for the parking garage. If it lands tails, you head directly for the parking garage.

Let us assume also that the time cost of trying for the end of the road is $1$ minute, whether you succeed in parking or not.

Now we can do an expectation calculation. If you try for the end of the road, and succeed (probability $(p)(0.8)$) then your time cost is $1$. If you go to the end of the road and fail (probability $(p)(0.2)$) then your time cost is $11$. And finally, if you go directly to the garage (probability $1-p$) then your time cost is $10$. So your expected time cost is $$(p)(0.8)(1)+(p)(0.2)(11)+(1-p)(10).$$ This turns out to be $10-7p$.

Now we might ask: for what $p$ is the expectation a minimum? The answer is intuitively clear without our preliminary work, but we can also get it from our calculation. The function $10-7p$ reaches a minimum when $p=1$, so to minimize expected time, we should first try for the end of the road.

We did the explicit calculation in order to illustrate how expectation is computed.

-