19 August 2011

Some thoughts on the mathematics of tax withholding

Here's a question of some practical importance: let's say that I make $2,000 in each of the first six months of the year, and $4,000 in each of the second six months. Will I have more or less tax withheld than if I make $3,000 every month?

(This is inspired by the fact that I taught this summer, and was paid for doing so, but because of the way my contract is written, my pay for the academic year is spread out over twelve months. As a result I got extra-large paychecks over the summer, partially for the work I was doing in the summer and partially for work that I had already done in the previous academic year or will be doing in the next academic year.)

For those not familiar with the US tax system: if your net pay is X you don't get a check for X, but for some smaller amount, because various taxes are withheld. Chief among these is the federal income tax. Now, the federal income tax is not a flat tax, but a progressive tax -- if your income is higher then you pay a larger percentage of your income in tax. Tax returns have to be filled out on a yearly basis, but most people get paid more often than yearly. So the amount of tax withheld is determined, based on the amount of the paycheck and the period that the paycheck is for, in such a way that the total amount of tax withheld is somewhere near the amount that you're expected to owe. (Most Americans actually end up overpaying through this system, and get a small refund back at tax-filing time.)

So say that if you make 36x per year, then your taxes will be f(36x). Then you'd expect that if you make 3x in a given month, you will have f(36x)/12 withheld, for a total of f(36x) over the course of the year.. If instead you make 2x in each of six months and 4x in each of six months, then in each of the months in which you make 2x tax will be withheld as if you make 24x per year, and in each month in which you make 4x tax will be withheld as if you make 48x per year. So total withholding will be

6f(24x)/12 + 6f(48x)/12

or, simplifying, [f(24x) + f(48x)]/2. Call this T'. Is this less than or greater than f(36x), which we'll call T?

We can easily see that T' ≥ T if and only if

f(48x)-f(36x) ≥ f(36x) - f(24x).

That is, T' ≥ T if and only if the amount of extra tax owed when you go from $36,000 to $48,000 is more than the extra amount owed when you go from $24,000 to $36,000. But since marginal tax rates are increasing -- since the tax is progressive -- this is true.

More generally, given progressive taxation, withholding is smallest for a given annual income if that income is spread out exactly evenly throughout the year. This is a consequence of Jensen's inequality. The more unevenly spread out the earnings are, the more money will be withheld.

In reality this is slightly more complicated because there are tax brackets, which are reflected in the withholding formulas, so f is actually piecewise linear (see page 36 of this IRS publication). For example, a single person paid between $883 and $3,050 per month (after subtracting withholding allowances) will have $70.80 + .15(x-$883) withheld from a paycheck of x; a single person paid between $3,050 and $7,142 will have $395.85 + .25(x-$3050) withheld. (Note that putting $3,050 into either of these formulas gives $395.85; the amount withheld is a continuous function of the amount earned.) So if every paycheck is under $3,050, or if every paycheck is over $3,050, then the amount withheld ends up being the same no matter how the pay is distributed. But a person who makes, say, $3,000 in each of two months will have $388.35 withheld from each, for a total of $766.70; a person who makes $2,000 in one month and $4,000 in another will have $238.35 withheld from the first and $633.35 withheld from the second, for a total of $871.70 withheld.

I had known all this intuitively before this afternoon but I'd never bothered to actually write down why it is...

This all applies to people who make varying amounts in differing pay periods from a single job. People who have multiple jobs can be burnt in the withholding process because we have progressive taxation; if you make x in each of two jobs you have less withheld than if you make 2x in a single job. If that's you, be careful.

