## Hannah and her sweets

Apparently students in the UK have been protesting against the following question on a GCSE math exam (see e. g. coverage at The Guardian):

There are n sweets in a bag. Six of the sweets are orange. The rest of the sweets are yellow. Hannah takes a random sweet from the bag. She eats the sweet. Hannah then takes at random another sweet from the bag. She eats the sweet. The probability that Hannah eats two orange sweets is 1/3. Show that n²-n-90=0.

The probability that the first sweet is orange is $6/n$. Now there are five orange sweets left out of $n-1$, so the probability that the second sweet is orange, assuming that the first one is, is $5/(n-1)$. Therefore we need to solve $(6/n) \times (5/(n-1)) = 1/3$. Multiplying it out gives

${30 \over n(n-1)} = {1 \over 3}$

and we can easily rearrange to get $90 = n(n-1)$. So $n = 10$; there are 10 sweets. (I guarantee you that a bunch of students went straight for the quadratic formula at this point – but you don’t have to, it’s easy to find two consecutive numbers that multiply to 90.) According to the BBC, setters of the exam point out that this was supposed to be one of the more difficult questions, “targeted at students aiming for A and A* grades”.

There’s a question this reminds me of, of which I don’t recall the original source: there are r raspberry sweets and b blueberry sweets in a bag. You take two of them at random; the probability that they have the same flavor is exactly 1/2. What are possible values for r and b? (Okay, so I’ve heard it with “red” and “blue”, but let’s go with fruit flavors.) (Okay, so I’ve heard it with “red” and “blue”, but let’s go with fruit flavors.) See for example this Quora question. This one is a bit trickier, and depends on getting lucky and choosing the right parametrization of the problem. If the number of reds/raspberries is $r$ and the number of blue(berries) is $b$, then we have

${r \over r+b} {r-1 \over r+b-1} + {b \over r+b} {b-1 \over r+b-1} = {1 \over 2};$

the first term is the probability of drawing red-red and the second is the probability of drawing blue-blue. We can rewrite as

$2(r(r-1) + b(b-1)) = (r+b)(r+b-1)$

but that isn’t much of a help, to be honest. Solving for $r$ in terms of $b$ gives

$r = {1 \over 2} \left( 2b \pm \sqrt{8b+1} + 1 \right)$
and if you happen to know the obscure piece of trivia that for integer $b$, $8b+1$ is a perfect square if and only if $b$ is triangular, then you can show that $r$ and $b$ must be two consecutive triangular numbers. For example $b = 15$ leads to the solutions $r = 21$ and $r = 10$.

But if you use n = r + b, then is as pointed out at the Quora answer, $r = (n \pm \sqrt{n})/2$ (with different notation) and this doesn’t require knowing anything obscure. Setting $n = 36$ leads immediately to the solutions $r = 21, r = 15$, for example. In general, to make this work out the number of sweets needs to be a perfect square.

What if there are three colors of sweets? How can we choose the number of sweets of each color to make the probability of getting a match equal to one-third?

Posted in Uncategorized | 6 Comments

## The most mathematical flag: Nepal

Do you like geometrical constructions? Then you should like the flag of Nepal, which is the only non-rectangular flag of a nation, is actually defined by a Euclidean ruler and compass construction in their constitution. See a step by step drawing of the construction or this video from Numberphile.

The flag of the state of Ohio is also non-rectangular, but sadly their laws only describe it as “burgee-shaped”.  It might be possible to extract a construction from the picture in this brochure from the Ohio secretary of state, but it looks like many of the points are specified but their position in a larger rectangle. Ohio’s flag is analytic geometry; Nepal’s is synthetic.

Posted in Uncategorized | 5 Comments

## Today in p-values

From Nature, by Jeffrey T. Leek and Roger D. Peng : p-values are just the tip of the iceberg (that is, of ways statistics are misused). Here’s Leek’s post at Simply Statistics giving some examples of subcultures of data analysis.

Andrew Gelman also posted today on good, mediocre, and bad p-values, quoting an article he wrote in 2012, P-values and statistical practice.

Posted in Uncategorized | 10 Comments

## Stark and Freishtat on course evaluations

Philip Stark (UC Berkeley statistics) and Richard Freishtat (UC Berkeley Center for Teaching and Learning, which supports undergraduate education) have written An evaluation of course evaluations.

Stark and Freishtat observe, among other things:

• that nonresponse bias is a serious problem;
•  that averaging ordinal variables doesn’t make sense (are a 3 and a 7 on a seven-point scale the same as two 5s?);
•  that students can more effectively comment on some aspects of pedagogy than others;
• That student evaluations are influenced by student grade expectations, and by instructor gender, age, ethnicity, and attractiveness…

If anybody should know how hard measurement is, it’s statisticians.

With this in mind, I’m amused to remember that when I was there, teaching evaluation averages by instructor and course were actually posted on a bulletin board, with other information relevant to students, outside the departmental office on the third floor of Evans Hall.  Apparently the department has a more “holistic” procedure in place now for evaluating teaching; I was not at Berkeley long enough to comment on the old process.  (Two academic years, as a lecturer.)

To be honest, I often found student comments more useful than grades – but it is difficult to read those comments.  The format of the evaluations and the fact that they’re usually given at the end of a class period seems designed to discourage thorough comments (and Stark and Freishtat point out that comments in evaluations of technical courses tend to be less discursive). And the most critical comments tend to stick in one’s craw, which is only human nature.

Posted in Uncategorized | 1 Comment

## Coo, shiver my sceptre!

A couple weeks ago James Grime linked on Twitter to a puzzle in the January 8, 1981 issue of New Scientist, which runs as follows:

“Beauty? Courage? Generosity? Patience? Wisdom? Which do you wish for the new-born Princess?” asked the Good Fairy.

“Beauty and Wisdom will do nicely, thank you,” replied the King, not wanting to seem greedy.

“Wait! For each gift you name, I shall bestow on her two of the other gifts instead. Each name of a gift triggers a different pair. Each gift is triggered by two of the names. But if you mention both names, they cancel out and she will not get that gift at all.”

“Coo, shiver my sceptre!” exclaimed His Majesty.

“Quite simple! For instance if you ask for Beauty and Courage, she will receive Generosity and Patience. If you ask for Beauty, Generosity and Patience, she will receive those three and Wisdom too. You in fact wished for Beauty and Wisdom. She shall have them, provided you ask for them in the simplest way.”

So we can associate each of the five gifts — let’s denote them by $B, C, G, P, W$ — with two of the others. Let’s denote this by $f(B) = X + Y$, for example, where $X$ and $Y$ are the two gifts triggered by $B$. So what we know is

$f(B) + f(C) = G + P$

and

$f(B) + f(G) + f(P) = B + G + P + W.$

Formally, $B, C, G, P, W$ are generators of $(\mathbb{Z}/2\mathbb{Z})^5$; informally they’re symbols that when added to themselves cancel out. Now, this function $f$ is a homomorphism from $(\mathbb{Z}/2\mathbb{Z})^5$ to itself – that is, $f(x+y) = f(x) + f(y)$. (This means we can do the cancelling either before or after translating from the language of what was wished for to what actually happens.) So therefore we know

$f(B+C) = G+P, f(B+G+P) = B+G+P+W$.

$f(C+G+P) = B+W$

which gives a way to get both beauty and wisdom — namely, asking for courage, generosity, and patience.

But what’s $f(B+C+G+P+W)$ — that is, what do you get if you ask for everything? We have that “each name of a gift triggers a different pair, and each gift is triggered by two of the names”. So we have
$f(B+C+G+P+W) = 2B+2C+2G+2P+2W$
since each gift is triggered twice. And the right-hand side there is just zero. So
$f(B+C+G+P+W) = 0$
and we can rewrite this:
$f((C+G+P) + (B+W)) = 0.$
But since $f$ is a homomorphism that’s just
$f(C+G+P) + f(B+W) = 0$
which is another way of saying $f(C+G+P) = f(B+W)$. So in fact $f(B+W) = B+W$ — that is, to get beauty and wisdom, just ask for them.

To see that this is the simplest possible solution, we need to show that no single gift triggers both beauty and wisdom. I can’t come up with a “clean” way to do this, but we can go brute force. Beauty must trigger wisdom, wisdom must trigger beauty, and beauty and wisdom both trigger the same other gift. This gift can’t be courage – if it were, then we’d have $f(B) = W+C$, but we know $f(B+C) = G+P$, so adding these we’d have $f(C) = W+C+G+P$, which is impossible. So the “other” gift is either generosity or patience. Repeatedly applying the constraints that every gift can occur twice and the facts we already know, those lead to the solutions

$f(B) = W+G, f(C) = W+P , f(G) = C+P, f(P) = B+C, f(W) = B+G$

and

$f(B) = W+P, f(C) = W+G, f(G) = B+C, f(P) = C+G, f(W) = B+P$

