Sunday, July 2, 2017

The Maniacal Clock-Maker

No longer merely whimsical, the clock-maker has fashioned all three hands of his clock to be the same len—

OK, I'm going to have to stop him right there, because trying to read a clock with three equal-length hands turns out to be not much fun. Furthermore, unless I'm mistaken there are no times when such a clock display is ambiguous (more on this below). The best I could do was find some near-miss times, perhaps the nicest example being this one:

In this image, a clock with white hands has been overlaid atop one with gray hands. As you can see, the overlap is very close. And it's not because the two times are correspondingly close; the times being shown by the two clocks are about thirteen minutes and forty-five seconds apart. Here are the two times displayed in the usual way:

(I added hash marks! I also went back and added hash marks to item (d) in the previous post and all four items in the post before that.)

The left clock shows fifteen minutes and 101,085,300/970,394,113 seconds past noon, while the right clock shows one minute and 15 1,943,925/970,394,113 seconds past noon. To a close approximation, the hands on the right-hand clock have been permuted in relation to the hands on the left-hand clock by (H → M, M → S, S → H).

I found this case and several others by generalizing the approach in the previous post. We seek two distinct times x and y such that any of the following permutations obtains:

H(x) = H(y)
M(x) = S(y)
S(x) = M(y)

H(x) = M(y)
M(x) = H(y)
S(x) = S(y)

H(x) = M(y)
M(x) = S(y)
S(x) = H(y)

H(x) = S(y)
M(x) = H(y)
S(x) = M(y)

H(x) = S(y)
M(x) = M(y)
S(x) = H(y)

Before going any further, you see the problem: each of these systems consists of three equations in only two unknowns; such systems typically have no solution. It's possible to get lucky and I did check, but as expected there are no solutions to any of these systems, and hence no ambiguous times.

To look for near-miss times, I generalized the approach from last time by defining the variables

x = m + j/60 + Δx
y = n + k/60 + Δy

where m, n are in {0, 1, 2, …, 11} and j, k are in {0, 1, 2, …, 59}. These equations express x and y as amounts of time "past the minute." This led to five systems of three equations in the two unknowns Δx and Δy, with each system containing the integer parameters m, n, j, and k.

Because all the systems are inconsistent for all possible parameter values, I did the standard thing and found the times that come "closest" to solving the system, in a least-squares sense. (Linear algebra people: for each system Ax = b, I solved ATAx* = Ab.) That done, one sees that how "close" the solution looks depends a lot on the values of the parameters m, n, j, and k. Instead of sussing out the dependence, I did the cheaper thing and set up a simple objective function (the sum of the three handtip-to-handtip distances) and used the objective function to sort the half-million or so solutions. The result was a "best" pair of times for each permutation. The pair of times shown in the image above was the best pair of times for the permutation (H → M, M → S, S → H), that is, the best pair of times that emerged from analyzing the third system of equations listed above.