Sunday, June 6, 2021

Mathemagical Mastery

Max the Mathemagician is calling for volunteers. He has a magic wand of length $10$ that can be broken anywhere along its length (fractional and decimal lengths are allowed). After the volunteer chooses these breakpoints, Max will multiply the lengths of the resulting pieces. For example, if they break the wand near its midpoint and nowhere else, the resulting product is $5\times 5$, or $25$. If the product is the largest possible, they will win a free backstage pass to his next show. (Amazing, right?)

You raise your hand to volunteer, and you and Max briefly make eye contact. As he calls you up to the stage, you know you have this in the bag. What is the maximum product you can achieve?

In order to get backstage with Max or Zax or ?ax the Mathemagician, let's solve the general problem of Generic the Mathemagician whose magic wand has length $L.$ Here we will also solve the general problem by assuming that we want to maximize the product using exactly $n-1$ cuts for some as yet undetermined $n \in \mathbb{N}.$ In fact, define $P(n,L)$ to be the maximum product one can get from multiplying the lengths of the pieces after making $n-1$ cuts in a wand of length $L.$ In particular, $$P(n,L) := \max \left\{ \prod_{i=1}^n x_i \biggr\vert \sum_{i=1}^n x_i = L, \, 0 \leq x_i \leq L, i = 1,\dots, n \right\}.$$ Since the natural logarithm is monotonically increasing, the problem is equivalent to solving the following \begin{align*}\ln P(n,L) = \max \, & \, \sum_{i=1}^n \ln x_i \\ \text{s.t.} \, & \, \sum_{i=1}^n x_i = L \\ & \, 0 \leq x_i \leq L, \, i = 1, \dots, n.\end{align*}

The Lagrangian on this later formulation is $$\mathcal{L}(x, \lambda) = \sum_{i=1}^n \ln x_i + \mu \left( \sum_{i=1}^n x_i - L \right)$$ which has gradient $$\nabla_x \mathcal{L}(x,\lambda) = \begin{pmatrix} 1/x_1 + \mu \\ 1/x_2 + \mu \\ \dots \\ 1/x_n + \mu \end{pmatrix},$$ so for any $\mu \in \mathbb{R},$ the only stationary point is $\hat{x}(\mu) = (-1/\mu, \dots, -1/\mu) \in \mathbb{R}^n.$ So, in order to satisfy the condition that $\sum_{i=1}^n x_i = -n/\mu = L,$ we need $\hat{\mu} = -n/L,$ in which case $\hat{x} = (L/n, \dots, L/n)$ is the optimal solution and $$P(n,L) = \left(\frac{L}{n}\right)^n.$$

For the moment, let's extend this problem to allow for a non-integral number of cuts. That is, define $$\tilde{P}(x,L) = \left( \frac{L}{x} \right)^x = \exp ( x \ln L - x \ln x ),$$ such that for $x \in \mathbb{N},$ $\tilde{P}(x,L) = P(x,L).$ In this case, $$\frac{\partial}{\partial x} \tilde{P}(x,L) = (\ln L - 1 - \ln x) \tilde{P}(x,L)$$ such that for any $L$ the maximal value of $$\hat{x}_L = \arg\!\max \{ \tilde{P}(x,L) \mid x \geq 0 \} = \frac{L}{e}.$$ Therefore, we have for any $L,$ that the $$\max_{n \in \mathbb{N}} P(n,L) = \max \left\{ P\left( \left\lfloor \frac{L}{e} \right\rfloor, L \right), P\left( \left\lceil \frac{L}{e} \right\rceil, L \right) \right\} \sim e^{L/e}.$$ In particular, for Max (where $L=10$) we have $\hat{n} = \lceil 10 /e \rceil = 4$ equal cuts for a maximal product of $(2.5)^4 = 39.0625.$ For Zax (where $L=100$), we have $\hat{n} = \lceil 100 / e \rceil = 37$ equal cuts with maximal product of $(100/37)^{37} = 9.474 \times 10^{15}.$

No comments:

Post a Comment