Sunday, January 24, 2021

Skillful Skiing

You and your skiing opponent will complete two runs down the mountain, and the times of your runs will be added together. You and your opponent have the same, identical, independent normal probability distribution of finishing times for each run.

Given that you are ahead after the first run, what’s the probability that you will still be ahead after the second run and earn your gold medal?

Let your two random run completion times be denoted by $X_1$ and $X_2,$ and your opponent's $Y_1$ and $Y_2.$ Let $Z_1$ and $Z_2$ denote the difference between your run time and your opponent's. Then regardless of the initial mean and standard deviation of $X_1,$ $X_2,$ $Y_1,$ and $Y_2,$ $Z_1$ and $Z_2$ will be identical, independent normal variables with mean zero and some irrelevant but identical variance. Without loss of generality, we may in fact assume that the $Z_1$ and $Z_2$ are unit normals (with variance $1$).

Then the answer to the original question is given by $$\mathbb{P} \{ Z_1 + Z_2 \geq 0 \mid Z_1 \geq 0 \} = \frac{\mathbb{P} \{ Z_1 + Z_2 \geq 0, Z_1 \geq 0 \}}{ \mathbb{P} \{ Z_1 \geq 0 \}}.$$ Geometrically, the set $\{ Z_1 + Z_2 \geq 0, Z_1 \geq 0 \}$ can be written in polar coordinates as $\{ (\rho, \vartheta) : -\frac{\pi}{4} \leq \vartheta \leq \frac{\pi}{2} \},$ whereas the set $\{ Z_1 \geq 0 \}$ is given by $\{ (\rho, \vartheta) : -\frac{\pi}{2} \leq \vartheta \leq \frac{\pi}{2} \}.$ So by transforming to polar coordinates, we get the straightforward $$\mathbb{P} \{ Z_1 + Z_2 \geq 0, Z_1 \geq 0 \} = \int_0^\infty \rho e^{-\rho^2 / 2} \,d\rho \int_{-\pi/4}^{\pi/2}\, \frac{d\vartheta}{2\pi} = \frac{ \frac{3\pi}{4} }{ 2\pi} = \frac{3}{8}$$ and $$\mathbb{P} \{ Z_1 + Z_2 \geq 0, Z_1 \geq 0 \} = \int_0^\infty \rho e^{-\rho^2/2} \, d\rho \int_{-\pi/2}^{\pi/2} \, \frac{d\vartheta}{2\pi} = \frac{\pi}{ 2\pi} = \frac{1}{2}.$$

Put altogether, you get a conditional win probability after the first run as $$\mathbb{P} \{ Z_1 + Z_2 \geq 0 \mid Z_1 \geq 0 \} = \frac{3 / 8}{1 / 2} = \frac{3}{4}.$$ Of course, all of this argumentation leaves open not just superliminal but also time-traveling ski runs, so all in all it would be must-see but also potentially not-able-to-be-seen TV!

Sunday, January 17, 2021

Mystery Number Hunt

Find the eight three digit numbers that fill in the grid below such that the product of the digits in the rows and columns equal the numbers in the rightmost column and last row.

$$\begin{array}{|c|c|c|c|} \hline & & & 294 \\ \hline & & & 216 \\ \hline & & & 135 \\ \hline & & & 98 \\ \hline & & & 112 \\ \hline & & & 84 \\ \hline & & & 245 \\ \hline & & & 40 \\ \hline 8,890,560 & 156,800 & 55,566 & \\ \hline \end{array} $$

First, we break down each of the entries in the rightmost column and bottom row in terms of prime decompositions, noting that each has no prime factor larger than 7. That is, \begin{align*} 294 = 2 \cdot 3 \cdot 7^2, \,\,\, 216 = 2^3 \cdot 3^3, &\,\,\, 135 = 3^3 \cdot 5, \,\,\, 98 = 2 \cdot 7^2,\\ 112 = 2^4 \cdot 7, \,\,\, 84 = 2^2 \cdot 3 \cdot 7,& \,\,\, 245 = 5 \cdot 7^2, \,\,\, 40 = 2^3 \cdot 5, \\ 8,890,560 = 2^6 \cdot 3^4 \cdot 5 \cdot 7^3, \,\,\, 156,800 &= 2^7 \cdot 5^2 \cdot 7^2, \,\,\, 55,566 = 2 \cdot 3^4 \cdot 7^3\end{align*}

The third row must have a $5$ in the second column, since the second column must have no multiples of $3$ in it. Similarly, since $294$ can only be expressed as the product of three digits as $6 x 7 x 7,$ not necessarily in that order, the first row must have a $7$ in the second column. Also, the second column of the second row can only be a $4$ or an $8,$ since it cannot have a multiple of $3$ in it. Additionally, there must be a $7$ in the third column of the seventh row as the only other option is $5$ and the third column must have no multiples of $5$ in it.

In the third column there can be only one multiple of $2$ and no more than two additional copies of $7.$ The possible places for a seven in the third column are in the first, fourth, fifth and sixth rows, while a $2$ could be in the fourth, fifth, sixth and eighth rows and a $6$ could occur in the first, second and sixth rows. If a $2$ or $6$ occurs in the second, sixth or eighth rows, then the first, fourth and fifth rows must each have a $7,$ which is too many. So in particular, we see that there must be a $1$ in the third column of the eighth row, leaving the other digits in the eighth row to ba a $5$ and an $8$. Further, since there cannot be a multiple of $2$ in the third column of the second row, the third column must be either a $3$ or a $9,$ which leaves the first column of the second row to either be a $3,$ $6$ or $9.$

Similarly, if a $7$ is in the third column of the sixth row, then only one additional row of the first, fourth and fifth may have a $7$, which leaves at least two multiples of $2,$ which is too many. Therefore, the third column of the sixth row must be $3,$ which leaves the remaining digits of the sixth row to be a $4$ and a $7.$ This leaves us with the following grid of possibilities:

$$\begin{array}{|c|c|c|c|} \hline \{6,7\} & 7 & \{6,7\}& 294 \\ \hline \{3, 6, 9\} & \{4, 8\}& \{3, 9\} & 216 \\ \hline \{3, 9\} & 5 & \{3, 9\} & 135 \\ \hline \{2, 7\} & \{2, 7\} & \{2, 7\} & 98 \\ \hline \{2, 4, 7, 8\} & \{2, 4, 7, 8\} & \{2, 7\} & 112 \\ \hline \{4, 7\} & \{4, 7\} & 3 & 84 \\ \hline \{5, 7\} & \{5, 7\} & 7 & 245 \\ \hline \{5, 8\} & \{5, 8\} & 1 & 40 \\ \hline 8,890,560 & 156,800 & 55,566 & \\ \hline \end{array} $$

At this point, I sort of decided that the number of brute force combinations was roughly small enough. Playing around with the possibilities for a while by hand, yielded the solution:

$$\begin{array}{|c|c|c|c|} \hline 7 & 7 & 6 & 294 \\ \hline 9 & 8 & 3 & 216 \\ \hline 9 & 5 & 3 & 135 \\ \hline 7 & 2 & 7 & 98 \\ \hline 8 & 2 & 7 & 112 \\ \hline 7 & 4 & 3 & 84 \\ \hline 5 & 7 & 7 & 245 \\ \hline 8 & 5 & 1 & 40 \\ \hline 8,890,560 & 156,800 & 55,566 & \\ \hline \end{array} $$

Smart Cats Have 25 Fifes, .... in Expectation

You’re a contestant on the hit new game show, “You Bet Your Fife.” On the show, a random real number (i.e., decimals are allowed) is chosen between $0$ and $100.$ Your job is to guess a value that is less than this randomly chosen number. Your reward for winning is a novelty fife that is valued precisely at your guess.

What number should you guess to maximize the average value of your fifing winnings?

If you guess $x \in [0,100],$ then the payoff function in terms of $x$ and the randomly selected $Y \sim U(0,100)$ is $$v(x|Y) = \begin{cases} x, &\text{if $Y > x$;}\\ 0, &\text{if $Y \leq x.$}\end{cases}$$ So in expectation, we have $$V(x) = \mathbb{E}_Y[v(x|Y)] = x \mathbb{P}[ Y > x ] + 0 \mathbb{P}[ Y \leq x ] = x \left(1-\frac{x}{100}\right).$$

Since $V(x)$ is continuously differentiable and concave, it is maximized exactly at $\hat{x}$ which solves $$V^\prime(\hat{x}) = 1 - \frac{\hat{x}}{50} = 0.$$ That is, the optimal solution is to choose $\hat{x} = 50,$ at which point $$V(\hat{x}) = 50 \left( 1 - \frac{50}{100} \right) = 25.$$

Sunday, January 10, 2021

Marian's Olde Archer-e Game

Marian proposes two similar archery-based games for her true love, Dame Robin of Foxely, who has the peculiar ability to uniformly distribute the landing spot of her arrows along a circular target. Dame Robin will score a point in the archery game for each arrow shot, but must stop once one lands ``further away'' from the center of the target. In the main version of the game, the distance from the center is measured using Euclidean distance, whereas in the variant the circular target is discretized into 10 equally-spaced concentric bands and Dame Robin must cease volleying arrows once an arrow lands in the same or a wider band.

On average, what score can Dame Robin expect to achieve in this archery game?

Let's first tackle the main version of the game and then see how the discretized version compares. Let $S$ be Dame Foxely's score, which is synonymous with the total number of arrows shot. Since Marian's game seems to completely ignore the bearing of the arrows, focusing only on the relative distance of successive arrows from the center of the target, we will focus on the radial distribution of Dame Foxely's arrows.

For the main version of the game, we will try to calculate the probability that $S = k$, that is, the probability that $k$ is the last arrow shot. In particular, assume that the distances from the center of the target for Dame Foxely's $k$ arrows are $r_1, \dots, r_k.$ The event $\{S = k\}$ is equal to the event $\{ r_1 > r_2 > \cdots > r_{k-1}, r_k \geq r_{k-1} \}.$ There are several ways to conclude that $\mathbb{P}[S = k] = \frac{(k-1)}{k!},$ and we will highlight two:

1. Direct calculus approach:

Given that Dame Foxely arrows fall uniformly over the circular target, the radial distribution is $f_r(\rho) = 2\rho,$ for $\rho \in [0,1]$ and $0$ elsewhere. So \begin{align*}\mathbb{P}[S = k] &= \mathbb{P}\left[ r_1 > r_2 > \cdots > r_{k-1}, r_k \geq r_{k-1} \right]\\ &= \int_0^1 \int_0^{r_1} \int_0^{r_2} \cdots \int_0^{r_{k-2}} \int_{r_{k-1}}^1 2^k r_1 r_2 \cdots r_k \, dr_k \, dr_{k-1} \cdots \,dr_2 \, dr_1.\end{align*}

The iterated integral lends itself to a recursive solution. Define the sequense of polynomials $p_i(t) = a_i (t^2)^{i-1} - b_i (t^2)^i$ with recursion relation $$p_{i+1}(t)= \int_0^t 2s p_i(s) \, ds$$ and initial value $p_1(t) = 1 - t^2,$ that is $a_1 = b_1 = 1.$ Since the innermost integral in the formula for the probability is given by $p_1(r_{k-1}) = \int_{r_{k-1}}^1 2r_k \, dr_k = 1 - r_{k-1}^2,$ by taking the repeated integrals, we see that $\mathbb{P}[S = k] = p_k(1).$

We need to find $a_k$ and $b_k$ by translating the polynomial recursion relation into the relation for the $a_i$ and $b_i$ sequences. Since $$p_{i+1}(t) = \int_0^t 2s p_i(s) \,ds = \int_0^t 2s \left(a_i (s^2)^{i-1} - b_i (s^2)^i \right) \, ds = \frac{a_i}{i} (t^2)^i - \frac{b_i}{i+1} (t^2)^{i+1},$$ we have the recurrence relations $$a_{i+1} = \frac{a_i}{i} \,\, \text{and} \,\, b_{i+1} = \frac{b_i}{i+1}.$$ Given that $a_1 = b_1 = 1,$ we see that $$p_k(t) = \frac{1}{(k-1)!} (t^2)^{k-1} - \frac{1}{k!} t^{2k},$$ so as desired $$\mathbb{P}[S = k] = p_k(1) = \frac{1}{(k-1)!} - \frac{1}{k!} = \frac{k - 1}{k!}.$$

2. Combinatorial approach:

An integral-free combinatorial approach can be used as well (once we use exclude the measure zero event of two arrows having the same exact distance to the origin). There are $k!$ possible orderings of $k$ values $r_1, \dots, r_k \in [0,1].$ Since these values are distinct there is exactly one ordering in decreasing order $1 \geq r_1 > r_2 > r_3 > \cdots > r_{k-1} > r_k.$ If instead there we want $r_k \geq r_{k-1},$ there are $k-1$ possible places to insert $r_k$. So there are $k-1$ possible orders where $r_1 > r_2 > \cdots > r_{k-1}$ and $r_k \geq r_{k-1}.$ The probability is thus the number of desired orderings over the total possible number of orderings, that is $\mathbb{P}[S = k] = (k-1) / k!.$

Having established that $\mathbb{P}[S = k] = \frac{(k-1)}{k!},$ the expected score is simply calculated as $$\mathbb{E}[S] = \sum_{k=2}^\infty \frac{(k-1)}{k!} \cdot k = \sum_{k=2}^\infty \frac{1}{(k-2)!} = e \approx 2.718281828....$$

Discretized variant

Now that Marian's main game is handled, let's investigate here Firstly, it is clear that discretized version is a lower bound approximation of the main game, as there are clearly shots that might allow Dame Robin to continue shooting in the main game but would land in the same concentric circle thus ending her run in the variant. Further, if we allow the number of concentric bands $N$ to vary and $\mathbb{E}[S_N]$ is the expected score with $N$ discrete bands, then $\mathbb{E}[S_N] \nearrow \mathbb{E}[S] = e,$ as $N \to \infty.$

Fix some $N > 1$ as the number of discrete bands on the target. Let $B_k$ be the $k$th band (out of $N$ bands), which encompasses the entire area between the $(k-1)$th and $k$th concentric circle. Then the probability of an arrow landing in the $k$th band is $$p_k = \mathbb{P}[ A \in B_k ] = \frac{k^2 - (k-1)^2}{N^2} = \frac{2k-1}{N^2}.$$

For any $i = 1, \dots, k,$ let $e_i = \mathbb{E}[ S_N \mid A_1 \in B_i ]$ be the conditional expectation of the score given that the first arrow landed in the $i$th band. For $i=1,$ since no matter what the 2nd arrow will land in band $B_{i_2}$ where $i_2 \geq 1,$ we have $e_1 = \mathbb{E}[ S_N \mid A_1 \in B_1 ] = 2.$

Assume that instead for some $i > 1,$ we have $A_1 \in B_i.$ There are then $i$ distinct possible outcomes for where arrow 2 lands: $A_2 \in B_k$ for $k = 1, \dots, i-1$ or $A_2 \in \bigcup_{k=i}^N B_k.$ The last case results in a score of 2, while for each of the former cases, the conditional expectation is $\mathbb{E}[S_N \mid A_2 \in B_k].$ So from the law of total probability, we get $$e_i = 2 \sum_{k=i}^N p_k + \sum_{k=1}^{i-1} p_k \mathbb{E}[S_N \mid A_2 \in B_k].$$ The only difference between the game play conditional on $\{A_1 \in B_k\}$ for some $k = 1, \dots, i-1$ and the game play condition on $\{A_2 \in B_k\}$ is that the score will be incremented by $1$ for the latter scenario. That is, $$\mathbb{E}[ S_N \mid A_2 \in B_k ] = 1 + \mathbb{E}[ S_N \mid A_1 \in B_k ] = 1 + e_k,$$ so we have \begin{align*}e_i &= 2 \sum_{k=i}^N p_k + \sum_{k=1}^{i-1} p_k (1 + e_k)\\ &= 2 \left( 1 - \sum_{k=1}^{i-1} p_k \right) + \sum_{k=1}^{i-1} p_k (1 + e_k)\\ &= 2 + \sum_{k=1}^{i-1} p_k (e_k - 1).\end{align*} Since this formula holds for all $i > 1,$ if $i > 2,$ then we have \begin{align*}e_i = 2 + \sum_{k=1}^{i-1} p_k (e_k - 1) &= \left(2 + \sum_{k=1}^{i-2} p_k (e_k - 1)\right) + p_{i-1} (e_{i-1} - 1)\\ &= e_{i-1} + p_{i-1} (e_{i-1} - 1)\\ &= (1 + p_{i-1}) e_{i-1} - p_{i-1}.\end{align*}

Note that $e_2 = 2 + p_1 = 1 + (1+p_1).$ Assume that $e_i = 1 + \prod_{k=1}^{i-1} (1+p_k)$ for some $i > 1.$ Then by applying the above formula we get that $$e_{i+1} = (1 + p_i) e_i - p_i = (1 + p_i) \left(1 + \prod_{k=1}^{i-1} (1 + p_k)\right) - p_i = 1 + \prod_{k=1}^i (1+p_i),$$ so by induction we have $e_1 = 2$ and $$e_i = 1 + \prod_{k=1}^{i-1} (1+p_k),$$ for all $i = 2, \dots, N.$

From here, we get \begin{align*}\mathbb{E}[S_N] = \sum_{k=1}^N p_ke_k &= 2p_1 + \sum_{k=2}^N p_k \left(1 + \prod_{j=1}^{k-1} (1 + p_j) \right) \\ &=\sum_{k=1}^N p_k + p_1 + \sum_{k=2}^N p_k \prod_{j=1}^{k-1} (1 + p_j)\\ &= 1 + p_1 + \sum_{k=2}^N p_k \prod_{j=1}^{k-1} (1 + p_j)\\ &= (1 + p_1) \left(1 + p_2 + \sum_{k=3}^N p_k \prod_{j=2}^{k-1} (1+p_j) \right) \\ &= (1 + p_1) (1 + p_2) \left( 1 + p_3 + \sum_{k=4}^N p_k \prod_{j=3}^{k-1} (1 + p_j) \right) \\ &= \cdots = (1 + p_1) (1 + p_2) \cdots (1 + p_{N-2}) \left( 1 + p_{N-1} + p_N (1 + p_{N-1}) \right) \\ &= \prod_{k=1}^N \left(1 + \frac{2k-1}{N^2}\right).\end{align*} Note that for $N = 10,$ we get $$\mathbb{E}[S_{10}] = \prod_{k=1}^{10} \left(1 + \frac{2k-1}{100}\right) \approx 2.150024....$$ For any $N,$ we have $$\mathbb{E}[S_N] = \prod_{k=1}^N \left(1 + \frac{2k-1}{N^2}\right) \leq \exp \left( \sum_{k=1}^N \frac{2k-1}{N^2} \right) = \exp(1) = e,$$ since $\ln(1+x) \leq x.$ Furthermore, since $x - \frac{1}{2} x^2 \leq \ln (1 + x),$ we additionally have \begin{align*}\mathbb{E}[S_N] &\geq \exp \left( \sum_{k=1}^N \frac{2k-1}{N^2} -\frac{1}{2} \sum_{k=1}^N \left( \frac{2k-1}{N^2} \right)^2 \right)\\ &= \exp \left( 1 - \frac{1}{2N^4} \frac{N(2N-1)(2N+1)}{3} \right) \\ &= \exp \left( 1 - \frac{2}{3N} + \frac{1}{6N^3} \right).\end{align*} From the squeeze theorem, then we see what we expected that as $N \to \infty,$ the discretized game approaches the continuous limit $$\lim_{N \to \infty} \mathbb{E}[S_N] = e.$$

Saturday, January 9, 2021

Can't cut squares from here (in the thickest Mainer accent imaginable)

Consider a generic square. It can be subdivided into smaller sub-squares, not necessarily of equal size so that the smaller squares do not overlap. For example, you can slice the big square into four smaller squares, each a quarter of the area of the big square. Or you could slice it into seven squares, if you take one of those four squares and slice it into four yet smaller squares.

What whole numbers of squares can you not slice the big square into?

Let $S$ be the set of whole numbers $n \in \mathbb{N},$ where the original big square can be partitioned into $n$ not necessarily equally sized smaller squares. The problem setup provides a hint that shows that for any $n \in S,$ by taking any single smaller square and dividing it equally into $4$ even smaller squares, we end up with $n + 3$ subsquares, so $n \in S \Rightarrow n+3 \in S.$ So in particular, since $1 \in S$ (just the original square with no further cuts), we have $(3\mathbb{N} + 1) \subset S.$

However, we needn't focus solely on subdividing into $4$ equally sized sub-squares. For instance for any $k \in \mathbb{N}$ we can subdivide into $k^2$ equally sized sub-squares by equally dividing the length and width of the original square into $k$ segments and forming a $k$ by $k$ grid of subsquares. In this case, for any $n \in S,$ we can take any sub-square and replace it with $k^2$ smaller sub-squares, getting $n + k^2 - 1$ total sub=squares. In particular, for $k = 3,$ we get $(8 \mathbb{N} + 1) \subset S,$ which implies that for instance $9 \in S$ and $17 \in S.$

Since $9 \equiv 0 \mod 3,$ by further subdividing squares into equal quarter squares, we get that any multiple of $3$ greater than or equal to $9$ is included in $S.$ That is, $(3 \mathbb{N} \setminus \{0,3,6\} ) \subset S.$ Similarly, since $17 \equiv 2 \mod 3,$ we get that $((3 \mathbb{N} + 2) \setminus \{2, 5, 8, 11, 14\}) \subset S.$ So since all remainders with respect to $3$ are covered for large enough values, we see that \begin{align*}S &= (3 \mathbb{N} + 1) \cup (3 \mathbb{N} \setminus \{0, 3, 6\}) \cup ((3 \mathbb{N} + 2) \setminus \{2, 5, 8, 11, 14\})\\ &= \mathbb{N} \setminus \{2, 3, 5, 6, 8, 11, 14\}.\end{align*}

Thus the complement of $S$ is given by $S^C = \{2, 3, 5, 6, 8, 11, 14\}.$