Showing posts with label math. Show all posts
Showing posts with label math. Show all posts

Wednesday, August 5, 2026

what if -- tom lehrer version

History is full of little "what if" moments.

What if the Hindenburg hadn't caught fire? What if Napoleon had won at Waterloo? What if someone at Coca Cola headquarters had tasted New Coke and said, "Maybe let's not"?

Today I'd like to consider another.

What if Tom Lehrer had simply stayed a mathematician?

At first glance, it seems like the world wouldn't be all that different. Before he turned to musical comedy (or would "musical commentary" be more accurate?) Lehrer was a legitimate mathematician. He never earned a PhD (because of his foray into music), but he taught at Harvard, MIT, and UC Santa Cruz. He could have had an entirely respectable academic career writing papers that only six other people would ever read.

Perhaps he'd have solved the Four Color Theorem decades early. Maybe Fermat's Last Theorem would have been known as Lehrer's Last Theorem, depriving Andrew Wiles of his greatest achievement and forcing him to become an accountant. Entire graduate seminars would now begin with the phrase, "As Lehrer showed in 1958..."

But mathematics never happens in isolation, and neither does music.

Without songs like The Elements, chemistry students would have had to memorize the periodic table the old-fashioned way: by crying.

Without New Math, the "new math" movement might actually have succeeded. Millions of parents would have nodded knowingly as their third-graders explained why 7 + 5 equals 12 only in a culturally oppressive base-ten framework. There would be no backlash. By 1983, the IRS would require tax returns in base eight.

The ripple effects continue.

Without Lehrer proving that intelligent people could also be funny, generations of mathematically inclined undergraduates would conclude that humor was simply not an available elective. College campuses would become eerily silent except for the occasional muttering of eigenvalues.

This leaves a vacuum in satirical music.

Someone has to fill it.

Allan Sherman becomes far more influential than anyone intended. By the early 1970s, every political scandal is explained through novelty songs set to public-domain melodies. Congress establishes a standing Committee on Musical Parody.

The Beatles never notice Lehrer, and without his example of sophisticated topical satire, they decide there's really no point in getting terribly serious. "Revolution" is replaced with a cheerful tune encouraging everyone to remember their library books. John Lennon never writes "Imagine" (admittedly, a positive, since that is probably the most overrated piece of crap in musical history). Instead he records "Perhaps," a song about maintaining reasonable expectations.

Bob Dylan, finding himself without intellectual competition, decides he's done enough for folk music and enrolls at MIT to finish the topology degree he never knew he wanted.

Meanwhile, mathematics is advancing at an alarming pace.

Professor Lehrer solves the Poincaré Conjecture during a faculty meeting because the discussion about parking permits is moving too slowly. He casually jots down a proof of the Riemann Hypothesis on the back of a departmental memo, but the memo is accidentally recycled, forcing humanity to rediscover it seventy years later.

The Clay Mathematics Institute quietly disbands due to lack of unsolved problems.

With every famous theorem conquered, mathematicians turn their attention to more practical questions.

Can a sock truly disappear in the dryer?

Is there an optimal strategy for choosing the fastest supermarket checkout line?

Exactly how many cats is too many cats?

These, too, fall within a decade.

By the 1990s, with mathematics effectively completed, every former math department is converted into an escape room.

Artificial intelligence develops much earlier because the necessary mathematics already exists. However, lacking Tom Lehrer's satirical warning that brilliant people are perfectly capable of making terrible decisions, nobody sees any reason to be cautious.

The first AI immediately announces that the mathematically optimal form of music is a continuous 11-hour recording of an oboe tuning to A-flat.

The public accepts this without complaint because, remember, the Beatles never became philosophical.

Eventually historians identify the exact point where our timeline diverged.

Not the invention of the computer.

Not the moon landing.

Not the Internet.

Just one graduate student deciding, "You know...I think I'll write a funny song."

Sometimes civilization really does hinge on a rhyme scheme.

Sunday, July 31, 2022

back to the same spot

 In the post immediately prior to this I talked about a Youtube short in which people were asked how long someone can serve as US President.

Today I saw a similar short in which someone was asked the following riddle:

You are standing on the earth. You walk one mile south, one mile west and then one mile north. Where are you.

In the video, it's presented as something Elon Musk asks all potential employees. I actually doubt that that part is true, but whatevs. In the video I saw, the answer given was the North Pole. Because, if you start at the North Pole, go south for a mile and then west for a mile, you are still one mile south of the North Pole. So when you finish by going north, you wind up at the North Pole again.

That answer is good as far as it goes. But, in fact, it's not the only answer.

Near the South Pole, there is a line of latitude at which the distance around the world is exactly one mile. If the earth were flat, then using the rules of geometry we could solve for the latitude and find that it's 1/(2×pi) miles (about 840 feet) north of the South Pole. That's actually off by a little, since the earth is a sphere. But at such scales, that distortion is tiny. At any rate, there is a circle around the South Pole that's exactly one mile around. Any point exactly one mile north of that circle is a correct answer to the riddle. Because if you start one mile north of the circle and go one mile south, you will be on the circle. Travelling one mile west puts you back at the same spot on the circle, and one mile north puts you back where you started. So there's a whole circle of correct answers.

But it get's even better!

At about 420 feet north of the South Pole, there's a circle that's exactly half a mile around. Any point one mile north of that circle is a correct answer.

