ôô

# 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.

By
Jason Marshall, PhD,
March 18, 2011
Episode #055

Page 1 of 2

http://www.shutterstock.com/pic-122948020/stock-vector-vector-illustration-of-detailed-beautiful-calendar-icon.html?src=e_1qvAPpsBDsyqJn8Mks6w-1-5Did 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.

To find the day of the week of a future date, start by finding the number of days from today modulo 7.

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 x 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.

• Audio
• Audio
• Audio
• Audio