Find the expectation from probability

AI Thread Summary
The discussion revolves around calculating the expected waiting time for vehicles at a traffic junction with a 2-minute green light followed by a 3-minute red light, within a 5-minute cycle. The expected waiting time is derived from the probabilities of arriving during green (2/5 chance of no wait) and red (3/5 chance of waiting, with wait times uniformly distributed from 0 to 3 minutes). The correct expected waiting time is found to be 0.9 minutes, achieved by combining the averages of waiting times weighted by their probabilities. Participants explore the limitations of discrete approximations and the necessity of using continuous probability distributions for accurate calculations. Ultimately, the conversation emphasizes the importance of understanding probability density functions in this context.
jaus tail
Messages
613
Reaction score
48

Homework Statement


Assume that in a traffic junction, the cycle of the traffic signal lights is 2 minutes of green
(vehicle does not stop) and 3 minutes of red (vehicle stops). Consider that the arrival time of
vehicles at the junction is uniformly distributed over 5 minute cycle. The expected waiting
time (in minutes) for the vehicle at the junction is __________.

Homework Equations


E(x) = summation of (x) * P(x) over all values of x

The Attempt at a Solution


upload_2017-10-22_15-26-57.png

Adding them all I get answer for expected value as 1 / 25 * (6 + 6 + 6 + 5 + 3 ) = 26/25
Correct answer is 0.9.

How do I solve this?
 

Attachments

  • upload_2017-10-22_15-18-55.png
    upload_2017-10-22_15-18-55.png
    87.2 KB · Views: 683
  • upload_2017-10-22_15-26-57.png
    upload_2017-10-22_15-26-57.png
    70.4 KB · Views: 1,407
Physics news on Phys.org
You can't make a discrete version out of it like you did. What happens to cars that arrive in between?
The probability that a car has to wait 3 minutes is not 1/5, it is 0, because you would have to arrive "exactly" when the traffic lights get red.
jaus tail said:
1 / 25 * (6 + 6 + 6 + 5 + 3 ) = 26/25
That seems to imply the car has to wait even when it arrives at a green light?
 
  • Like
Likes jaus tail
Cars in between? I'll have to take a small intervals. Like 0 to 0.5 and then move on? Yeah the 26/25 bothered me as well. I don't know how book gets 0.9.

But even with 1 minute interval, at least my answer should be a good approximate to 0.9. Currently I get 26/25. I don't know where is the mistake? Discrete should give me some close approximate value depending on step size.
 
jaus tail said:

Homework Statement


Assume that in a traffic junction, the cycle of the traffic signal lights is 2 minutes of green
(vehicle does not stop) and 3 minutes of red (vehicle stops). Consider that the arrival time of
vehicles at the junction is uniformly distributed over 5 minute cycle. The expected waiting
time (in minutes) for the vehicle at the junction is __________.

Homework Equations


E(x) = summation of (x) * P(x) over all values of x

The Attempt at a Solution


View attachment 213533
Adding them all I get answer for expected value as 1 / 25 * (6 + 6 + 6 + 5 + 3 ) = 26/25
Correct answer is 0.9.

How do I solve this?

With probability 2/5 the car arrives in the 2-minute green-light period, so P(no wait) = 2/5. With probability 3/5 the car arrives somewhere in the 3-minute red-light period; the actual time of arrival in that 3-minute period is uniformly distributed over an interval of length 3, so the wait-time is uniformly distributed over the interval from 0 to 3. What is the mean of a uniformly-distributed quantity that can range from 0 to 3? Even if you have not had calculus yet, the answer is "intuitive" and goes along with common sense.

Now you just need to combine the two averages and their probabilities in an appropriate way.

Alternatively, you can assume that the car can arrive at any of N equally-spaced points in the interval from 0 to 5, but taking N = 5 is too small. Why? Well, suppose the first two minutes have a green light and the remaining 3 minutes have a red light. The car can arrive at any time from 0 to 5, but we approximate this by using equally-spaced discrete points, each being equally-likely. The problem is that 1 microsecond before t = 2 the light is green and so the car does not wait; 1 microsecond after t=2 the light is red and the car waits for 3 minutes. How should we characterize the point t = 2 exactly? If we just use the five points 1,2,3,4,5 or the 6 points 0,1,2,3,4,5, the single point t=2 can have a significant effect on the calculated answer. We need more points, so that the single point t = 2 does not affect the answer very much. So, doing the calculation where the arrival points are spaced apart by 30 seconds would give us an answer that is closer to the true value; having them spaced 15 seconds apart would be even better. A more accurate answer would be obtained by spacing the points closer together and increasing their number. Just make a table of the N equally-likely wait-time values {wait(1), wait(2), ... wait(N)}, then take their expectation; this is quite easy using a spreadsheet, for example. (Note that many of the wait-times in your table would be 0, and the others would range from near 0 to near 3.)