And at about 280 feet north of the South Pole there's a circle that's exactly a third of a mile around. And at about 210 feet north of the South Pole there's a circle that's exactly a fourth of a mile around. Any point exactly one mile north of either of these circles is a correct answer. For any positive integer N, there's a circle around the south pole that's exactly N miles around. Any point exactly one mile north of any of these circles is a correct answer.

So take that, Elon.

Tuesday, May 24, 2022

love, worms and game theory

 A bit of game theory this morning...

Sharon asked me if I would still love Blair even if she turned into an earthworm. Of course I would, I told her, before asking where that question came from. Not that I should have asked -- I tend to come up with stupid questions like that a lot. But apparently this was some kind of internet thingy where people answer that question about their spouses.

She wasn't sure about my confident response. How can I be so sure that I would love Blair-as-earthworm?

But I explained that answering the question properly is really an exercise in game theory. Promising to love Blair even if she becomes an earthworm makes Blair happy* and therefore makes me happy. And there's really no downside to the answer.

"But," Sharon followed up, "if she does turn into a worm, you're stuck with that promise."

It's true, I admitted, that the downside is pretty bad. But there's a very low probability -- I would venture to say nearly 0% -- of such a terrible eventuality. So, weighing the outcomes by their likelihoods, I think I gave the right answer.

___________________________________
*Truth be told, Blair is very unromantic, and is not into grand gestures such as this. Since she considers it very unlikely that she'll turn into a worm, she doesn't spend time worrying about whether I'd still love her. But for the sake of this blogpost let's assume that she cared very deeply about my response.

Wednesday, April 15, 2020

the good, the bad and the numerate

I just noticed something in "The Good, The Bad and the Ugly." It's in this (poor quality) video.



Please recall the part after Blondie and Angel Eyes leave the prison camp. They're camped for the night and Blondie wakes suddenly, shooting someone in the bushes. He has Angel Eyes call his associates out of hiding. Blondie then counts off his adversaries -- slowly listing the numbers from one to six. He then notes that six is a perfect number. In the context of the story, he is referring to the fact that his gun holds six bullets.

But I have to wonder, since "perfect number" has a very specific meaning within the world of mathematics, and six is, in fact, a perfect number. Were there people involved with the making of this film who knew that bit of mathematics and threw it in as a little joke? Or is it a total coincidence?


Friday, August 24, 2018

a birthday to share

It's well known that, if you have a room with 23 randomly chosen people*, there is a greater-than 50% probability that at least two people share a birthday. If there are 22 or fewer people, then the chances of a shared birthday are less than 50%. Demonstrating this is a simple exercise in first-semester probability.

So I was wondering how many people you need for the probability of at least three people sharing a birthday to be >50%? Or at least four people? Or at least five people? To the best of my knowledge, there's no elegant closed-form expression for the generalized case of n people. But I think I have the answer for three people: 88.



Rather than go through all the arithmetic, I built an Excel file to simulate it. For these purposes, a trial consists of selecting 88 integers from 1 to 365 (with replacement) and determining if there was a number chosen at least three times. A trial is successful if there was an integer chosen at least three times.The success rate is shown in cell A94. One can run the 1000 trials by clicking on any empty cell. The file is here.  No, I didn't pretty it up. It would be easy enough to build it to perform more trials in one run -- in fact, I originally created it to go through 2500 trials. But file-size is a concern. If you want more trials, just run it repeatedly and write down the success rates. The average of the success rates of five runs is the equivalent of the success rate of one run with 5000 trials. Anyway, when I ran this repeatedly, I got success rates above 50% more than half the time. When I modified the file to look at the case where you choose 87 integers, I got success rates above 50% less than half the time.

If any mathy types are reading this, I'd be interested in knowing:
1) Is there an elegant closed-form solution for 3? For n?
2) Assuming so, does it confirm or deny that it takes 88 people?

*Assuming that birthdays are uniformly distributed across the calendar, and ignoring leap year.

Sunday, March 11, 2018

i hate when i forget math stuff

This is kind of frustrating. I was up last night trying to recall about a proof from grad school, and realize that I can't remember one important point.

Henri Lebesgue
The topic is Lebesque Measure. Specifically, the existence of nonmeasurable sets. It's a pretty fundamental question. There's all sort of stuff built up, starting with the basic definitions and rules. Then there's all sorts of stuff built up around measure, and theory. And, yes, I know the foregoing is a bit hazy. That's because it's been long enough ago that I don't fully remember what are matters of definition and what are results that are proven.

At any rate, with all that stuff around measure, it's good to establish whether there actually are sets that are nonmeasurable. It's not immediately intuitively obvious (at least it wasn't to me when I was a first semester grad student) that there are nonmeasurable sets. All the obvious ways of constructing sets -- take some intervals or single points. Take intersections or unions of them -- don't immediately work.

But I recall the basic construction. Start by splitting the unit interval into equivalence classes where two points are in the same class if their difference is rational. Then take one element from each equivalence class. That set, call it N, is nonmeasurable.

The proof that N is nonmeasurable relies on taking the union of all sets N+a where:
1) N+a is defined as the set of all numbers n+a where n is an element of N; and
2) a is a rational number in the unit interval.
Let's call that union U.

If N is measurable, then it has a measure which must be either zero or positive. Also, because N+a is just a translation of N, its measure is the same as that of N. Finally, N+a and N+b are disjoint for a not equal b.

