10分と15分ごとに実行される2つのバスの最初の待ち時間の期待値


19

私はインタビューの質問に出くわしました:

10分ごとに来る赤い電車があります。15分ごとに青い電車が出ています。どちらもランダムな時間から開始されるため、スケジュールはありません。ランダムな時間に駅に到着し、最初に来る電車に乗る場合、予想される待ち時間はどれくらいですか?


3
列車は時間通りに到着しますが、未知の均等に分配されたフェーズで、または平均10分と15分でポアソンプロセスに従いますか。
Tilefish Poele

1
前者はポアソンではありません。
Shengjieチャン

7
@Tilefishは、誰もが注目すべき重要なコメントをしています。 明確な答えはありません。 「ランダムな時間から開始する」という意味を想定する必要があります。(同時に開始するのか、それとも異なる未知の時間に開始するのか?未知の分布を明確な既知の分布を持つランダム変数として扱うのはなぜですか?)位相差の関数として(モジュロ5分のみ)、答えはから変化することができる15/425/6。位相差が均一に分布すると、35/9ます。
whuber

@whuber全員が、OPのコメントを2つの異なるランダムな時間に2つのバスが開始したかのように解釈したようです。彼らは同じランダムな時間に開始すると、異常なテイクのように思える
Aksakal

1
@Aksakal。全員ではありません:私はそうではなく、このスレッドの少なくとも1つの答えはそうではありません。そのため、異なる数値の答えが見られます。さらに、答えを得るために質問のそのような解釈をしなければならなかったという事実を認める人はほとんどいません。
whuber

回答:


15

問題にアプローチする1つの方法は、生存関数から開始することです。少なくとも分待たなければならないためには、赤青の列車の両方で少なくともt分待たなければなりません。したがって、全体的な生存関数は、個々の生存関数の単なる積です。tt

S(t)=(1t10)(1t15)

これは、ために、あなたは少なくとも待たなければならないということである確率トンの次の列車のための分。これは、各列車が他の列車や旅行者の到着時間に依存しない一定の時刻表にあり、2つの列車の位相が均一に分布しているという正しい仮定が必要であるというコメントでOPの明確化を考慮しています、0t10t

次に、pdfが取得されます

p(t)=(1S(t))=110(1t15)+115(1t10)

そして、期待値は通常の方法で取得されます:

E[t]=010tp(t)dt=010t10(1t15)+t15(1t10)dt=010(t6t275)dt

これにうまくいく分。359


デイブ、どのようにp(t)=(1- s(t)) 'を説明できますか?
Chef1075

S(t)= 1-F(t)の場合、p(t)は単なるf(t)= F(t) 'であると説明できます。
ディープノース

4
生存関数のアイデアは素晴らしいです。しかし、生存関数を直接統合して期待値を得ることができるのに、なぜPDFを導出するのでしょうか?実際、この回答の3分の2は、特定の例を使用して微積分の基本的な定理を示しているだけです。そして、製品を使用してを取得する正当な理由は何ですか?その背後に隠された仮定があります。S
whuber

2
私は理由確率変数の領域が0で起動しない、それを正しくハンドルの場合、生存関数からPDFを導出し、このアプローチを好む@whuber
デイブ

2
(1)ドメインはポジティブです。(2)式は簡単に一般化できます。
whuber

9

The answer is

E[t]=xymin(x,y)110115dxdy=x(y<xydy+y>xxdy)110115dx
Get the parts inside the parantheses:
y<xydy=y2/2|0x=x2/2
y>xxdy=xy|x15=15xx2
So, the part is:
(.)=(y<xydy+y>xxdy)=15xx2/2
E[t]=x(15xx2/2)110115dx=(15x2/2x3/6)|010110115=(1500/21000/6)110115=510/93.89

Here's the MATLAB code to simulate:

nsim = 10000000;
red= rand(nsim,1)*10;
blue= rand(nsim,1)*15;
nextbus = min([red,blue],[],2);
mean(nextbus)

1
You're making incorrect assumptions about the initial starting point of trains. i.e. Using your logic, how many red and blue trains come every 2 hours? How many trains in total over the 2 hours? etc.
Tilefish Poele

1
Can trains not arrive at minute 0 and at minute 60?
Tilefish Poele

1
what about if they start at the same time is what I'm trying to say. What if they both start at minute 0. How many instances of trains arriving do you have?
Tilefish Poele

1
The simulation does not exactly emulate the problem statement. In particular, it doesn't model the "random time" at which you appear at the bus station. As such it embodies several unstated assumptions about the problem.
whuber

2
@whuber it emulates the phase of buses relative to my arrival at the station
Aksakal

4

Assuming each train is on a fixed timetable independent of the other and of the traveller's arrival time, the probability neither train arrives in the first x minutes is 10x10×15x15 for 0x10, which when integrated gives 3593.889 minutes

Alternatively, assuming each train is part of a Poisson process, the joint rate is 115+110=16 trains a minute, making the expected waiting time 6 minutes


3
@Dave it's fine if the support is nonnegative real numbers.
Neil G

3
@dave He's missing some justifications, but it's the right solution as long as you assume that the trains arrive is uniformly distributed (i.e., a fixed schedule with known constant inter-train times, but unknown offset). It works with any number of trains. This is the because the expected value of a nonnegative random variable is the integral of its survival function.
Neil G

1
@Dave with one train on a fixed 10 minute timetable independent of the traveller's arrival, you integrate 10x10 over 0x10 to get an expected wait of 5 minutes, while with a Poisson process with rate λ=110 you integrate eλx over 0x< to get an expected wait of 1λ=10 minutes
Henry

1
@NeilG TIL that "the expected value of a non-negative random variable is the integral of the survival function", sort of -- there is some trickiness in that the domain of the random variable needs to start at 0, and if it doesn't intrinsically start at zero(e.g. for a different problem where the inter-arrival times were, say, uniformly distributed between 5 and 10 minutes) you actually have to use a lower bound of 0 when integrating the survival function. (starting at 0 is required in order to get the boundary term to cancel after doing integration by parts)
Dave

3
+1 At this moment, this is the unique answer that is explicit about its assumptions. All the others make some critical assumptions without acknowledging them.
whuber

2

I am probably wrong but assuming that each train's starting-time follows a uniform distribution, I would say that when arriving at the station at a random time the expected waiting time for:

  1. the Red train is E[R]=5 mins
  2. the Blue train is E[B]=7.5 mins
  3. the train that comes the first is E[min(R,B)]=1510(E[B]E[R])=154=3.75 mins


As pointed out in comments, I understood "Both of them start from a random time" as "the two trains start at the same random time". Which is a very limiting assumption.


1
Thanks! Your got the correct answer. But 3. is still not obvious for me. Could you explain a bit more?
Shengjie Zhang

1
This is not the right answer
Aksakal

1
I think the approach is fine, but your third step doesn't make sense.
Neil G

2
This answer assumes that at some point, the red and blue trains arrive simultaneously: that is, they are in phase. Other answers make a different assumption about the phase.
whuber

2

Suppose that red and blue trains arrive on time according to schedule, with the red schedule beginning Δ minutes after the blue schedule, for some 0Δ<10. For definiteness suppose the first blue train arrives at time t=0.

Assume for now that Δ lies between 0 and 5 minutes. Between t=0 and t=30 minutes we'll see the following trains and interarrival times: blue train, Δ, red train, 10, red train, 5Δ, blue train, Δ+5, red train, 10Δ, blue train. Then the schedule repeats, starting with that last blue train.

If WΔ(t) denotes the waiting time for a passenger arriving at the station at time t, then the plot of WΔ(t) versus t is piecewise linear, with each line segment decaying to zero with slope 1. So the average wait time is the area from 0 to 30 of an array of triangles, divided by 30. This gives

W¯Δ:=130(12[Δ2+102+(5Δ)2+(Δ+5)2+(10Δ)2])=130(2Δ210Δ+125).
Notice that in the above development there is a red train arriving Δ+5 minutes after a blue train. Since the schedule repeats every 30 minutes, conclude W¯Δ=W¯Δ+5, and it suffices to consider 0Δ<5.

If Δ is not constant, but instead a uniformly distributed random variable, we obtain an average average waiting time of

15Δ=05130(2Δ210Δ+125)dΔ=359.

2

This is a Poisson process. The red train arrives according to a Poisson distribution wIth rate parameter 6/hour.
The blue train also arrives according to a Poisson distribution with rate 4/hour. Red train arrivals and blue train arrivals are independent. Total number of train arrivals Is also Poisson with rate 10/hour. Since the sum of The time between train arrivals is exponential with mean 6 minutes. Since the exponential mean is the reciprocal of the Poisson rate parameter. Since the exponential distribution is memoryless, your expected wait time is 6 minutes.


The Poisson is an assumption that was not specified by the OP. But some assumption like this is necessary. The logic is impeccable. +1 I like this solution.
Michael R. Chernick

1
OP said specifically in comments that the process is not Poisson
Aksakal
弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.