Sunday, October 17, 2021

Ride the Ords!

Over in the National League Championship Series, the Washington Rationals and the St. Louis Ordinals (known as the “Ords” for short) are also evenly matched. Again, both teams are equally likely to win each game of the best-of-seven series.

You enter a competition in which you must predict the winner of each of the seven games before the series begins. If any or all of the fifth, sixth or seventh game are not played, you are not credited with predicting a winner.

You win the competition if you predict at least two games correctly. If you optimize your strategy for picking winners, what is the probability you will win the competition?

While it might seem like a counterintuitive real life strategy, you can win $65/70 = 92.86\%$ of the time by just picking a single team to win each games, say the Ords. As we saw in the Riddler Express problem this week, there are a total of $70$ equally likely outcomes for the seven game series. If you are betting the Ords in each game and only need for two of your guesses to be correct, then the only time you will fail to win the competition is if the Rationals (Rats?) win in $4$ or $5,$ which comprise $\binom{3}{3} + \binom{4}{3} = 5$ of the $70$ possible outcomes.

They just go by the Rays and Twins as shorthand?

The American League Championship Series of Riddler League Baseball determines one of the teams that will compete in the Riddler World Series. This year’s teams — the Tampa Bay Lines and the Minnesota Twin Primes — are evenly matched. In other words, both teams are equally likely to win each game of the best-of-seven series.

On average, how many games will the series last?

There are obviously two possible winners of the series, but since everything is symmetric let's not bother enumerating the other half of the outcomes as it won't affect the average length. Since the winning team will obviously win the last game, then to determine how many arrangements end in exactly $n$ games, we are really trying to decide how to distribute the $3$ other wins into the $n-1$ first games. In this case, there are $\binom{n-1}{3}$ such ways to do so, therefore the average length of the series is $$A = \frac{\sum_{n=4}^7 n \binom{n-1}{3}}{\sum_{n=4}^7 \binom{n-1}{3}} = \frac{4 \cdot 1 + 5 \cdot 4 + 6 \cdot 10 + 7 \cdot 20}{1 + 4 + 10 + 20} = \frac{224}{35} = 6.4 \,\text{games}.$$

For full clarity, and since we will use it in the Riddler Classic solution, there are a total of $70 = 2 \sum_{n=4}^7 \binom{n-1}{3}$ equally likely outcomes for this best of $7$ series.

Monday, October 11, 2021

Like two doppelgangers passing in the night, or the Troppel with Doppels

Or perhaps your doppelgänger is now obscured by the lamppost. You start walking along the road, getting closer to the lamppost, but your doppelganger remains hidden. Feeling outmaneuvered, you suspect that your doppelganger moves precisely twice as fast as you at all times. However, unlike you, they are not constrained to a straight road, and can move more freely in two dimensions.

You walk a total of $200$ feet, so that the lamppost is now $100$ feet back and $100$ feet left of the road. Still no sign of the speedy doppelganger, who is assuredly still obscured by the lamppost.

At this point, you contemplate chasing down the doppelganger more directly. But before doing so, you wonder: What is the farthest the doppelganger could be from the lamppost?

Let's assume that my velocity is fixed at $v \gt 0,$ so that my position is given by the point $(vt, 0)$ for $t \in [0,200/v].$ Then in order to be obscured at time $t$, the doppelganger's position $(x(t), y(t))$ must satisfy $$x(t) = vt + \left(1 - \frac{vt}{100}\right) y(t).$$ Therefore, we have $$\dot{x}(t) = v - \frac{y(t)}{100} + \left( 1 - \frac{vt}{100} \right) \dot{y}(t).$$ Since my velocity is $v$, the doppelganger's must be $2v \gt 0,$ or equivalently, \begin{align*} 4v^2 &= \dot{x}(t)^2 + \dot{y}(t)^2 = \left(\left(v - \frac{y(t)}{100}\right) + \left(1 - \frac{vt}{100}\right) \dot{y}(t) \right)^2 + \dot{y}(t)^2 \\ &= \left(1 + \left(1 - \frac{vt}{100}\right)^2 \right) \dot{y}(t)^2 + 2 \left( v - \frac{y(t)}{100} \right) \left( 1 - \frac{vt}{100} \right) \dot{y}(t) + \left( v - \frac{y(t)}{100} \right)^2\end{align*}

Without loss of generality, let's assume that $v = 1.$ Then the nonlinear ODE simplifies to $$ \left(1 + \left(1 - \frac{t}{100}\right)^2 \right) \dot{y}^2 + 2 \left( 1 - \frac{t}{100} \right) \left( 1 - \frac{y}{100} \right) \dot{y} + \left( 1 - \frac{y}{100} \right)^2 - 4 = 0$$ with initial condition $y(0) = 200.$

