A Blog About D4T4 & M47H

538 Riddler: Puzzle of the Picky Eater

22 June ’16

I found it easiest to think about this problem in terms of polar coordinates. The furthest point that we can eat along trajectory is the following:

Plotting this, it forms this weird, rounded rectangle shape:

I integrated the above equation to get the area. Unlike a regular integral where each area is a rectangle (Reimann sum), each incremental integration area is a circular sector with . Putting this all together:

Extending this logic, I also derived an expression for the area eaten for a regular polygon with n sides:

As n goes to infinity, the area that the picky eater eats becomes a circle with a radius half that of the sandwich, making the area that is eaten equal to 25%. This is the most efficient shape for the picky eater.

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: