Tuesday, March 2, 2010

Will they meet?

Two friends arranged to meet at a railway station, but they'd arrive between 1pm and 2pm, would wait for up to 15 minutes and leave if the other didn't turn up during that time. What is the probability that they actually meet?

NB if they meet, it must be between 1pm and 2pm.

Labels:

12 Comments:

Blogger Zaux said...

Chris ...
probably wrong ...
is it a 6.25% chance of them meeting

March 2, 2010 6:50 PM  
Blogger Chris said...

No. It's got to be at least 1/4.

March 2, 2010 7:12 PM  
Blogger Anonymous said...

Will they meet

Assuming that the each man arrives at a time between 0 and 60.

If A arrives first at time t1,
Since A stays until t1+15 min.
consider the range of "hits" for B.
For :
t1=0 to 15
smallest t2=0, largest t2=t1+15
difference between smallest and largest = t1+15
int(0,15) t+15=(0,15) of (1/2*T1^2+15*T1)
=15^2/2+15*15=337.5

t1=15 to 45
smallest t2=t1-15 largest t2=t1+15
difference between smallest and largest = 30
Sum=30*30=900

t1=45 to 60
smallest t2=t1-15 largest t2=59
difference between smallest and largest = 75-t1
int(45,60) 75-t=(45,60) of (-1/2*T1^2+75*T1)
=(-0.5*60^2+75*60)-(-0.5*45^2+75*45)=337.5

337.5+900+337.5=1575
1575/(60*60)=0.4375

Answer:
43.75 % chance of meeting

Cam.

March 2, 2010 8:16 PM  
Blogger Chris said...

Cam, you got it. I'm slightly surprised that breaking it into 1 minute intervals did the job, but you got the exact answer: 0.4375 = 7/16.

March 2, 2010 9:00 PM  
Blogger Anonymous said...

Chris,

Didn't really break it into 1 minute intervals, but rather down into the piecewise probability distribution defined by the 1st man's time and then integrated.

integral( dx/60*P(A AND B))
=integral( dx/60*fraction of hour that they can meet*60min *1h/60 mins)
=1/(60*60)*integral(fraction of hour they can meet*60 min dx)
=1/(60*60)*integral(minutes in the hour they can meet dx)

minutes in the hour they can meet is not restricted to integer values i.e. it is a piecewise continuous function

Cam

March 2, 2010 10:46 PM  
Blogger Ross said...

Does the answer change if they can only choose whole number minute intervals to arrive at?

March 3, 2010 12:02 PM  
Blogger Chris said...

I expect so. But it will be a very small difference.

March 3, 2010 2:56 PM  
Blogger Divya said...

1/4

March 3, 2010 6:31 PM  
Blogger Chris said...

Hi Divya. If Cam says it's 43.75%, then it's probably 43.75%. He is not well known for giving wrong answers (unless he's seriously short on coffee ;). Also, I posted the problem and agree.

March 3, 2010 7:48 PM  
Blogger Anonymous said...

Ross,

If you restrict it to discrete minute intervals, i.e. time of arrival must be an integer minute from 0 to 59, the probability is 43.33333....%

It's reasonably close but not the same. The integer sums of the ends is 330=(15+29)/2*15 each as opposed to the continous triangles which are 337.5 each. The integer sum of the rectangle in the middle remains the same as the continuous value at 900.

Essentially for all the areas which are not at a constant value, you will be adding error as you try to approximate the continuous function with a bunch of smaller rectangles. As we make the time intervals smaller the error will be reduced. When we make the time interval so small it is a dx, we have the exact answer.


Cam

March 3, 2010 8:07 PM  
Blogger Chris said...

Thank you for that Cam. I've been busy working (and playing a few games) to follow this one through.

March 4, 2010 8:06 AM  
Blogger Chris said...

One man must arrive before the other. The probability that man 1 arrives during the first 3/4 hour is 3/4. He'll then wait 1/4 hour. The probability that he arrives during the last 1/4 hour is 1/4, and then (on average he'll wait) 1/8 hour. So altogether the man 1 will wait (3/4)*(1/4 ) + (1/4)(1/8) = 7/32. So the probability that man 2 arrives while the man 1 is waiting is 7/32. Similarly if man 2 arrives before man 1. SO altogether, the probability of them meeting is 7/32 + 7/32 = 7/16 = 43.75%.

If generalise and let man 1 wait w1 and man 2 wait w2, we get prob of meeting = (1-w1)*(w1) + w1*(w1/2) + (1-w2)*(w2) + w2*(w2/2) = w1(1-w1/2) + w2(1-w2/2).

--- some code if you want to play
Option Explicit

Sub sRunTrials()
  Dim nTrials As Long
  Dim nMaxTime As Double
  Dim nArrivalTime1, nArrivalTime2 As Double
  Dim nWaitTime1, nWaitTime2 As Double
  Dim nDepartTime1, nDepartTime2 As Double
  Dim nNumberOfMeetings As Double

  'NB all times are in hours

  Randomize 'one off for the entire proggy
  nMaxTime = 1
  nWaitTime1 = 1 / 4
  nWaitTime2 = 1 / 4

  For nTrials = 1 To 1000000
    nArrivalTime1 = nMaxTime * Rnd()
    nArrivalTime2 = nMaxTime * Rnd()

  If nArrivalTime2 > nArrivalTime1 Then
      nDepartTime1 = IIf(nArrivalTime1 + nWaitTime1 >= nMaxTime, nMaxTime, nArrivalTime1 + nWaitTime1)
      If nArrivalTime2 < nDepartTime1 Then nNumberOfMeetings = nNumberOfMeetings + 1
    ElseIf nArrivalTime1 > nArrivalTime2 Then
      nDepartTime2 = IIf(nArrivalTime2 + nWaitTime2 >= nMaxTime, nMaxTime, nArrivalTime2 + nWaitTime2)
      If nArrivalTime1 < nDepartTime2 Then nNumberOfMeetings = nNumberOfMeetings + 1
    End If
  Next nTrials

  'display the statistics
  Debug.Print
  Debug.Print Format(nNumberOfMeetings / nTrials, "0.######%"); " = fraction of times they met"
  Debug.Print Format(nWaitTime1 * (1 - nWaitTime1 / 2) + nWaitTime2 * (1 - nWaitTime2 / 2), "0.######%"); " = theoretical value"
End Sub

March 10, 2010 9:41 AM  

Post a Comment

Links to this post:

Create a Link

<< Home