# Who let the dogs off?

Four people, A, B, C, and D brought their dogs to a square park, 1 (mile/km) on each side. They stood at the four corners. Suddenly all four dogs broke free from their lea(shes/ds) at once.

A ran at B; B ran at C; C ran at D; and D ran at A. They all ran straight at their target, adjusting their trajectory as their target moved. They all ran at the same speed and eventually collided in the cent(er/re) of the park, where much butt/mutt sniffing ensued. How far did each dog run?

• I believe this is a somewhat fairly known problem with a pretty answer, but I don't know how it is derived. – greenturtle3141 Apr 28 '17 at 18:06
• I'm sure this is a duplicate ... – Rand al'Thor Apr 28 '17 at 18:13
• I searched briefly, and was surprised not to find it. It's definitely well known and pretty... – Dr Xorile Apr 28 '17 at 18:52

At all times, Dog A was traveling at velocity $v$ toward Dog B, and Dog B's velocity was perpendicular to the path of Dog A. Thus the relative speed of A toward B was always $v$.

Thus, the time taken was

$t = 1/v$.

Thus, the distance traveled was

$D = vt = v \times 1/v = 1$.

The crux of the puzzle is that because dog B's velocity relative to dog A is always perpendicular to the path between them, then for every step dog A takes toward dog B, the distance between them decreases by one step. Thus, when the distance has reduced to zero, dog A will have traveled a distance equal to the original distance between them, which is 1 (kilometer or mile).

• The picture/description clearly indicates that the distance is 1 (mile or km). – user3294068 Apr 28 '17 at 19:25
• "the relative speed is always constant (and we'll call it $v$)" might be a little more clear; I get that's implied in the explanation but I actually missed that it was in there the first time I read it. Sorry for my confusion. – Rubio Apr 28 '17 at 19:46
• I don't get how you deduced the time taken from the relative velocity being constant. I can suppose that because B's velocity was always perpendicular to A's, the distance between A and B was always the same as if B hadn't moved (i.e. B never moved away or closer to A), meaning the total distance A traverses is the same as if B hadn't moved; is that the reasoning you got the numerator from? But surely you didn't follow that exact reasoning since it makes calculating the time taken superfluous. – Oosaka Apr 30 '17 at 15:07
• But the unit don't work out. t = 1/v does not have matching units. – paparazzo May 1 '17 at 7:43
• @Paparazzi: "1" is "1 km (or mile)". – Deusovi May 1 '17 at 17:22

I think the intended answer is

$1.0$ and met at exactly ${(0.5,0.5)}$

but the actual answer according to my code is

$0.9999994$, probably the difference is the small error since my methodology is not pure math.

I have written a code which represents the integration of their movement which takes like 10 mins programming and thinking in total instead of pure math and it is a bit more fun :)

The algorithm was simple, each dog moves $0.00000001$ unit distance to their destination in a coordinate system in an order. When the distance between dogs becomes less than $0.00000001$, I just add the actual distance between dogs and find the answer. So when this value goes to 0, the answer becomes $1$ as it is intended in a math method.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _4dogsrun
{
class Program
{

static double Hypo (double x, double y, double z, double t)
{ double hypo;

hypo = Math.Sqrt(Math.Pow((t - y), 2) + Math.Pow((z - x), 2));

return (hypo);
}
static double[,] d = new double[4, 2] { { 0, 0}, { 0, 10000000 }, { 10000000, 10000000 }, { 10000000, 0 } };
static void Main(string[] args)
{
bool theymet = false;
double distance = 0;
do
{
for (int i = 3; i >= 0; i--)
{

if (Hypo(d[i, 0], d[i, 1], d[(i + 1) % 4, 0], d[(i + 1) % 4, 1]) > 1)
{
d[i, 0] = d[i, 0] + (d[(i + 1) % 4, 0] - d[i, 0]) / (Hypo(d[i, 0], d[i, 1], d[(i + 1) % 4, 0], d[(i + 1) % 4, 1]));
d[i, 1] = d[i, 1] + (d[(i + 1) % 4, 1] - d[i, 1]) / (Hypo(d[i, 0], d[i, 1], d[(i + 1) % 4, 0], d[(i + 1) % 4, 1]));
if (i==3)
{
distance = distance + 1;
}

}
else
{
distance = distance+Hypo(d[i, 0], d[i, 1], d[(i + 1) % 4, 0], d[(i + 1) % 4, 1]);
theymet = true;

break;
}

}

}
while (theymet==false);
Console.WriteLine(distance);
}
}
}


Lastly, you can modify the code to find the answer with more dogs and more dimensions easily!

• I don't know if they ever meet, so that could account for the extra distance. They keep spiralling in, never meeting until the centrifugal acceleration causes them to explode, or their finite size causes them to collide short of the expected distance as in your answer! – Dr Xorile Apr 30 '17 at 20:43
• @DrXorile if you think the dogs are dimensionless or just 1D, you are right. since you define that they are dogs, i put a real dimension to them, otherwise they cannot meet of course! in infinity, the total distance would not change though as 1. – Oray Apr 30 '17 at 20:48 I consider the trajectory as square rotating inside a square. Wolfram says it doesn't converge. I'm shocked.

• The curve of pursuit is a logarithmic spiral. Is your parametrization like that? – Dr Xorile Apr 30 '17 at 20:47