Question: Three people – A, B and C – are standing at the three corners of an equilateral triangle. At time 0, A starts running towards B, B towards C and C towards A. At what time do they catch up and where? Assume each side of triangle is 1 unit, and speed of each person is 1 unit/hr.

Answer: By symmetry, they must meet at the center of the equilateral triangle. The center is at a distance of 0.5/cos(30) from each vertex of the triangle. The component of speed in that direction = 1 * cos(30). Therefore time = 0.5/cos^2(30) = 2/3 hr = 40 mins.

That used to be enough before I was a computer scientist. Now, of course, I must poison everything by simulating it and “testing it”. (Some test of a proof, huh?).

So, I wrote a small Java program which essentially simulates this scenario. A parameter it considers is the “step size” – that is, how long, will the person keep running before readjusting their direction. The smaller the step size, the closer the result should be to the theoretical answer. As a termination criteria, the simulator stops when the vertices are no more than the same “step size” away, since they will keep overshooting each other at that point.

So, here are the results:

Motion simulation started, stepsize: 0.1

Termination criteria reached.

p1: Point [x=0.549085637, y=0.3009455537], p2: Point [x=0.464830686, y=0.325049334], p3: Point [x=0.4860836758, y=0.2400305158]

Time: 0.7 hrs

Motion simulation started, stepsize: 0.01Termination criteria reached.

p1: Point [x=0.4945088945, y=0.2898249361], p2: Point [x=0.501749795, y=0.283344797], p3: Point [x=0.503741310, y=0.292855670]

Time: 0.68 hrs

Motion simulation started, stepsize: 0.0010Termination criteria reached.

p1: Point [x=0.4995170777, y=0.288533649], p2: Point [x=0.500363990, y=0.288327654], p3: Point [x=0.500118931, y=0.28916410]

Time: 0.668 hrs

Motion simulation started, stepsize: 1.0E-4Termination criteria reached.

p1: Point [x=0.4999632647, y=0.2886362474], p2: Point [x=0.500052044, y=0.2886627644], p3: Point [x=0.4999846904, y=0.2887263918]

Time: 0.666799 hrs

Motion simulation started, stepsize: 1.0E-5

Termination criteria reached.

p1: Point [x=0.500005073, y=0.2886767668], p2: Point [x=0.4999960499, y=0.288678711], p3: Point [x=0.499998876, y=0.288669925]

Time: 0.666689999 hrs

Motion simulation started, stepsize: 1.0E-6Termination criteria reached.

p1: Point [x=0.500000347, y=0.2886754955], p2: Point [x=0.4999995134, y=0.2886752554], p3: Point [x=0.500000138, y=0.28867465]

Time: 0.666668999 hrs

Clearly, as the stepsize approaches 0, the time approaches the theoretical value of 2/3.

Maybe, some day, I will get around to putting a UI layer on it.