A Blog About D4T4 & M47H

538 Riddler: Puzzle of Baseball Divisional Champs

26 May ’16

For this week's Riddler, I estimated that the division leader would have 88.8 wins after 162 games. I assumed that each team plays the other teams in it's division 19 times for a total of 76 intradivision games and 86 interdivision games, consistent with the actual scheduling rules.

Interdivision games are pretty easy to deal with because the outcomes of each team's interdivision games are independent of one another. If all 162 games were interdivision (i.e. the teams in the division somehow never play one another), the answer would be pretty straightforward (code in R):

> cdf <- (pbinom(1:162, 162, 0.5))^5
> pmf <- cdf - c(0, head(cdf, -1))
> sum(1:162 * pmf)
[1] 88.39431

However, teams in the division obviously do play one another, so win-loss records are not independent. We can think of intradivision games as a series of consecutive round robins. Each round robin consists of 10 games, and each team plays in 4 of those games (one game against each of their division foes). Each team plays 76 intradivision games, which is 19 round robins and 190 games. I started by creating an exhaustive state space (and corresponding probabilities) for the win totals of the 1st, 2nd, 3rd, 4th, and 5th place teams after the 190 intradivision games. Each state is defined as such that . As you can expect, there are many possible outcomes (157,470 states in my state space)!

Next, for each state, I calculated the probability that the division winning team would have less than X wins after the remaining 86 interdivision games. Results of interdivision games are independent, making this pretty easy. Sum-product with the state probabilities and we have the CDF for X!

This computes to 88.8 wins. This is slightly higher than the all-interdivision calculation above, which makes intuitive sense. In the all-interdivision scenario, we could theoretically have a division leader with 0 wins (all 5 teams go winless). However, when we have intradivision games, the division leader cannot have fewer wins than the number of intradivision games that they play divided by 2; one team's loss is another team's win.

I've posted my code on my GH here. Enjoy!

538 Riddler: Puzzle of the Monsters' Gems

26 May ’16

There are three ways that this game can end: slaying a rare monster (the most likely), slaying an uncommon monster, or slaying a common monster (the least likely). I began by thinking about the probability of each of these events happening. The probability of the game ending by slaying a rare monster can be expressed as the following:

Extending that same logic, we can calculate the probability that we end the game by slaying an uncommon and common monster as well:

...these sum to 1 and match what we would expect directionally.

Next, I added the expected number of common monsters slayed to each of these scenarios. If the game ends by slaying a common monster (which only happens 15% of the time), this is simply 1. In the other two scenarios, the number of common monsters slayed is a binomial random variable, conditioned on not all the previously slayed monsters being of a single type. Bayes helps us reduce the expression:

Putting this all together:

538 Riddler: Puzzle of the Overflowing Martini

19 May ’16

Here's my solution to this week's 538 Riddler:

If the liquid reaches fraction of the way up the glass when upright, then the liquid goes fraction of the way up the glass on the opposite side just before it begins to pour.

Dandelin spheres were key to my proof. They prove that the top of the liquid (a conic section) forms an ellipse. They also prove that a sphere tangent to the top of the liquid and the sides of the glass intersects that elliptical conic section and one of its foci! I derived two expressions for the volume of the liquid (one pouring, one upright) and set them equal to one another. Interestingly, the steepness of the glass ( in my proof), drops out of the expression!