A long time ago, Dan Meyer took to the twitter-sphere with a question:

Note, it seems that the tweet is gone. Here’s the gist:

What time is it when all the hands on a clock are equally spaced (ie, 120 degrees apart)?

At the time I thought of doing some coding to figure out the answer, but I never got around to it. I will say, though, that it’s bugged me ever since. So, I finally decided to do something about it.

At first I thought I could put together a genetic algorithm to find the solution, but I got stuck on how to parametrize the problem. Then I found a good way to do it as a single parameter: time (duh). Once I had it down to a single parameter, I figured a genetic algorithm might be overkill. Instead I played around with tricking Mathematica to find lots of minima of a function.

First the parametrization: I realized that, at the symmetry point Dan refers to, if I set all the hands to have the same length, their vectors will add up to the null vector. So, I made a function that determined the length (actually I did the length squared because it saved a square root call) of the sum of the hands of the clock, as a function of time. Here’s what that function looks like if you plot it from noon to 3pm:

As you can see, there are lots of times it gets close to zero, but the question is whether it actually ever does. Consider the dip between 1000 and 1500 seconds. That corresponds to around 12:17 or so, when the hour and minute hands are roughly separated by 120 degrees. The second hand continues to sweep around and the function gets close to zero every time the second hand is over around the “8” or so. If you zoom in, however, you can see that none of those times brings the function to zero:

Now, on this one it looks like the dip around 1300 seconds is zero, but it’s not:

So, does it ever nail it? I set about determining that by doing three different approaches:

First, I did an iterated FindRoot sequence. FindRoot will find all those dips if they get close enough to the axis. Of course, the problem with FindRoot is that it only finds one. So I did it as a sequence where I kept increasing the initial guess. This did end up finding all the dips, and then I asked Mathematica to determine the value in all of them, and then I found the minimum of that.

Second, I remembered that I had figured out once before how to find all the peaks/troughs/roots whatever of a function using a cool NDSolve feature:

So I did that, reaping all the points where f'[t] was zero, then sorting the solutions. This gave the same answer, though, I think, more accurate than the previous one.

Both of those approaches found that the closest the clock ever gets is at 2:54:34.560960612107436 (overkill, I know).

For the third approach, I thought I’d make it simpler. First I found all the times where the minute hand and hour hand were at exactly 120 degrees, and then find where the second hand is, compared with the perfect position. That lead to this image:

This approach validated the conclusion of the first two: there is no time when they are all 120 degrees away from each other.

Some questions you might have:

- Don’t you have a life?
- How did you find all the times when the hour and minute hand were 120 degrees?
- My clock’s second hand snaps to the integer seconds, will that have a solution?
- If Dan Meyer asks, you should give the right answer, not just “it doesn’t happen.” That’s just rude.

Two years ago … mercy. Extra credit for persevering.

Really it just means I would notice the clock hands’ angles every once in a while. It’s funny that it took so long to come up with this simple parametrization, though, otherwise I’m sure I would have jumped on it sooner.

For the third approach, shouldn’t you choose all three combinations of two hands and check all positions where they’re at 120 degrees?

That could certainly find a closer situation, but my approach should tell me if the perfect situation ever arises.