The true answer 0.9 would be obtained by having infinitely many points spaced 0 apart, which is the continuous situation, but using a large enough N should work well enough for practical purposes. Putting it all in a spreadsheet would be the easiest way to go.
 
Last edited:
26/25=1.04 is not too far away from 0.9. See the previous post for two methods to get the exact result (0.9 is correct).
 
  • Like
Likes jaus tail
Ray Vickson said:
With probability 2/5 the car arrives in the 2-minute green-light period, so P(no wait) = 2/5. With probability 3/5 the car arrives somewhere in the 3-minute red-light period; the actual time of arrival in that 3-minute period is uniformly distributed over an interval of length 3, so the wait-time is uniformly distributed over the interval from 0 to 3. What is the mean of a uniformly-distributed quantity that can range from 0 to 3? Even if you have not had calculus yet, the answer is "intuitive" and goes along with common sense.

Now you just need to combine the two averages and their probabilities in an appropriate way.

This is genius. Thanks for this. 2/5 * 1.5 = 0.9.
But why did you take 2/5?
In 5 minute cycle there would be infinite cases of
Red for 3 minutes + green for 2 minutes
OR
green for 1 minute + red for 3 minutes + green for 1 minute
OR
Red for 2.5 minutes + green for 2 minutes + red for 0.5 minute

so wouldn't we have to add all the above Probability to get a P(car stops) which we multiply with 1.5

The book has given something like integration in its answer which I don't understand.
 

Attachments

  • upload_2017-10-23_13-29-3.png
    upload_2017-10-23_13-29-3.png
    36.3 KB · Views: 661
jaus tail said:
In 5 minute cycle there would be infinite cases of
Red for 3 minutes + green for 2 minutes
OR
green for 1 minute + red for 3 minutes + green for 1 minute
OR
Red for 2.5 minutes + green for 2 minutes + red for 0.5 minute
Huh?
A car can arrive anywhere within a 5 minute cycle. Within 2 of the 5 minutes it will encounter a green light and don't wait at all. Within the other three minutes it encounters a red light.
 
  • Like
Likes jaus tail
jaus tail said:
This is genius. Thanks for this. 2/5 * 1.5 = 0.9.
But why did you take 2/5?
In 5 minute cycle there would be infinite cases of
Red for 3 minutes + green for 2 minutes
OR
green for 1 minute + red for 3 minutes + green for 1 minute
OR
Red for 2.5 minutes + green for 2 minutes + red for 0.5 minute

so wouldn't we have to add all the above Probability to get a P(car stops) which we multiply with 1.5

The book has given something like integration in its answer which I don't understand.
You ask: why did you take 2/5? I did not--you did. Besides, (2/5)(1.5) ≠ 0.9.
 
  • Like
Likes jaus tail
jaus tail said:
This is genius. Thanks for this. 2/5 * 1.5 = 0.9.
But why did you take 2/5?
In 5 minute cycle there would be infinite cases of
Red for 3 minutes + green for 2 minutes
OR
green for 1 minute + red for 3 minutes + green for 1 minute
OR
Red for 2.5 minutes + green for 2 minutes + red for 0.5 minute

so wouldn't we have to add all the above Probability to get a P(car stops) which we multiply with 1.5

The book has given something like integration in its answer which I don't understand.

Integration is the limit of summation as the number of terms goes to infinity, while the size of each term goes to zero. Basically, just do what I said in #4, and split up the 5-minute interval into N equal parts, then tally up the waiting times for the N different arrival times that you get. Then take the N-term average. For larger and larger N you get a better and better estimate of the true answer. As I said before, if you let N go to infinity, the sum becomes some limiting value---and that limit is what we call the integral. The true answer is, indeed, given by an integral (in one way of doing it, anyway).

However, your method above is on the right track: see what you get when you multiply 1.5 by P(stop). Then see if you can understand why it works! Your textbook must have some material on this topic.
 
  • Like
Likes jaus tail
  • #10
