In class today, I said approximately this:
So people decide whether to have children by flipping a coin, and if it comes up tails they have a kid, and if it comes up heads they don't. They repeat this until it comes up heads. This is probably not a good model of how people decide whether or not to have children, but maybe it's good in the aggregate. And anyway this isn't a class about how people decide whether to have kids.
Then there are two kinds of children, girls and boys -- well, not always, but this isn't a class about that -- and each child is equally likely to be a boy or a girl -- well, wait, that's not exactly true, but it's not a horrible assumption about how reproduction works on a cellular level, but this isn't a class about that either.
And people's decisions to stop having kids is independent of the sex of the children they've had -- which says this isn't China, because people do interesting things under the one-child policy -- but this isn't a class about that.
(Then I actually did some math -- namely, assume that the number of children a random family has is geometrically distributed with some parameter p, and assume that all children are equally likely to be male or female and that their genders are independent of the gender of any other children or the number of children in the family. Pick a random family with no boys. What is the distribution of the number of children they have?)
16 November 2011
11 November 2011
11/11/11
You may have heard that it's 11/11/11. (Or, if you live in the UK, 11/11/11.) When I was growing up, I'd get confused and think that World War II ended on this day, one hundred years ago. You know, at the eleventh hour of the eleventh day of the eleventh month of the eleventh year.
The New York Times says that marketers are viewing this as a singular event -- but they went on about this four years, four months, and four days ago.
The Corduroy Appreciation Club says it is Corduroy Appreciation Day.
A bit more mathematically, you can watch a video about the number eleven by James Grime, which appears to be the first of a series of Numberphile videos.
Edited, November 12, 12:29 pm: from the New York Times, a hundred years ago: "To-day it is possible to write the date with the repetition six times of a single digit." The article also points out that a digit will probably never occur again seven times in the date -- we'd have to make it to November 11, 10011 for that to happen.
The New York Times says that marketers are viewing this as a singular event -- but they went on about this four years, four months, and four days ago.
The Corduroy Appreciation Club says it is Corduroy Appreciation Day.
A bit more mathematically, you can watch a video about the number eleven by James Grime, which appears to be the first of a series of Numberphile videos.
Edited, November 12, 12:29 pm: from the New York Times, a hundred years ago: "To-day it is possible to write the date with the repetition six times of a single digit." The article also points out that a digit will probably never occur again seven times in the date -- we'd have to make it to November 11, 10011 for that to happen.
09 November 2011
Small sample sizes lead to high margins of error, unemployment version
The ten college majors with the lowest unemployment rates, from yahoo.com. I've heard about this from a friend who majored in astronomy and a friend who majored in geology; both of these are on the list, with an unemployment rate of zero.
The unemployment rates of the ten majors they list are 0, 0, 0, 0, 0, 0, 1.3, 1.4, 1.6, and 2.2 percent.
I would bet that the six zeroes are just the majors for which there were no unemployed people in the sample. The data apparently comes from the Georgetown Center on Education and the Workforce; there's a summary table at the Wall Street Journal, and indeed the majors which have zero unemployment are among the least popular. Just eyeballing the data, some of the majors with the highest unemployment are also among the least popular. The red flag here would be, say, an unemployment rate of 16.7% (one out of six) or 20.0% (one out of five) for some major near the bottom of the popularity table, but I don't see it; I guess their sample is big enough that no major is that small, or maybe they actually made some adjustments for this issue.
The actual Georgetown report seems to be available here but I am having trouble viewing it.
In case you were wondering, mathematics is the 28th most popular major (of 173) and has 5.0% unemployment; "statistics and decision science" is 128th most popular and has 6.9% unemployment, which seems to go against the popular wisdom these days that statistics majors are more employable than math majors. (But I work in a statistics department, so my view of the popular wisdom may be biased.)
The unemployment rates of the ten majors they list are 0, 0, 0, 0, 0, 0, 1.3, 1.4, 1.6, and 2.2 percent.
I would bet that the six zeroes are just the majors for which there were no unemployed people in the sample. The data apparently comes from the Georgetown Center on Education and the Workforce; there's a summary table at the Wall Street Journal, and indeed the majors which have zero unemployment are among the least popular. Just eyeballing the data, some of the majors with the highest unemployment are also among the least popular. The red flag here would be, say, an unemployment rate of 16.7% (one out of six) or 20.0% (one out of five) for some major near the bottom of the popularity table, but I don't see it; I guess their sample is big enough that no major is that small, or maybe they actually made some adjustments for this issue.
The actual Georgetown report seems to be available here but I am having trouble viewing it.
In case you were wondering, mathematics is the 28th most popular major (of 173) and has 5.0% unemployment; "statistics and decision science" is 128th most popular and has 6.9% unemployment, which seems to go against the popular wisdom these days that statistics majors are more employable than math majors. (But I work in a statistics department, so my view of the popular wisdom may be biased.)
06 October 2011
Solution to a puzzle from a few months ago
I never posted a solution to this puzzle, and today one of my students asked me about it.
The puzzle was to find all three-digit numbers that, when multiplied by their successor, give a number concatenated with itself.
So of course when you concatenate a three-digit number x with itself, you get 1001x. So the question becomes: when is k(k+1) a multiple of 1001?
1001 is 7 times 11 times 13. k and k+1 have no prime factors in common, so we have to have that some subset of 7, 11, and 13 are prime factors of k, and the rest are prime factors of k + 1. Furthermore these are going to be proper subsets; if we have that 7, 11, and 13 are prime factors of k and none of those are prime factors of k+1, or vice versa, then we get that k doesn't in fact have three digits.
So we can have the following six situations:
(1) k is a multiple of 7 and k + 1 is a multiple of 143;
(2) k is a multiple of 11 and k + 1 is a multiple of 91;
(3) k is a multiple of 13 and k + 1 is a multiple of 77;
(4) k is a multiple of 77 and k + 1 is a multiple of 13;
(5) k is a multiple of 91 and k + 1 is a multiple of 11;
(6) k is a multiple of 143 and k + 1 is a multiple of 7.
In each case we can then use the Chinese remainder theorem to find k. Let's consider the first case: we have that k ≡ 0 (mod 7), k ≡ -1 (mod 11), k ≡ -1 (mod 13).
The CRT tells us that the solution to the system of congruences
k ≡ a7 (mod 7), k ≡ a11 (mod 11), k ≡ a13 (mod 13)
is
k ≡ a7(143)(143-1)7 + a11(91)(91-1)11 + a13 (77)(77-1)13 (mod 1001)
where I'm using (a-1)b to stand for the inverse of a mod b. The other solutions differ from this by multiples of 1001. We can find the inverses by brute force:
(143-1)7 = (3-1)7 = 5, (91-1)11 = (3-1)11 = 4, (77-1)13 = (12-1)13 = 12.
So we finally get
k ≡ 715 a7 + 364 a11 + 924 a13 (mod 1001).
Now, the case (1) corresponds to a7 = 0, a11 = -1, a13 = -1; so we get
k ≡ 0 - 364 - 924 (mod 1001)
and so we get the solution k = -364 - 924 + (2)(1001) = 714. Indeed (714)(715) = 510510. (714 and 715 are a Ruth-Aaron pair.) The other five situations lead to, respectively, k = 363, 923, 77, 637, 286 and k(k+1) = 132132, 852852, 6006, 406406, 82082.
The puzzle was to find all three-digit numbers that, when multiplied by their successor, give a number concatenated with itself.
So of course when you concatenate a three-digit number x with itself, you get 1001x. So the question becomes: when is k(k+1) a multiple of 1001?
1001 is 7 times 11 times 13. k and k+1 have no prime factors in common, so we have to have that some subset of 7, 11, and 13 are prime factors of k, and the rest are prime factors of k + 1. Furthermore these are going to be proper subsets; if we have that 7, 11, and 13 are prime factors of k and none of those are prime factors of k+1, or vice versa, then we get that k doesn't in fact have three digits.
So we can have the following six situations:
(1) k is a multiple of 7 and k + 1 is a multiple of 143;
(2) k is a multiple of 11 and k + 1 is a multiple of 91;
(3) k is a multiple of 13 and k + 1 is a multiple of 77;
(4) k is a multiple of 77 and k + 1 is a multiple of 13;
(5) k is a multiple of 91 and k + 1 is a multiple of 11;
(6) k is a multiple of 143 and k + 1 is a multiple of 7.
In each case we can then use the Chinese remainder theorem to find k. Let's consider the first case: we have that k ≡ 0 (mod 7), k ≡ -1 (mod 11), k ≡ -1 (mod 13).
The CRT tells us that the solution to the system of congruences
k ≡ a7 (mod 7), k ≡ a11 (mod 11), k ≡ a13 (mod 13)
is
k ≡ a7(143)(143-1)7 + a11(91)(91-1)11 + a13 (77)(77-1)13 (mod 1001)
where I'm using (a-1)b to stand for the inverse of a mod b. The other solutions differ from this by multiples of 1001. We can find the inverses by brute force:
(143-1)7 = (3-1)7 = 5, (91-1)11 = (3-1)11 = 4, (77-1)13 = (12-1)13 = 12.
So we finally get
k ≡ 715 a7 + 364 a11 + 924 a13 (mod 1001).
Now, the case (1) corresponds to a7 = 0, a11 = -1, a13 = -1; so we get
k ≡ 0 - 364 - 924 (mod 1001)
and so we get the solution k = -364 - 924 + (2)(1001) = 714. Indeed (714)(715) = 510510. (714 and 715 are a Ruth-Aaron pair.) The other five situations lead to, respectively, k = 363, 923, 77, 637, 286 and k(k+1) = 132132, 852852, 6006, 406406, 82082.
Labels:
chinese remainder theorem,
number theory,
puzzle
20 September 2011
Using generating functions to prove that the only sequences which are their own sequence of running averages are the constant sequences
Here's a problem that occurred to me yesterday: consider a sequence of real numbers a0, a1, a2, ... . Let bk = (a0 + a1 + ... + ak)/(k+1) be the average of the first (k+1) of the ai. When is a sequence equal to its own sequence of averages? That is, if we see a bunch of numbers, when is it true that every number we see is the average of all the numbers we've seen so far?
Of course the answer is the constant sequences. But can we prove this using generating functions?
It turns out we can. If we have
f(z) = a0 + a1 z + a2 z2 + ...
then
f(z)/(1-z) = a0 + (a0 + a1)z + (a0 + a1 + a2) z^2 + ... = b0 + 2b1 z + 3b2 z^2 + ...
and let's call the right-hand side here g(z). What can we do to g(z) to transform it into
h(z) = b0 + b1 z + b2 z2 + ... ?
Well, a linear operator that takes the function (of z) zk to the function (of z) zk/(k+1) could be applied to g in order to get h. Clearly this is related to integration. In fact the operator
I φ(z) = (1/z) ∫0z φ(s) ds
does the trick. So we have
h(z) = I g(z) = (1/z) ∫0z f(s)/(1-s) ds.
But remember that we wanted the generating function h of the averages to be just the generating function f of the original sequence. So this gives
f(z) = (1/z) ∫0z f(s)/(1-s) ds
and this is in fact a differential equation. Multiply through by z and differentiate both sides to get
z f'(z) + f(z) = f(z)/(1-z).
A bit of rearranging gives
f'(z)/f(z) = 1/(1-z)
and we recognize that the left-hand side is the derivative of log f(z). Integrating both sides gives
log f(z) = log(1-z) + C
where C is a constant of integration, and finally we get f(z) = eC/(1-z). But this is just the generating function of a constant sequence.
Of course the answer is the constant sequences. But can we prove this using generating functions?
It turns out we can. If we have
f(z) = a0 + a1 z + a2 z2 + ...
then
f(z)/(1-z) = a0 + (a0 + a1)z + (a0 + a1 + a2) z^2 + ... = b0 + 2b1 z + 3b2 z^2 + ...
and let's call the right-hand side here g(z). What can we do to g(z) to transform it into
h(z) = b0 + b1 z + b2 z2 + ... ?
Well, a linear operator that takes the function (of z) zk to the function (of z) zk/(k+1) could be applied to g in order to get h. Clearly this is related to integration. In fact the operator
I φ(z) = (1/z) ∫0z φ(s) ds
does the trick. So we have
h(z) = I g(z) = (1/z) ∫0z f(s)/(1-s) ds.
But remember that we wanted the generating function h of the averages to be just the generating function f of the original sequence. So this gives
f(z) = (1/z) ∫0z f(s)/(1-s) ds
and this is in fact a differential equation. Multiply through by z and differentiate both sides to get
z f'(z) + f(z) = f(z)/(1-z).
A bit of rearranging gives
f'(z)/f(z) = 1/(1-z)
and we recognize that the left-hand side is the derivative of log f(z). Integrating both sides gives
log f(z) = log(1-z) + C
where C is a constant of integration, and finally we get f(z) = eC/(1-z). But this is just the generating function of a constant sequence.
13 September 2011
The quadratic equation, Dr. Seuss style
I've been busy, but here's a quick one: The quadratic equation, Dr. Seuss style, by Katie Benedetto. My favorite stanza:
This is the antidote to if the IRS had discovered the quadratic formula.
Each value there was, well she renamed each one
Claiming that nice names would make this more fun.
“Variables, well, they’re whatever we wish
So like one, two, red, blue, I’ll call this one “fish”!
This is the antidote to if the IRS had discovered the quadratic formula.
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.)
(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.)
Subscribe to:
Posts (Atom)