In theory, since we are after solution which is furthest from the lamppost, we can choose the upper branch of the square root in the quadractic formula solution of the above, that is $$\dot{y} = \frac{-(1 - t/100)(1-y/100) + \sqrt{4 + 4(1- t/100)^2 - (1-y/100)^2}}{1 + (1-t/100)^2}.$$ However, one slight problem with simply using a brute force ODE solver is that there is a numerical instability when $$\Delta(t, y) = 4 + 4 \left(1 - \frac{t}{100}\right)^2 - \left( 1 - \frac{y}{100} \right)^2 \lt 0.$$ However, we can also simplify the problem a bit to avoid this situation, by noting that for any $t > 0,$ if $y(t) = 300,$ then we must have $$\left(1 + \left(1 - \frac{t}{100})^2\right)\right) \dot{y}^2 -4\left(1 - \frac{t}{100}\right) \dot{y} = 0,$$ which has solutions $\dot{y}_1 = 0$ and $\dot{y}_2 = 4(1-t/100)/(1 + (1-t/100)^2).$ Since for $t \gt 100,$ we have $\dot{y}_2 \lt 0$ and we are again interested in the solution with the largest y coordinate value, we should choose $\dot{y} = \dot{y}_1 = 0$ whenever $y = 300.$

So, therefore, we need only integrate the upper branch ODE until we hit the boundary $y(t) = 300$ at some $\hat{t} \gt 0$ and then let $y(t) = 300$ for all $t \in [\hat{t}, 200].$ This leads to the doppelganger ending up at the point $(-100, 300)$ when I reach $(200, 0),$ causing him to be $300 \sqrt{2}$ away from me at that point.

Optimal time-traveling lottery scam

Channeling your inner Marty McFly, you travel one week back in time in an attempt to win the lottery. It’s worth $\$10$ million, and each ticket costs a dollar. Note that if you win, your ticket purchase is not refunded. All of this sounds pretty great.

The problem is, you’re not alone. There are 10 other time travelers who also know the winning numbers. You know for a fact that each of them will buy exactly one lottery ticket. Now, according to the lottery’s rules, the prize is evenly split among all the winning tickets (i.e., not evenly among winning people). How many tickets should you buy to maximize your profits?

Because you can depend on the kindness of your fellow time travelers and their close-minded purchasing behavior, you can game the system. If you buy $x$ tickets, then there will be $10 + x$ winning tickets, each of which would earn $\frac{10^7}{10 + x}$ and cost $1$. So the overall profit would be $$P(x) = x \left(\frac{10^7}{10 + x} - 1\right).$$

Differentiating we get $$P^\prime(x) = \frac{10^7}{10 + x} - 1 - \frac{10^7 x}{(10 + x)^2} = \frac{10^7 (10 + x) - (10+x)^2 - 10^7 x}{(10+x)^2} = \frac{10^8 - (10+x)^2}{(10+x)^2}.$$ So we see that the only positive critical point of the profit function is at $\hat{x} = 10^4 - 10 = 9990$ tickets. Since $P^\prime(x) \gt 0$ for $x \lt \hat{x}$ and $P^\prime(x) \lt 0$ for $x \gt \hat{x},$ we reason that this is indeed a local and global maximum of the profit function.

Sunday, September 19, 2021

Radish pie

I recently came across a rather peculiar recipe for something called Babylonian radish pie. Intrigued, I began to follow the directions, which said I could start with any number of cups of flour.

Any number? I mean, I had to start with some flour, so zero cups wasn’t an option. But according to the recipe, any positive value was fair game. Next, I needed a second amount of flour that was 3 divided by my original number. For example, if I had started with two cups of flour, then the recipe told me I now needed 3 divided by 2, or 1.5, cups at this point.

I was then instructed to combine these amounts of flour and discard half. Apparently, this was my new starting amount of flour. I was to repeat the process, combining this amount with 3 divided by it and then discarding half. The recipe told me to keep doing this, over and over. Eventually, I’d have the proper number of cups of flour for my radish pie.

How many cups of flour does the recipe ultimately call for?

So if $x_0 \gt 0,$ with $$x_n = \frac{1}{2} \left( x_{n-1} + \frac{3}{x_{n-1}} \right),$$ for $n \geq 1.$ Let's assume that $x_n \to x^*,$ then the limit would have to satisfy $$x^* = \frac{1}{2} \left( x^* + \frac{3}{x^*} \right)$$ or equivalently $x^* = \frac{3}{x^*}$ or $x^* = \sqrt{3}.$

Sunday, September 12, 2021

Strips by a million cuts