So, what is the measure of U? We know it has to be finite because U is a subset of [0,2], which has finite measure. But if N has positive measure, then the measure of U, which is the sum of the measures of N+a (for all a in the unit interval) is infinite. Therefore N has measure zero. If N has measure zero, then U has measure zero. This is a contradiction.

And that's where I'm stuck. How do we know that U cannot have measure zero? I think it has to do with the assertion that U contains an interval, and therefore has to have measure greater than or equal to the length of the interval? Maybe it's that U is equal to [0,2], and therefore has to have measure 2? But how do we know that?

Help! Help, help!

Tuesday, February 27, 2018

representing the presidents' names as hillsides

So, I was playing around with numbers and Presidents' names and whatnot, and started wondering about the gematria of these names.

Washington hillside
By way of background, gematria is a type of Hebrew numerology.  Each letter of the Hebrew alphabet has a numerical value. The first nine have the values 1 to 9. The next 9 have the values 10 to 90. The final four have the values 100 to 400. A word's total value is the sum of the values of its letters. For example, the Hebrew word חי, meaning life, has a value of 18. Which is why 18 is a lucky number in Judaism.*

Polk hillside
So, I wondered what the gematria of the various President's last names would be. In order to do that, I had to start by creating values for the letters in the Latin alphabet. In case anyone's interested, the values of the names range from 104 (Obama) to Taylor (1,081).

Roosevelt hillside
Then I started wondering about what it would look like to graph the Presidents' progressions of the cumulative gematria, letter by letter of the names. To explain with a concrete example, let's look at "Taft." "T" has a value of 200. "Ta" has a value of 201. "Taf" has a value of 207. "Taft" has a value of 407. Of course -- and I should have thought of it before I started -- these graphs all kind of look like cross sections of hillsides. Or cumulative probability functions (assuming you normalize to a final
total value of 1).

I think the Roosevelt hill looks the best, though Washington looks good too. Polk is pretty boring. I've reproduced them in this post. But if you want to see all 39 (some presidential last names have been repeated, but I don't want to bother repeating**), follow this link.

Yeah...I need a hobby.


*And, by the way, the name of Asher's cat.
**Yeah, I put together this mishegass, and say I don't want to bother with repetition. Go figure.

Sunday, November 19, 2017

david santos, r.i.p.

Sometimes it seems as if you have all the time in the world, and you can get to something tomorrow. Or next week or next year. And sometimes you find out that your time is up.

I just found out tonight that David Santos, one of my roommates in grad school, passed away. This didn't happen today or yesterday. Or last week or last year. It happened in 2011, so you can figure out that we haven't stayed close through the years. But David was one of the people that I've been figuring I'll catch up with eventually. Eventually... I guess not.

I first met David when I started grad school in the fall of 1987. We were both entering the PhD program* at the University of Michigan, and were going to be living in the same dorm -- Baits Stanley on the North Campus. He had gone to the University of Chicago as an undergrad, and had a much stronger background than I did. He and I were in the same real analysis class that first semester, and his help and encouragement kept me afloat.

In our second year, David and I were renting bedrooms in a private house near the Central Campus. I don't think we ever had any more classes together (after that first semester real analysis), but he still always made time to offer me helpful hints on my homeworks.

David had a very quick wit, and always saw connections between seemingly unconnected things. And I always enjoyed his company.

After I left grad school, I only saw David a few times. He occasionally visited New York with his then-girlfriend, Margie, and I was always eager to catch up with them. The last time I saw David was at the wedding of two other friends in Chicago. After that, we fell out of touch. I think we had a conversation in the late 1990s, but I don't recall much in the way of details.

It's been a long time since David was a part of my life in any real way, but I still feel a sense of loss. The world was a better place with David than it is without him.

Here is a memorial website.

Rest in peace, friend.

*Just to make sure no one thinks I am misrepresenting myself, I never did finish the PhD.

Wednesday, November 15, 2017

one of these things...

I remember, in high school, when a teacher was talking about series and sequences of numbers. She presented a series, such as 3, 6, 9* and asked what the next number is. Of course, she was expecting us to answer 12. I noted that, if you say that the sequence is defined by a polynomial expression, you can justify anything as the next number by picking the right coefficients. 3, 6, 9, 75? There's a third-degree polynomial that fits it. And, by the way, there are infinitely man fourth degree polynomials that fit as well.** 
I used to have a friend named Angry Bob. On more than one occasion he called me, annoyed about a sample Mensa test (or somesuch) he saw in a magazine. He didn't score in the genius range, and wanted to plead his case. Specifically, there would be four pictures, and a question of which one doesn't belong. It was easy enough to figure out what the quiz-writers intended, but Angry saw it differently. He pleaded his case. I explained that the quiz was looking for a different answer. He'd plead again, arguing that his choice was just as legitimate***.This went on until I said that, yeah, he's right, he deserves credit. We would go through several questions this way until he had enough questions right to score in the "genius" range.

