[Math] Calculating time using modulus

discrete mathematicsmodular arithmetic

In my textbook, the question is as follows:

What time does a 24 hour clock read:

a) 100 hours after it reads 2:00

b) 45 hours before it reads 12:00

c) 168 hours after it reads 19:00

And provides answers as follows:

a) 7:00

b) 8:00

c) 10:00

I calculated (a) by say t = 100 + 2 (mod 24), then 2:00 + t, which gave me 8:00.

Now my problem is, i dont understand a) how they arrived at those answers, and b) where my understanding of modulo arithmetic is lacking. When i searched for the worked solution of these questions on google, all the sources with these specific questions had a different answer from that of the book(but the answers from all the sources were the same), for example, all sources say a) is 6:00. This inconsistency has left me confused. In answering, please also show how you would do the same for a 12-hour clock.

Best Answer

If the current time is $t$, and the time $n$ hours into the future is $f$, using a $24$ hour clock, we have:

$t$ is the current time. $t+n$ is the future time. $f$ is also the future time. Thus:

$$t+n\equiv f\pmod{24}$$

using a twelve hour clock, this is instead simply $t+n\equiv f\pmod{12}$


If the current time is 2:00, and we want to know what the future time is 100 hours into the future, we have:

$f\equiv t+n\equiv 2+100\equiv 102\equiv 4\cdot 24+6\equiv 6\pmod{24}$

so the future time will read 06:00


If the current time is $t$ (currently unknown), and $100$ hours into the future the clock reads $2:00$ (the future time), we have:

$t+n\equiv f\pmod{24}$ implying

$t\equiv f-n\equiv 2 - 100\equiv -98\equiv -5\cdot 24 + 22\equiv 22\pmod{24}$

so the current time reads 22:00


Similarly, we could talk about time into the past.

If the current time is $t$ and the time $n$ hours before it into the past is $p$, using a $24$ hour clock we have:

$t$ is the current time. $t-n$ is the past time. $p$ is the past time. Thus:

$$t-n\equiv p\pmod{24}$$


If the current time is 12:00 and we are curious what time it was 45 hours into the past, we have:

$p \equiv t-n\equiv 12 - 45\equiv -33\equiv -2\cdot 24 + 15\equiv 15\pmod{24}$

thus, the time 45 hours in the past was 15:00


If the current time is unknown, $t$, but we know that 45 hours into the past the time had at that point read as 12:00, we have:

$t\equiv n+p\equiv 45+12\equiv 57\equiv 2\cdot 24 + 9\equiv 9\pmod{24}$

so, the current time is 9:00.

Again, in all of these examples, if you were using a twelve hour clock instead, you would use modulo twelve. In each case, you are asking "how much larger than the closest smaller multiple of twenty-four (or twelve as the case may be) is my number?"