Sorry for the late reply.
Yeah it's 3/5 * 1.5 = 0.9
Textbook has a few paras on probability density function. I don't know which value to integrate. They've done this:
upload_2017-10-28_13-34-58.png

I don't know why f(x) is 1/5
And why is limits 0 to 5 broken as: 0 to 2 and 2 to 5
The limits can also be: 0 to 1 and 3 to 5
 

Attachments

  • upload_2017-10-28_13-34-58.png
    upload_2017-10-28_13-34-58.png
    46.4 KB · Views: 632
  • #11
jaus tail said:
don't know why f(x) is 1/5
The general form of the average of one function h weighted according to another, k, is ∫hk/∫k. In a simple average over time that becomes ∫h(t).dt/∫.dt = ∫h.dt/Δt.
In the present case Δt=5.
jaus tail said:
The limits can also be: 0 to 1 and 3 to 5
Do you mean 0 to 3 and 3 to 5? Sure, but that just swaps the two integrals over. The result is the same. You can choose to start the 5 second period wherever you like within the cycle.
 
  • Like
Likes jaus tail
  • #12
I didn't understand the limits part.
When I meant 0 to 1 and 3 to 5
I meant that
signal is red from 0 to 1 and then from 3 to 5.
In the book why have they taken g(x) as 0 from 0 to 2 and not from 1 to 3.
I mean how are they sure that for the time interval of 5 minutes, we have the first 2 minutes as green and next 3 as red.
We can also have:
first 3 minutes as red and next 2 minutes as green.
There can be infinite variations.

Is there some definition of delta t that it becomes 5?
 
  • #13
Ok so X is the time when car comes and there is 1 car in five minutes so d(x)/d(t) = 1/5
 
  • #14
jaus tail said:
When I meant 0 to 1 and 3 to 5
I meant that
signal is red from 0 to 1 and then from 3 to 5.
Ok, you mean 0 to 1, 2 to 3 and 3 to 5, but with the 2 to 3 integral producing zero. You could also break it into five integrals of one second each.
As you say, infinitely many options, but all producing the same result.
 
  • Like
Likes jaus tail
  • #15
haruspex said:
Ok, you mean 0 to 1, 2 to 3 and 3 to 5, but with the 2 to 3 integral producing zero. You could also break it into five integrals of one second each.
As you say, infinitely many options, but all producing the same result.
So if it's infinite options then shouldn't answer be addition of all results.
like P (A or B or ...) = P(only A) + P(only B) +...
 
  • #16
jaus tail said:
Ok so X is the time when car comes and there is 1 car in five minutes so d(x)/d(t) = 1/5
Sort of, yes. In that view, dx/dt is the probability density function, f(t). As required of such a function ∫f.dt=1, and since it is uniform we have f=1/5.
 
  • Like
Likes jaus tail
  • #17
jaus tail said:
So if it's infinite options then shouldn't answer be addition of all results.
like P (A or B or ...) = P(only A) + P(only B) +...
Sure, but it is a continuous distribution, so you have to use integrals rather than sums.
 
  • #18
Does f(t) have some physical interpretation? Is it like number of cars arriving in one minute or something?
Thanks for the continuous help. The earlier method of 3/5 * 1.5 was so much simpler than integration.
 
  • #19
jaus tail said:
Does f(t) have some physical interpretation?
A probability density function gives the relative likelihood of values in a vicinity. If we look at some range of possible values, (x,x+dx), of a random variable X, there is a probability P[x<X<x+dx] that X lies in that range. The probability density function f(x)=limdx→0(P[x<X<x+dx]/dx).
For a more physical view, it is like a mass density function, but in which the mass of the whole object is known to be 1.
 
  • Like
Likes jaus tail
  • #20
haruspex said:
A probability density function gives the relative likelihood of values in a vicinity. If we look at some range of possible values, (x,x+dx), of a random variable X, there is a probability P[x<X<x+dx] that X lies in that range. (so this P[x<X<x+dx] is a probability that the car comes in 0 to 5 minutes.)The probability density function f(x)=limdx→0(P[x<X<x+dx]/dx). (i went through wikipedia for prob dens func. it's more like ratio of car occurring in one same to duration of that sample. so here car occurring in 1st second = 1/5. car occurring in 1st 2 seconds = 2/5. so prob dens func = 2/5 divide by 2 = 1/5.
For a more physical view, it is like a mass density function, but in which the mass of the whole object is known to be 1.

Thanks for the help.
 
Back
Top