How to Calculate the Day of the Week of Any Date
Learn how to use the connection between modular arithmetic and remainders in division to calculate the day of the week of any date.
Jason Marshall, PhD
Listen
How to Calculate the Day of the Week of Any Date
shutterstockDid you know that you can use modular arithmetic to predict the future? Well, okay…you can’t use modular arithmetic to predict the future, but you can use it to calculate the future days of the week. That’s right, by the end of this article you’ll be able to take any date in the future—or in the past for that matter—and figure out what day of the week it’s going to fall upon.
Recap: How Modular Arithmetic is Related to Remainders in Division
The calculation that we’re going to learn relies upon the relationship between modular arithmetic and remainders in division that we talked about in the last article. So before we get on to talking about how to convert calendar dates into days of the week, let’s review this important relationship.
As you’ll recall, you can find the value of a number modulo 12 by figuring out how many more spaces it will take to count up to that number after you’ve already gone completely around a clock as many times as possible. For example, we can find the value of the number 29 in modulus 12 arithmetic by realizing that after going around a modulus 12 clock twice—that is, 2 x 12 = 24 total spaces—we must still go around 5 more spaces to reach 29 (since 24 + 5 = 29). Therefore, 29 mod 12 is congruent to 5.
The big take home message here is to realize that the answer of 5 that you get for 29 mod 12 is exactly the same as the answer you get when you find the remainder in the division problem 29 / 12. Which means that all we have to do to find the value of a number modulo some modulus is figure out the remainder left over when we divide the number by the modulus. For example: 10 mod 3 ≡ 1 (since 10 / 3 = 3 remainder 1), 12 mod 4 ≡ 0 (since 12 / 4 = 3 remainder 0), and so on.
How to Calculate the Day of the Week Some Number of Days From Today
At the end of the last article I left you to think about how you can use this relationship between modular arithmetic and remainders in division to answer a question about figuring out what the day of the week some number of days from today is going to be. For instance, if today is a Monday, how can you figure out what the day of the week is going to be 237 days from today? One way is to go and get a calendar and start counting through the days until you land at the particular day of the week 237 days from today. But that’s going to take you a really long time. There’s a faster way.
Let’s start by thinking about a simpler problem: What day of the week is it going to be 7 days after a Monday? Well, that’s easy—obviously it’s going to be another Monday since a week has 7 days. How about 8 days from a Monday? Well, since 8 is just 7+1, you can very quickly figure out that the day 8 days after a Monday is going to be a Tuesday. How about 16 days after a Monday? This time, since we know that 16=2×7+2 (in other words 2 weeks and 2 days), we can see that the day 16 days after a Monday must be a Wednesday.
And if you think about it, you’ll see that all we’re doing in each of these cases is finding the number of days from today modulo 7. In other words, all that you really need to know is a number between 0 and 6 that tells you how many days from a Monday you need to count forward: 1 means it’ll be a Tuesday, 2 means it’ll be a Wednesday, and so on, until you get to 6 days from Monday, which will be a Sunday. So to calculate what the day of the week is going to be 237 days from this Monday, you first need to calculate 237 mod 7. As we now know, the answer to 237 mod 7 is just the remainder in the problem 237 / 7. As you can check, 7 x 33 = 231, which means that 237 / 7 = 33 remainder 6. So the day of the week 237 days after this Monday is going to be the day of the week that comes 6 days after any Monday…which is Sunday.
How to Calculate the Day of the Week of Any Future Date
Now, what if instead of being told the number of days from today, you’re instead given an actual date. For example, what if you’re asked to figure out when New Year’s Day next year is going to fall. Well, in this case, the trick is to start by figuring out the number of days between that day and today. This is the tough part and can definitely take some thinking.
If we say that today is March 18, you can use the knowledge that the months of April, June, September, and November each have 30 days, while the other 5 months between now and next January each have 31 days. That means that there are a total of 13 days left in March, 4 x 30 = 120 days left for all the months that have 30 days between now and next January, 5 x 31 = 155 days left for all the months that have 31 days between now and next January, and then 1 more day to get from December 31 to January 1. That gives us a grand total of 13 + 120 + 155 + 1 = 289 days until next New Year’s Day.
Once you know the number of days until the date you’re interested in, you’re home free since we’ve already learned how to finish the calculation from that point. Since 289 mod 7 is congruent to 2, and since the day we’re calculating from is Friday, March 18, we’ve found that next New Year’s Day must be 2 days after a Friday…which is a Sunday!
How to Calculate the Day of the Week of Any Date
If you think about it, you’ll see that although we’ve been talking only about days in the future, this method actually works just fine for figuring out the days of the week of past dates too. For example, if you wanted to figure out what the day of the week was 94 days ago, the answer is 94 mod 7 days of the week before today. Since 94 / 7 = 13 remainder 3, if today was a Friday, then 94 days ago must have been 3 days before a Friday…which is a Tuesday.
One word of warning: although we haven’t had to worry about this in any of the cases we’ve looked at, when you’re calculating the number of days from today to a given date, be sure to watch out for those occasional leap days that occur in February of years that are divisible by 4 (with a few exceptions).
Wrap Up
Okay, you’re now ready to become a date calculating machine. With a bit of practice, you can actually get pretty quick at doing this sort of thing. And it’ll be well worth your time since you’ll have a very impressive trick to pull out at parties! After you’ve got the general idea down, see if you can come up with any clever tricks that will help you speed up the calculation even more.
If you have ideas about this or any other questions about math, please email them to me at mathdude@quickanddirtytips.comcreate new email, send them via Twitter, or become a fan of the Math Dude on Facebook and get help from me and the other math fans there.
Until next time, this is Jason Marshall with The Math Dude’s Quick and Dirty Tips to Make Math Easier. Thanks for reading math fans!