- 13 Jul '06 23:53 / 1 editSo this is a problem a friend of mine and I have been pondering for some time. I created a solution that seems to work for all but a few cases, but it isn't perfect unless you interpret no solution to mean pi radians (or 180 degrees for all you math degenerates) Here is the problem, see if you can come up with a better answer than me.

Find a general equation for the angle between the hands of a clock (just minutes and hours) at any given time. You should be able to plug in hours for h and minutes for m (or other variables if you are being difficult) and get an angle value from the equation. I am looking for ease of use here, so hours and minutes should both be part of the equation. Most elegant solution wins. Although if it is the only one, it is automatically most elegant.

Note: this is a clock whose hour hand moves just a bit every minute, not all at once to the next hour. - 14 Jul '06 00:08Right we'll start off with a simple difference formula.

Angle = abs ((30*h+0.5*m)-(6*m))

To explain: The hour hand position is found by adding up the angle from hours (each hour segment is 30 degrees) and the angle from minutes (each minute will add half a degree to the hour hand). The minute hand is just the number of minutes times six.

So the angle between them will be the difference. To avoid negative answers we use the absolute value of the difference.

In radians we'd have:

Angle = abs ((pi/6 * h + pi/360 * m) - (pi/30 * m)) - 14 Jul '06 01:34

That was my result also except I have (-1/6 h) not (+ 1/6h).*Originally posted by XanthosNZ***In radians we'd have:**

Angle = abs ((pi/6 * h + pi/360 * m) - (pi/30 * m))

I did one more thing after that. No biggie though:

Angle = abs (11/360 m - 1/6 h) * pi

Strange thing is, I checked it was some examples and got correct but also wrong results. I'm too tired now to figure out what went wrong there. - 14 Jul '06 02:15

You're right about the simplification I should have done that. And the different ways of calculating difference don't matter in the end (as abs(a-b)=abs(b-a)).*Originally posted by crazyblue***That was my result also except I have (-1/6 h) not (+ 1/6h).**

I did one more thing after that. No biggie though:

Angle = abs (11/360 m - 1/6 h) * pi

Strange thing is, I checked it was some examples and got correct but also wrong results. I'm too tired now to figure out what went wrong there.

As for some answers being wrong I looked at it and it seems it happens when h=12. So that's easily fixed by replacing h with mod(h,12) or hmod12 in non-code format.

Also note that the formula finds the angle that does not include the top of the clock. So 12:55 is 5.28. This can be fixed (if needed) by adding a statement that subtracts the answer from 2*pi if it is greater than pi. - 14 Jul '06 19:43A question along similar lines (and one to which I don't know the answer) - I hope it hasn't appeared here before.

Is it possible for the hands of a clock/watch to exactly divide the face into thirds? ie all the hands are at 120 degrees to each other. Again it it the sort of clock where the hands move continuously and don't "jump" from exact minute to exact minute etc.

As an example: 20 seconds past 8 O'clock comes close - but is not exact. - 16 Jul '06 00:33

The following Matlab program returns no solutions:*Originally posted by howardbradley***A question along similar lines (and one to which I don't know the answer) - I hope it hasn't appeared here before.**

Is it possible for the hands of a clock/watch to exactly divide the face into thirds? ie all the hands are at 120 degrees to each other. Again it it the sort of clock where the hands move continuously and don't "jump" from exact minut ...[text shortened]... t minute etc.

As an example: 20 seconds past 8 O'clock comes close - but is not exact.

for h=0:11

for m=0:60

for s=0:1:60

secondhand=s*6;

minutehand=m*6 + s*0.1;

hourhand=h*30 + m*0.5 + s/120;

if (abs(secondhand-minutehand) == 120) & (abs(minutehand-hourhand) == 120) & (secondhand ~= hourhand)

h

m

s

end

end

end

end

So there are no such times (I checked with s=0:0.01:60 [that is including hundreths of a second] but it still returned nothing). Obviously this isn't a mathmatical proof of why such a time cannot exist but just tells you that it doesn't. - 16 Jul '06 02:09 / 1 editImproved my code:

clear;

clc;

i=1;

tolerance=0.67;

for h=0:11

for m=0:59

for s=0:0.001:59.999

secondhand=s*6;

minutehand=m*6 + s*0.1;

hourhand=h*30 + m*0.5 + s/120;

difference= [abs(secondhand-minutehand), abs(minutehand-hourhand)];

if (((120-tolerance) < = difference(1)) & (difference(1) < = (120+tolerance)))

if (((120-tolerance) < = difference(2)) & (difference(2) < = (120+tolerance)))

if (abs(secondhand - hourhand) > 2*tolerance)

OutBy(i)=max(difference);

time(i,1) = h;

time(i,2) = m;

time(i,3) = s;

end

end

end

end

end

end

EDIT: I do so hate when the less than bug strikes post here.

Anyway, this gives that at 11:38:18.218 we are around 0.5 degrees away from a perfect 120/120/120. - 13 Aug '06 05:56Its easy to see why a clock cannot have a time like that, the two hands being mechanically in sync so the only way it would work is if it started out 20 minutes fast or slow. A clock can obviously be at 12:00

starting out that way, by the time the minute hand gets to 20 the hour hand would have moved one third of an hour also so its impossible, unless it starts out 20 minutes off. - 13 Aug '06 07:46

That's not a proof.*Originally posted by sonhouse***Its easy to see why a clock cannot have a time like that, the two hands being mechanically in sync so the only way it would work is if it started out 20 minutes fast or slow. A clock can obviously be at 12:00**

starting out that way, by the time the minute hand gets to 20 the hour hand would have moved one third of an hour also so its impossible, unless it starts out 20 minutes off. - 13 Aug '06 13:28 / 1 edit

Of course not a maths proof but a physical proof. If there was a case where one could get out of sync then in an infinite series, letting the clock go forever, you might run into a time setting like the problem wants but it repeats exactly each day so you are limited to the time within that span so you clearly cannot have the hands 120 degrees apart. You don't need maths for that.*Originally posted by XanthosNZ***That's not a proof.**

BTW, thanks for bringing up the idea my 50Km/hr problem was done before. I didn't find it but I went through a lot of the past posts and there is some great puzzles there in the past. I would not have even looked if you had not said that.