respectively, which differ by exchanging $G$ and $P$ wherever they appear. In no case is there a single gift $X$ with $f(X) = B+W$, so the solution $f(B+W) = B+W$ is indeed the simplest one.

Note: Jim Randell has been doing programmatic solutions to these puzzles for quite a while now.

Posted in Uncategorized | 2 Comments

## Help with social science about science

Perhaps of interest to many of my readers: Melanie Sinche, a career counselor and consultant, and research associate at Harvard Law’s Labor and Worklife Program, is working on a study of the career paths of PhD receipients in the sciences.  If you:

– Earned a PhD in any of the physical, computational, social, life sciences or engineering between 2004 and 2014

– Has ever worked, trained, or studied in the U.S.

then you should fill out this survey and help to paint a more accurate picture of what PhD recipients actually do.

Edited, April 16: turns out I forgot to link to the actual survey.

(H/T Tamara Broderick)

Posted in Uncategorized | 2 Comments

## Various computations of the odds of a perfect March Madness bracket

Joseph Nebus has written a series of posts on the entropy in basketball results: for a single team, for both teams, in the win-loss results for a 64-team tournament like March Madness. For the final question he gets an answer of about 48 bits. That is, the probability of guessing the winners and losers of a tournament correctly is on the order of 248.

From blind guessing one gets 1 in 263, quoted for example in this USA Today story, with the caveat that:

Even so, allowing for some knowledge of college basketball and taking it account the norms of the NCAA tournament, the odds of a perfect bracket are still about 1 in 128 billion, according to DePaul math professor Jay Bergen.

This refers to Jeff Bergen’s video, “where does 1 in 128 billion come from”. Note 128 billion is roughly 237. Bergen’s strategy is to assume that the top seeds always win, since this is the most likely outcome.

The fact that two reasonable people gave two such different answers is an example of just how hard it is to estimate small probabilities. But both of these models gave up on using empirical data after the first round. Yet matchups between the “favorite” seeds should happen fairly often, and there will be data! Let’s look at win probabilities by seed as compiled at mcubed.net. In a tournament where all the favorites win, we’ll have:

• in the first round, four matches of 1 vs. 16, 2 vs. 15, …, 8 vs. 9, one in each region
• four matches of 1 vs. 8, 2 vs. 7, 3 vs. 6, 4 vs. 5, one in each region
• four matches of 1 vs. 4, 2 vs. 3, one in each region
• four matches of 1 vs. 2, one in each region
• three matches of 1 vs. 1, from different regions, of course

Historically, 1 seeds are 124-0 against 16 seeds, 2 seeds are 117-7 against 15 seeds, and so on until 8 seeds are 79-69 against 9 seeds. So the probability of picking all eight first-round games in one region perfectly is

$(124/124)(117/124)(104/124)(99/123)(97/144)(95/144)(90/148)(79/148) = 0.09188$

and the probability of getting all 32 first-round games right is the fourth power of this, about $7.12 \times 10^{-5}$ or one in 14,000. (The different denominators correspond to different numbers of times each matchup has occurred, presumably due to changes in the tournament structure; the 64-team field only dates back to 1985. Oddly enough, the Washington Post reports that nobody ever seems to pick a perfect first round. This isn’t a contradiction – nobody is boring enough to pick the strategy with the highest expected value for that bet, when the bet most people are interested in is trying to win their pool.

The probability of picking a perfect second round in any given region is $(65/81)(64/88)(46/84)(49/88) = 0.17796$; for all four regions it’s the fourth power of this, about $1.00 \times 10^{-3}$.

The third round in each region consists of a 1-vs-4 game and a 2-vs-3 game, where the favorites win with probability 46/68 and 36/59 respectively; the probability of picking all eight third round games correctly is $((46/68)(36/59))^4 = 0.0290$.

The fourth round in each region is a 1-vs-2 game, where the 1 seed has historically won with probability 38/69; the probability of picking all four correctly is $(38/69)^4 = 0.0919$.

Finally, the probability of picking all three Final Four games correctly is 1/8 – the model knows nothing beyond seeding.

Multiplying this all out, I get that the probability of picking all 63 games correctly is

$(7.12 \times 10^{-5}) (1.00 \times 10^{-3}) (0.0290) (0.0919) (1/8) = 2.38 \times 10^{-11}$

or about one in 42 billion, in a generic tournament. For what it’s worth, FiveThirtyEight gave 1 in 1.6 billion this year and 1 in 7.4 billion last year, using a model that actually knew something about basketball.

Posted in Uncategorized | 2 Comments