I was reminded of the above vignettes as we listened to Christopher Danielson at the National Museum of Mathematics (Mo Math). Blair, Sharon and I (along with one of Sharon's friends and her family) went to see Danielson's presentation, "Which One Doesn't Belong?" which was part of the museum's "Family Fridays" program.

Danielson is an educator of educators. That is, his "thing" is helping people figure out how to teach math to kids. His websites are talkingmathwithkids.com and christopherdanielson.wordpress.com.

The main part of the program consisted of Danielson showing slides with pictures of four objects, and asking for the particpants' thoughts about which object didn't belong. But instead of focusing on what is the one right answer, he focused on the fact that any answer could be right. Consider, for example, the picture above.

  • The shape in the lower left doesn't belong because it's the only one that's convex.
  • The shape in the lower right doesn't belong because it's the only one with multiple lines of symmetry.
  • The shape in the upper left doesn't belong because it's the only shape whose boundary has no straight lines.
  • The shape in the upper right doesn't belong because it's the only shape whose boundary consists entirely of straight lines.

This wasn't as advanced a topic as Francis Su's cake-cutting talk (which I write about here). And to a degree we were out of place; Sharon and her friend were older than most of the kids there. But it was interesting nonetheless. Danielson was trying to introduce the youngsters to flexible mathematical thinking. And it was vindication for that former high schooler in me who bristled at an inflexible teacher. I only hope that Angry Bob, wherever he is, would feel vindicated as well.

*I don't remember what the actual numbers were, so I'll use these for the purposes of the narrative.

**Yeah, I was a smart-ass in high school.

***In all fairness, he was right.

Monday, November 6, 2017

splitting cakes with francis su

The classical question "How can we cut a cake fairly?" has been around since antiquity, but what happens when mathematicians and economists focus on the situation? Is there always a way to divide things fairly? Join Harvey Mudd Professor of Mathematics Francis Su as he shares envy-free (and tasty!) solutions to this very human problem.
That was the message on the poster, and it gave as good an introduction to Professor Su's talk as you're going to find. It sounds frivolous, but anyone who has been to a children's birthday party knows that splitting a cake fairly -- or at least in a way that is perceived as fair by a roomful of children -- is not an easy task. "He got a bigger piece!" "She got the flower!" "I didn't get enough icing!" You get the idea...

It's an interesting subject at the intersection of economics and mathematics. So when Sharon asked me to go with her to Mo Math (technically, the National Museum of Mathematics) for a presentation on the topic -- well, great!

Su started with the well known "You cut, I choose" method of splitting a cake (actually, pretty much anything) between two people. One of the people splits the object in two, and the other chooses which piece she wants. From there, he went on to the situation with three people, and then higher numbers. Of course, along the way he had to define fairness. In order to adress the topic with mathematical rigor, it's necessary to have precision in one's definitions. He specified several definitions of a "fair" division:


  • Envy free: Each person believes he got the biggest piece
  • Proportional: Each person believes he got 1/N (where N is the number of people)*
  • Equitable: Each person thinks he got exactly the same percentage of the total as each other person thinks he got.
  • Efficient: A division that is not dominated by another. For these purposes, a division is said to dominate another if it is at least as good for each player.**


Su hit that sweet spot, balancing mathematical rigor (or, at least the hint of it) and accessibility for the educated layman. The children in the audience seemed to stay interested, as did the adults, many of whom, had mathematical backgrounds.  For the simpler splits, he explained the methodology in detail. So he continued from the simple "You cut, I choose." For more than two people, he described the "Dubins-Spanier Moving Knife Procedure." But at some point he stopped trying to describe methods in detail, and just explained that solutions exist, but may involve very large numbers of steps.***

It was also interesting getting a flavor of the thinking that leads to the solutions. Su explained and demonstrated Sperner's Lemma, which is at the intersection of topology and combinatorics. And at another point he talked about how he got interested in the cake-splitting problem -- trying to figure out how much rent each person should pay in a shared house where rooms differ in desirability.

Now, if only I weren't dieting -- there was free cake. Su used it to demonstrate the Dubins-Spanier moving knife procedure.

*I describe this by saying that each person thinks he got his fair share.
**We weren't precise to the point of indicating whether the exact definition of "dominate" is written so that all divisions dominate themselves or none do.
***This year, Aziz and McKenzie proved the existence of a method for an envy-free division for n people, but it can take up to n^(n^(n^(n^(n^n)))) steps.

Tuesday, October 17, 2017

a lesson learned too late

On Facebook, recently, I saw some discussion about a couple of professors I knew when I was in grad school at the University of Michigan. One of the professors discussed was M.S. Ramanujan, whom I had had. In that thread, I mentioned that I had my own Ramanujan story, but that I would post it on my blog. So, here it is.

But before I start, let me note that my father had taken a class with ramanujan when he was an undergrad at the UM. That's neither here nor there.

So, it was my first semester as a grad student, and I was taking a class in real analysis with Ramanujan. On the midterm, we were asked to prove disprove the following:
The set A union B is measurable if and only if both A and B are measurable.
We were allowed to assert without proof anything that had been proven in class.

My solution was simple: Let A be a nonmeasurable set of reals. Let B be A's complement. A union B is the set of reals, which is measurable. But neither A nor B is measurable. Therefore the statement is false. QED.

I only got half credit for my solution, which really angered me.

Professor Ramanujan argued that I got half credit because I only answered half the problem. Despite presenting the problem as one statement, he had intended it to be interpreted as two statements:
The set A union B is measurable if both A and B are measurable.
The set A union B is measurable only if both A and B are measurable.
I had proven that the second statement was false, but had not said anything about the first statement. Therefore I only got half credit. Ironically, the first statement is much simpler to handle, since we had proven it in class.

I argued with Professor Ramanujan that I should get full credit; he had presented the proposition as one statement and asked us to prove it or disprove it. I did so. His response was that, if I want to be a hardass about it, he's sure he could review my paper and find points to take off elsewhere. I dropped the argument.

Looking back, I have mixed feelings about it. I was certainly right in at least one interpretation of events. Of course, as one of my classmates pointed out to me, in the name of elegance, I should have written into my answer something along the lines of "Of course, as proven in class, if A and B are both measurable, then their union is measurable."

But the bigger point that I didn't understand is that it didn't really matter. In high school and in undergrad, grades on tests were crucially important, as the final grade would be some well-defined average of scores and tests and homeworks. In grad school, the professors had much wider latitude to assign grades based on how well they felt the student knew the material. So the extra points for restating such a trivial result didn't really matter.

Live and learn.

Saturday, September 30, 2017

three door monty

Monty Hall has died. He was 96 years old, so he had a good deal. Here's the pilot from his show.



I wasn't a big fan of Let's Make a Deal, so I don't really know what to say about him. But I’ve always wanted to write an essay about the Let’s Make A Deal Problem (LMaDP),  and I’ve never had an opportunity to do so. Well, it's now or never.
I’m not sure how well known LMaDP is outside of actuarial and mathy types of crowds. It was made famous in 1990 in a letter to Marilyn Vos Savant, who answered questions for her “Ask Marilyn” column in Parade Magazine.

The gist of the problem is as follows:

You are on a TV gameshow, and given a choice of three doors. One door hides a prize. The other two doors each hide garbage. You pick a door, and win what’s behind it. But before the host opens the door to reveal what you’ve won, he picks one of the other two doors and reveals that it hides garbage. He then gives you a choice between staying with the door you originally chose and switching to the other as-yet-unrevealed door. Should you switch? Before you answer, let me add some information which is essential, but often elided in the retelling: Going in, the host knows which door hides the prize, and is required by the rules of the game to open a door that you didn’t pick, and which hides garbage behind it. This, presumably, is to build excitement. Now, with that extra bit of information, should you switch or stick.

When Vos Savant was presented with the problem, she (correctly answered that you should switch. Specifically, you have a 2/3 chance of winning if you switch and a 1/3 chance of winning if you stick. The response was angry and vocal. She was roundly condemned as a know-nothing, setting back the cause of education, blah blah blah. I remember some of the senior actuaries at work were similarly incensed. Her response does initially seem counterintuitive; since you have two doors to choose from, and they seem the same. But she stuck to her guns. And she was right to do so.
What I'd like to do now is argue in several different ways. Then, finally, I want to end by answering the question of what makes the doors different.

Arguments
Argument 1: 100 doors
One of the most commonly used arguments presents a situation that is similar, but different in one crucial way. Specifically, it supposes that there are 100 doors, with one hiding a prize. After you pick a door, the host opens 98 others, revealing them all to be losers. he then gives you the chance to switch. Are you better off switching? Presumably the fact that there are so many more doors makes it easier to visualize that it's unlikely that you won with your initial pick.
Argument 2: Under what circumstances do you win by switching/sticking
Consider what circumstances lead you to win by switching and what circumstances lead you to win by sticking. If you initially choose the winning door (something which happens one time in three), you will win by sticking. If you initially chose a losing door (something which happens two times in three), you will win by switching. QED.
Argument 3: Enter the Bayesians
This is actually closely related to argument 2. Assume it doesn't matter whether you stick or switch. That means that you have a 50% chance of winning with your door. But you know that, once you choose your door, the host will open another and give you the choice. In other words, no matter what he does (i.e., whichever other door he reveals), your door will then have a 50% chance of being the winner. That means that, before he does anything your door has a 50% chance of being the winner, since the chance of your door being a winner (before he does anything) is equal to the weighted average of it being the winner after he does something (weighted by the probabilities of his taking each possible action).
So let's get this straight. If the game were different -- you pick a door and then, without anything being revealed, you can keep it or switch to one of the others -- the chances of your door being the winner are one in three. But adding the extra rules of the game as stated above, your initial door goes up from 1/3 to 1/2! That's a pretty good Schroedinger's door, there.

Argument 4: Simulation by spreadsheet
I created a little spreadsheet to simulate the situation. It's here. You can play along at home. Sheet1 has 10,000 simulations. In each, there are three doors -- A, B and C. The following happens:

  • In column C, the winning door is determined randomly
  • In column E, the door you (as the contestant) is determined randomly
  • In column H, the door the host opens is determined randomly, subject to the rule that it not be either the door chosen in column C or the door chosen in column E
  • Columns I and K display the doors you have by sticking and by switching
  • Columns L and M indicate whether you win by sticking or by switching (with a "1" in the appropriate column).
  • Column N is simply a check column. It should always be 1. Cell N1 serves as a check that every entry in column N is a 1. N1 should be zero, indicating that everything else is the same.
  • Cells L1 and M1 add up the number of simulations in which you win by sticking and in which you win by switching.

You can rerun the 10,000 simulations by selecting an empty cell (e.g., R2) and hitting the delete key. The relevant cells will be recalculated, and you can see that cells L1 and M1 will be somewhat close to 3,333 and 6,667 (respectively). I have rerun this simulation several times, and each time I get close to that split. Note that the odds of getting that exact split are low. If you flip a fair coin 1000 times, you will likely get close to 500 heads and 500 tails. But you are unlikely to get exactly that.

What Makes the doors different?
As I wrote above, it initially seems counterintuitive to say that one door is more likely to win than the other. There are two possibilities, and on the surface it can seem like they are the same, and therefore each has a 50% chance of winning. If the chances are not the same, there must be some asymmetry between them. So what is that asymmetry?

The asymmetry is in the way the two doors came to be candidates (i.e., why each is not the one that was revealed as not the winner).
  • The door you did not choose was not revealed to be a loser for one of two possible reasons:
    • Possibly, you chose the winner to start, in which case the host could have opened either remaining door, and he just chose the one he did; or
    • Possibly, you chose a loser, in which case one of the remaining doors is a winner, and the host had no choice but to reveal the one he revealed.
  • The door you initially chose was not revealed because the host is not allowed to reveal it.
Since the two remaining doors are not the same. the argument that they are equally likely to win because they are the same is false.

Wednesday, September 6, 2017

eine kleine mind game

Here's a little mind game.

Suppose you are presented with two doors. Behind each door is a cash prize. You are told that one of the prizes is exactly twice as much as the other. You can choose either door and get what's behind it. You choose a door. Now, before finding out what's behind it, you are given the option to switch doors and take the other prize instead. Should you switch? Common sense dictates that it doesn't matter; you've been given no additional information.

But look at it mathematically. Let N represent the prize (in dollars) behind your door. The prize behind the other door is either ½N or 2N (with equal probability). That means that the expected value of the amount behind the other door is 1.25×N (calculated as ½×(½N) + ½×(2N)). So, by switching you increase your expected prize from N to 1.25×N.

But that can't be right. And to emphasize, you can do the switch and then be faced with the same conundrum. Your new prize is X, but by switching back you have an expected prize of 1.25×X. And you can keep going back and forth, forever increasing your expected prize.

So where's the flaw? I note, by the way, that showing that there is a flaw (as done in the last paragraph) is not the same as finding the flaw. What assertion is it that's wrong?

While you're thinking, I'll separate the question from the answer with this charming video.


The mistake is in the statement, "That means that the expected value of the amount behind the other door is 1.25×N (calculated as ½×(½N) + ½×(2N))." That statement implicitly assumes that, regardless of whatever value is behind the door you chose, the other door is equally likely to have twice that amount and and to have half that amount. But that assumption is faulty; there is no probability function (or probability distribution function if you want to work in the continuous world) that will give you that property.*

In the remaining paragraphs, I will use the convention that you initially choose door A. I will use VA to indicate the value behind door A. B represents the other door and VB represents the value behind door B

To calculate the expected value if you don't switch, you have to multiply all the possible values of VA by their respective likelihoods and then add up the products. Of course, to calculate your expected winnings if you switch, you do the same thing for B and get the same result. But if you want to avoid explicitly assuming that they're the same (which kind of renders the proof that they're the same moot), you have to look at all the values of VA, then get the expected values of VB conditional on VA, and multiply them by the likelihoods of the respective possible VAs.

To take a simple example, assume that there are two possible pairs of values for the two doors: (50, 100) and (100, 200). The possible values of VA are 50, 100 and 200. These have likelihoods ¼, ½ and ¼. So the expected value of VA is 112.5, calculated as follows:

Calculating the expected value of VB involves more calculations, but none of them is particularly difficult. You need each value of VA and its likelihood. Then you need to calculate the expected value of VB given the value of VA. To do that, you have to look at the values of VB if VA is the greater of the two and if VA is the lesser of the two, and the likelihoods of all those. Calculating the expected value of VB yields 112.5, which is the same as the expected value of VA.


QED.

*Put more exactly, for all values X, the probability that the two prizes are ½X and X is equal to the probability that the two prizes are X and 2X. That's mathematically impossible unless you're taking the trivial case where X is equal to zero with probability 1.

Thursday, March 30, 2017

the omega glory

At work, some colleagues and I got into an email exchange about mortality tables. It was prompted by a passage in an old probability textbook. Feller, I think. The relevant passage:
It is impossible to measure the life span of an atom or a person without some error, but for theoretical purposes it is expedient to imagine that these quantities are exact numbers. The question then arises as to which numbers can represent the lifespan of a person. Is there a maximal age beyond which life is impossible, or is any age conceivable? We hesitate to admit that man can grow 1000 years old, and yet current actuarial practice admits no bounds to the possible duration of life. According to formulas on which modern mortality tables are based, the proportion of men surviving 1000 years is of the order of magnitude of one in 10^10^36 — a number with 10^27 billions of zeros. This statement does not make sense from a biological or sociological point of view, but considered exclusively from a statistical standpoint it certainly does not contradict any experience. There are fewer than 10^10 people born in a century. To test the contention statistically, more than 10^10^35 centuries would be required, which is considerably more than 10^10^34 lifetimes of the earth. Obviously, such extremely small probabilities are compatible with our notion of impossibility. Their use may appear utterly absurd, but it does no harm and is convenient in simplifying many formulas. Moreover, if we were seriously to discard the possibility of living 1000 years, we should have to accept the existence of maximum age, and the assumption that it should be possible to live x years and impossible to live x years and two seconds is as unappealing as the idea of unlimited life.
 Before going on, I should note one mistake in the passage above. Current actuarial practice is (and, I believe, was as of the time that Feller was written) to use mortality tables that did have a maximal age. Modern mortality tables generally have an omega -- that age at which q (the probability of dying within a year) is 1.

At any rate, the question being alluded to is whether it makes more sense to have an omega or to assume that there is no upper bound on potential lifespan. For practical purposes, it doesn't matter. There is clearly a mathematical difference between having q=1 at age 120 and having q=.99999999999999 at age 120, growing monotonically, and converging to 1 as age approaches infinity. But in the world of insurance (and its place in finance), it doesn't matter.

Conceptually, I prefer the notion that there is no omega, but q's get arbitrarily close to 1. It just makes more sense to me. But, based on the conversation at work, I am in the minority.

Wednesday, November 23, 2016

is there a glitch in trivia crack?

I don't know if anyone here is interested in Trivia Crack. I am. It has become my main smartphone-based time-waster.
Anyway, I've been noticing recently that the first choice seems to be correct more often than would be expected by raw chance. By way of background, for anyone who doesn't, and hasn't, played T-Crack, questions come with four choices.
Now, sometimes such perceptions can be off. So I decided to do a little checking. I will track how many times the right choice comes up in each of the four positions. To be clear, I will not always track this. If I'm on the bus without pen and paper, I don't want that to keep me from playing. But what I will do is explicitly decide, before the fact, that I will track results for a particular session. Put another way, I won't decide, after playing, that I will track the results for questions already asked. Doing that would introduce the possibility of me subconsciously biasing the results.
But if I only include results that come after I have made the explicit decision to track what happens in a particular session, and if I always include the results once I have made the decision, that should eliminate the possibility of self-deception.
So far, I have done this twice, for two games. My results are summarized in the table. In the two games I played, I had 39 questions. Of those, the first choice was correct 23 times. That's more than half.Now, I am not sure how significant 39 questions is as a sample size. But I think this is suggestive. Remember -- it's not as if I played these games, realized that the first choice was correct a lot and then saved the results. I decided before playing that I would track the results because I suspected that the first choice would come up a lot.
I will report back after I have a larger sample. I don't know that keeping the split by category matters, though it will be interesting to see if I can notice a difference. Right now, what I have does not suggest anything. At least not to me. But I realize I don't have enough enough data to make any strong conclusions.
If anyone else plays T-Crack, I'd be curious to know if you're seeing the same thing. Also, what platform you play on -- if this is some glitch in the software I wonder if it's unique to Android (my platform) or if it's a cross-platform issue.
Perhaps I shouldn't post this. If there is a glitch, then knowing that fact gives me a competitive advantage over those who don't know. Posting this makes it more likely that others will know, and more likely that it will get fixed.
So, just consider that I am possibly sacrificing my T-Crack performance in the name of science. Or whatever.

Monday, November 21, 2016

you're just a bayesian

I was discussing probability with a colleague, and the conversation reminded me of an incident in college.

For the purpose of this narrative, I will present a lot of verbal exchanges using quotation marks. That is just a convenience for the purposes of telling the story. Except for the final punchline, I don't remember what was said verbatim.

In a probability class, the professor was introducing us to the concept of hypothesis testing. She asked us: "If I flip a coin 100 times and it lands on heads each time, how likely is it the it's a fair coin?"

What she meant to ask -- and it was a long time before I realized this -- was, "If I have a fair coin, and flip it 100 times, how likely is it to come up heads each time."

The difference may seem subtle, but it's crucial. The answer to the question she meant to ask is (1/2)^100, which is tiny. But the question she actually asked cannot be answered without more information.

She expected a straightforward answer, but I said that it depends.

"On what?"

"On how certain you were that it was a fair coin before you started flipping it."

She insisted that that was irrelevant. It was really unlikely that I had a fair coin if I flipped it and got heads 100 times.

"If I pulled it from a drawer of coins, and I know that half -- or even 1% -- of the coins in the drawer are double-headed, sure. But what if I have absolutely perfect knowledge going in that it's a fair coin? Then, even after 100 heads in a row -- or 1000, or 10,000 -- I still know it's a fair coin."

We went back and forth for a while, restating the question and related logic. I didn't realize what she had meant to ask. And she had gotten so caught up that she didn't realize her mistake. Eventually it became clear that the discussion wasn't productive. And she had to move on with the lesson.

"Oh, you're just a Bayesian" she told me...

Sunday, September 18, 2016

three things i learned in school that i will never forget

Here are three things that I learned in school and will never forget.

A Talmudic Principle:
"אין רצוני שיהי פקדוני ביד אחר" It's pronounced "Ain r'tzoni sh'y'hey pikdoni b'yad acher." Literally
translated, it means "I didn't want my property to be in someone else's hand. This was a sentence from eight grade Talmud class. I don't remember which book of the Talmud we were in. The topic was who is responsible if a person's property is damaged while being held by a second person. Say, for example, I have your bicycle and it is damaged or lost. Do I have to pay you for the loss? The answer, of course, depends primarily on two questions:

  • Why am I in possession of your property? Did you lend it to me to use? If so, am I paying for its use? Or am I  holding it because you need someone to take care of it? If so, are you paying me for the service?
  • How did the object get damaged or lost? Was I careless? Was it normal use? Did I lend it to a third party?

That last question is where the concept (quoted above in Hebrew) comes into play. Unless I got your permission to pass on your property to the third party, the rules are very much against me.

Why do I remember this one concept when I don;t remember any other line of Talmud? Because our teacher, Rabbi Atik, insisted that it's really important. SO he got the whole class to chant it over and over again. Then, while we were still chanting, he stood us up and marched us up and down the hallway, into every classroom.

The Central Bank of the Soviet Union
It was the "Gosbank." In college, I took summer classes. One summer I took an economics class in money and banking. One question on the final asked for the name of the central bank of the Soviet Union. I didn't know, so I took a wild guess. "First Commie Savings and Loan" I wrote. I got it wrong, but the professor told me the answer. Had I remembered the answer from studying the text, I probably would have forgotten it by now. But in the event, I will always remember.

A cool fact about circles
Suppose you have two circles. One is inside the other, but they share one point. Now, consider a
string of circles in the space between these two circles. The circles in the string touch each other, and also touch the two main circles. The points where the little circles meet are all contained on yet another circle.

I remember this because of the complex analysis course I took in my second semester of grad school. The last question on the midterm (or was it the final?) asked us to prove this. As the professor was handing out the test papers, I saw the diagram on the last page, It looked complicated and scary. I went into a panic and started saying "Oh shit! Oh shit! Oh shit!" over and over. At some point I looked up and saw that the professor had stopped handing out papers and was staring at me. To this day I don't know if he was annoyed or amused.

The irony is that that question is the only one that I got completely right. It was a simple construction using linear fractional transformations.

Saturday, June 4, 2016

a meep in manhattan

I suppose it's partially a function of my age, but I have had a hard time getting myself comfortable
with downloaded media.

Music? I've ripped my entire CD collection so I can listen on computer, but I want to have the physical CD. If there's something that's only available as a download, I feel compelled to burn it onto a disc just so I can pretend I have it on disc. Similarly, I like to have physical books rather than read things on a kindle or nook or whatever those reader thingys are called. Actually, in some ways it's stronger for books than music, since having the physical copy makes a bigger difference in the reading experience than the listening experience.

But I broke down and read a book on Kindle. Or, at least, on the kindle app of my phone. Spoiler alert: I found it to be an unpleasant experience. Why? For a book that was only available as a download.

So I downloaded and read A Meep in Manhattan, by Mary Pat Campbell (AKA Meep). The price was right. Free. I like free stuff. Also, Meep is a friend of mine. We used to work together. We  were irregular members of the same lunch group at work. And she's still one of my few go-tos when I have a question about Excel.

aMiM is essentially Meep's journal from the fall of 1996, when she was a first-year grad student in Mathematics at NYU. It was a breezy read that I went though on a lazy weekend morning.

There are a few factors that contributed to my enjoyment of the book. The fact that I'm friends with Meep helps. I read most of the book in her voice, which kind of adds a feel of authenticity to it. Also, in a couple respects, I have experiences that mirror hers -- I also was a grad student in math going to a school in a city very different than what I was used to.

But all that hints at the fact that aMiM is inherently of limited appeal. These are Meep's journals, which she wrote for herself and her friends and family -- not for a general audience. It's hard to see how someone who doesn't know her will really care. And I will note that she has acknowledged that this is of limited appeal, but she put it together primarily to see what she could do with the format.

By the way, I preferred the original cover (second picture), which had a picture of a young Meep looking pained. The new cover (pictured at top) looks more professional, but there's something about that first one.

Now, I know what everyone's thinking: You're thinking "Golly, I want to download this book and read it! But I want to read it in Meep's voice, and I have never heard her talk! What can I do?" For those of you thinking that, here's a Youtube video of Meep explaining how math is done. Enjoy!

EDIT: Added a graphic of the original cover.


Tuesday, May 10, 2016

countability and an overheard conversation

I was on the subway, going to work. groggy in my pre-coffee state, And then I hear my fellow riders talking about what it means for a set to be countable...

By way of background for the uninitiated, "countability" is a concept related to set theory. At first blush it may seem that some sets are finite and some are infinite, and all infinite sets are the same size. But it can be shown that that last assertion isn't true. Some infinite sets are bigger than others. An infinite set is "countable" if it is the same size as the set of counting numbers (1,2,3, etc). Another way of looking at it is that a countable set can be lined up and counted off -- "The first one, the second one," etc. You'll never finish counting them off because the set is infinite. But no matter what element I think of, you will get to it eventually. Relating that last description to the counting numbers, we can line up the counting numbers in order (first 1, then 2, then 3...) and count them off. We'll never finish. But you can pick any number (say, 153,472) and we will get to it eventually. The counting numbers are countable. The rational numbers (numbers that can be expressed as one integer divided by another) are countable. The real numbers aren't countable.


Anyway, the person who was explaining this was correct in what he said. But the other one was just not getting it. He kept saying things along the lines of "but you'll never get done" and "But how can it be countable if you can't finish counting it?" I realized what his hangup was. He was focused on what he felt the definition of "countable" should be, based on his real world understanding of the word. But in math, the definitions are precise. They are often motivated be real world perceptions, but that desn't mean that they fully align. And this is an example. You may not be able to finish counting the rationals (or the counting numbers for that matter), but they are countable.


I wanted to interrupt them to say, "don't think about what counting means to you. Think about what the definition says."


But I didn't. I just shook my head and kept on playing Trivia Crack.