One morning, Phil was playing with my daughter, who loves to cut paper with her safety scissors. She especially likes cutting paper into “strips,” which are rectangular pieces of paper whose shorter sides are at most $1$-inch long.

Whenever Phil gives her a piece of standard printer paper ($8.5$ inches by $11$ inches), she picks one of the four sides at random and then cuts a $1$-inch wide strip parallel to that side. Next, she discards the strip and repeats the process, picking another side at random and cutting the strip. Eventually, she is left with nothing but strips.

On average, how many cuts will she make before she is left only with strips?

Let's define $S(m,n)$ as the expected number of strips for an $m$ by $n$ sheet of paper. By definition, we have $S(m,n) = 0$ for all $m , n \gt 0$ such that $\min \{ m, n \} \leq 1.$ Since there is a $0.5$ probability that the length side is reduced and $0.5$ probability that the width side is reduced by the next cut, we have the following recursion formula: $$S(m,n) = \frac{1}{2} S(m-1, n) + \frac{1}{2} S(m, n-1) + 1.$$

After using the fact that $S(m,n) = S(n,m)$ for all $m,n \gt 0$ and seeding the cache with $S(1,k) = 0$ for $k = 1, \dots, 11$, a recursive function needs $52$ calls to arrive at $$S(8.5,11) = 14.29058837890625.$$

We can muck about with the recursive definition to note a few things about this function $S(m,n).$ Firstly, we get $$S(m,n) = 2 - \frac{1}{2^{\lceil n \rceil -2}}, \,\, \forall m \in (1,2], n > 0.$$ Let's focus on $n \in \mathbb{N}$ as the extension to all $n > 0$ is trivial. The base case holds by the boundary condition since $S(m,1) = 2 - \frac{1}{2^{-1}} = 0.$ If the equation holds for some $n \in \mathbb{N}$ then since $m \in (1,2],$ $S(m-1,\cdot) \equiv 0,$ so \begin{align*} S(m,n+1) &= \frac{1}{2} S(m-1, n+1) + \frac{1}{2} S(m, n) + 1 \\ &= \frac{1}{2} \left( 2 - \frac{1}{2^{n-2}} \right) + 1 \\ &= 2 - \frac{1}{2^{n-1}}. \end{align*}

We can similarly use the recursion formula and induction to build up $$S(m,n) = 4 - \frac{\lceil n\rceil +3}{2^{\lceil n\rceil-1}}, \,\, \forall m \in (2,3], n > 0$$ and $$S(m,n) = 6 - \frac{\lceil n \rceil^2 + 7\lceil n \rceil + 16}{2^{\lceil n \rceil+1}}, \,\, \forall m \in (3,4], n > 0,$$ and so on. We can then also get the general asymptotic behavior again by induction, that $$S(m,n) = 2(\lceil m \rceil -1) - \frac{O\left(\lceil n\rceil^{\lceil m \rceil -2}\right)}{2^{\lceil n \rceil}}$$

Dakota Jones and the Slightly Smaller Set of Constraints

Earlier this year, Dakota Jones used a crystal key to gain access to a hidden temple, deep in the Riddlerian Jungle. According to an ancient text, the crystal had exactly six edges, five of which were 1 inch long. Also, the key was the largest such polyhedron (by volume) with these edge lengths.

However, after consulting an expert, Jones realized she had the wrong translation. Instead of definitively having five edges that were 1 inch long, the crystal only needed to have four edges that were 1 inch long. In other words, five edges could have been 1 inch (or all six for that matter), but the crystal definitely had at least four edges that were 1 inch long.

The translator confirmed that the key was indeed the largest such polyhedron (by volume) with these edge lengths. Once again, Jones needs your help. Now what is the volume of the crystal key?

Using the same setup of as the earlier post, without loss of generality, Dakota will assume that the equilateral triangle is situated along the $xy$-plane with vertices as $(0,0,0),$ $(1,0,0)$ and $(1/2, \sqrt{3}/2,0).$ Let $v = (x,y,h)$ be the remaining vertex. Again, without loss of generality, let's assume that the distance from $(0,0,0)$ to $v$ is $1,$ that is, $$x^2 + y^2 + h^2 = 1.$$ Furthermore, the volume of such a triangular pyramid would be $$V(x,y,h) = \frac{1}{3} B h = \frac{\sqrt{3}}{12} h.$$

Therefore, Dakota now needs to find \begin{align*} \max \,\, & \frac{\sqrt{3}}{12} h \\ \text{s.t.} \,\, & x^2 + y^2 + h^2 = 1,\end{align*} which is solved by the optimal vertex of $\hat{v} = (0,0,1),$ for a maximal volume of $$V_\max = V(1) = \frac{\sqrt{3}}{12}.$$