So why does that lunar phase method work anyway?

It’s *mostly* fairly obvious once you start thinking about it. For instance, suppose you know the age of the moon on a given day. Then its age a day later is, kind of obviously, one day more. Except when you hit new moon and it resets, every 29.53… days, and doing modulo 30 approximately accounts for that. So it makes sense for the formula to be something like (*x*+*D*) mod 30, where *D* is the day number and *x* doesn’t depend on the day (it’s approximately the age, minus 1, on the first of the month).

Now suppose you know the age of the moon on the first day of a given month. Then its age a month later is…? Well, in a 30 day month it’s about 0.47 days more, that is, 30–29.53; in a 31 day month it’s 1.47 days more. Or in an average month of about 365.25/12 = 30.52 days it’s *very* close to 1 day more. (Actually, since we’re working within the 2000 to 2018 Metonic cycle, the average year length that counts is 1/19 of five leap years and 14 normal years, which comes out to 365.263 days, not that the difference matters much.) If it weren’t for February it’d make sense for the formula to be something like *(y+M+D)* mod 30, where *M* is the month number and *y* doesn’t depend on the day or month (it’s the age at the start of the year, minus 2).

February’s short, though. How to deal with that? Hang on, we’ll get there.

Now suppose you know the age of the moon on the first day of a given year. Then its age a year later is… well, 365.25 days is 12.36 synodic months, so the age advance is 0.36 x 29.53 = 10.9 days. For a decent approximation, 11 days age advance per year, so a formula something like (*z*+(*Y* x 11)+*M*+*D*) mod 30, where *Y* is (last two digits of) the year number and *z* is a constant (the age on 1 Jan 2000, minus 2), would seem reasonable. If it weren’t for February.

It’s too bad February isn’t the last month of the year, then you wouldn’t have to deal with its shortness. Well, *make* it the last month of the year! Let’s pretend the year begins on March 1. Now within a month each day is a day greater age than the previous; within a (March-to-February) year each month is a day greater age than the previous; and each year is 11 days greater age than the previous. Looked at like this, we don’t have to worry especially about the age advance from February to March. So we could use a formula like the above, if we said March was month 1, April month 2, … January month 11, February month 12, and if we used the preceding year number in January and February. That is, for months March through December use

(*z*+(*Y* x 11)+(*M–2)*+*D*) mod 30

(here *M* is still 3 for March, et cetera) and for January and February use

(*z*+((*Y–1)* x 11)+(*M+10)*+*D*) mod 30 .

That gets a little complicated, though. But we haven’t defined *z* yet; we can absorb additive constants into it. That is, redefine *z*–2 as *z* so we have for March to December

(*z*+(*Y* x 11)+*M*+*D*) mod 30

and for January and February

(*z*+((*Y–1)* x 11)+*M+12*+*D*) mod 30 .

But now notice the latter is equal to

(*z*+(*Y* x 11)–11+*M+12*+*D*) mod 30

or

(*z*+(*Y* x 11)+*M+1*+*D*) mod 30

which means we don’t have to mess around with the year number or with month numbers like 13 and 14; just use the same formula for all months, except add 1 in January and February!

Nearly there. We just need to establish *z*. The age of the Moon at 00:00 UTC on 1 Jan 2000 was 23.882 days, so *z* is 20.882 or about 21. Or more conveniently, about 22, so we can replace *z*+(*Y* x 11) with ((*Y*+2)x 11), and that’s the formula. There are enough approximations here that one can justifiably worry about their accumulating to large errors, but in fact they tend to cancel out. (1 day per month is nearly exact, modulo 30 arithmetic gives you age increases that are too small, 11 days per year gives you age increases that are too large for non leap years and too small for leap years, *z*=22 means you start out the cycle with an age that’s too large. Sticking with *z*=21 would have made 1 Jan 2000 more accurate but would have led to too large errors later in the cycle.)