(I'm not an accountant. None of this should be taken as financial advice.)

16 August 2011

God tweets about playing dice

There's a book coming out in November, The Last Testament: A Memoir by God. "God" tweets at TheTweetOfGod, and "He" just twote:
Do you ever lose when you play cards?" Remember Einstein! I play not cards, but dice. And I never lose. The dice are loaded. And so am I.
There you have it, folks. The title of this blog is correct.

14 August 2011


The number 8,675,309 is the title of a song. It is also a prime number, and as far as I can tell, it's the largest prime number to appear in a song title. According to this list of songs with numbers in the title from Wikipedia (which is currently in the "Wikilists" space because it was deleted from mainstream Wikipedia, larger numbers in song titles are: 9 million, 30 million, 93 million, 100 million, 1 billion, 1 trillion, 1 quadrillion, 1 googolplex, infinity minus one, and infinity.

I'm not surprised to see that most of these are "round numbers", simply because they're easier to say; in particular by inspection they are not prime, since they're all multiples of large powers of 10. But I'm wondering if anybody out there has written a song titled, say, "six billion and one".

(No fair going out and writing such a song.)

12 August 2011

A puzzle about splitting up numbers into groups

A puzzle from David Radcliffe: "Split {1,2,...,16} into two groups of the same size having equal sums, equal sums of squares, and equal sums of cubes."

Solution: one group is A, D, E, G, J, K, M, P; the other is B, C, E, H, I, L, N, O. (I've replaced each number with the corresponding letter of the English alphabet to obscure things a bit.)

Here's how I found this. It's often useful to look at cubes mod 9, because any cube of an integer is either a multiple of 9, one less than a multiple of 9, or one more than a multiple of 9. These cases correspond to the integer itself being a multiple of 3, one less than a multiple of 3, or one more than a multiple of 3. So 13 + 23 + 33 is a multiple of 9; so are 43 + 53 + 63, ..., 133 + 143 + 153. Since 163 is one more than a multiple of 9, so is the sum of the first sixteen cubes, which we'll call N.

We want to find eight integers in 1, ..., 16 that have sum of cubes equal to N/2. Now, if N is congruent to 1 mod 9, then N/2 is congruent to 5 mod 9. This means it's relatively far from a multiple of 9, so a lot of the numbers that are one more than a multiple of 9 are going to have to go into the same group. In particular, each group must contain either five more 1 mod 3 than 2 mod 3 integers, or four more 1 mod 3 than 2 mod 3 integers. Keeping in mind the limited supplies -- we only have six integers in our set congruent to 1 mod 3, and five each congruent to 0 and 2 mod 3, the only possible groups are:

≅ 0 (mod 3)≅ 1 (mod 3)≅ 2 (mod 3)

Furthermore we either have a group of the type given in the first row and one of the type given in the fourth row, or one of the second-row type and one of the third-row type, in order to meet the supply restrictions.

But it's not possible to have a group of the first-row type and a group of the fourth-row type. Let's consider a group of the fourth-row type -- that is, it has two multiples of three, one number that's one more than a multiple of three, and five that are one less than a multiple of three. The five that are one less than a multiple of three must be 2, 5, 8, 11, and 14. The square of each of these is one more than a multiple of three, so 22 + 52 + 82 + 112 + 142 is congruent to 2 mod 3. Call the other three members of this group x, y, and z. From the table above, two of these are multiples of 3.

But the square of every integer is either 0 mod 3 (if it's a multiple of 3) or 1 mod 3 (if it's not a multiple of 3) and so the sum of the first sixteen squares is 2 mod 3. So each group must have sum of squares congruent to 1 mod 3. The five integers that we've already put in the group have squares summing to 2 mod 3; thus x2 + y2 + z2 is also 2 mod 3, contradicting the fact that exactly one of x, y, and z is not a multiple of 3.

So we must have groups of the type in the second row and of the type in the third row. Let's look at the group of the second-row type. It contains all six integers in {1, 2, ..., 16} congruent to 1 mod 3 -- that's 1, 4, 7, 10, 13, and 16. By symmetry the other two elements -- call them t and u -- must sum to 17. Furthermore the sum of the first 16 squares is (16)(16+1)(2×16+1)/6 = 1496; so the sums of the squares in each group must be 1496/2 = 748. 12+42+72+102+132+162 = 591 and so we must have t2 + u2 = 748 - 591 = 157. So we need two integers that sum to 17, with squares summing to 157; solve the quadratic t2 + (17-t)2 = 157 to get t = 6 or t = 11, and correspondingly u = 11 or u = 6.

So if there's any way at all to do what we were asked, it's with one group being 1, 4, 6, 7, 10, 11, 13, 16 -- and this checks out.

Of course, it would be trivial to write a program to check this...

08 August 2011

Dimensional analysis for gravity trains

A surprising fact: drill a straight tunnel through the earth, between any two points. Drop a burrito in at one end. Assuming that you could actually build the tunnel, and that there's no friction, the burrito comes out the other end in 42 minutes. This is called a gravity train and it's not hard to prove (the version I link to is due to Alexandre Eremenko of Purdue) that the time it takes the burrito to get from one end to the other is (3π/4)-1/2 (G ρ)-1/2, where G is the gravitational constant and ρ is the density of the Earth. Alternatively this can be written as (r3/Gm)1/2, where r is the radius of the earth and m its mass.

Everyone's so surprised, when they see this, that the time doesn't depend on the distance between the two points! And this is interesting, but as a result you don't see the more subtle fact that the time doesn't depend on the size of the planet. If I make a super-Earth that is twice the radius but made of the same stuff, so it's eight times as massive, then the density stays the same. Somewhat surprisingly you can see this using dimensional analysis. It's "obvious" that this time, if it exists, can only depend on the mass of the earth, the radius of the earth, and the gravitational constant. The mass of the earth, m, has dimension M; the radius, r, has dimension L; the gravitational constant has dimension L3 M-1 T-2. The only combination mα rβ Gγ that has units of time is G-1/2 m-1/2 r3/2.

Of course I'm making a big assumption there -- that the constant time "42 minutes" is actually a constant! It seems perfectly reasonable that it could depend on the distance between the two termini. I'll handwave that away by saying that it depends on the angle formed by the two termini and the center of the earth. And angles are of course dimensionless.

(The Alameda-Weehawken burrito tunnel, being non-fictional, uses magnets to accelerate and decelerate the foil-wrapper burritos and takes 64 minutes instead of the theoretical 42.)

03 August 2011

Give your money to Samuel Hansen's math kickstarter!

Alright, folks. You should give some money to Samuel Hansen's Kickstarter project Relatively Prime: Stories from the Mathematical Domain. This is what it sounds like -- Samuel will tell eight hours' worth of stories about mathematics. Samuel is perhaps the world's most accomplished mathematical podcaster -- or at least the most prolific --- and is the force behind Combinations and Permutations (sort of a mathematical comedy podcast), Strongly Connected Components (interviews with mathematicians), and Math/Maths with Peter Rowlett. Here's Samuel's blurb about the project:

Relatively Prime will be an 8 episode audio podcast featuring stories from the world of mathematics. Tackling questions like: is it true that you are only 7 seven handshakes from the President, what exactly is a micromort, and how did 39 people commenting on a blog manage to prove a deep theorem. Relatively Prime will feature interviews with leaders of mathematics, as well as the unsung foot soldiers that push the mathematical machine forward. With each episode structured around topics such as: The Shape of Things, Risk, and Calculus Wars, Relatively Prime will illuminate each area by delving into the history, applications, and people that underlie the subject that is the foundation of all science.

He needs $8,000 in pledges. With 12 hours to go (until 11:13 PM US Eastern Time tonight) he's got $7,115. The way Kickstarter works is that Samuel only gets any of the money if at least $8,000 gets pledged. So if

Maybe the puppets from Avenue Q will convince you, although they're raising money to found a Monsterssori school. But hey, they're both good causes. On some level storytelling is what all education is about.