Amare the ant is traveling within Triangle ABC, as shown below. Angle A measures 15 degrees, and sides AB and AC both have length 1.
Amare starts at point B and wants to ultimately arrive on side AC. However, the queen of his colony has asked him to make several stops along the way. Specifically, his path must:
\cdot Start at point B.
\cdot Second, touch a point — any point — on side AC.
\cdot Third, touch a point — any point — back on side AB.
\cdot Finally, proceed to a point — any point — on side AC (not necessarily the same point he touched earlier).
What is the shortest distance Amare can travel to complete the queen’s desired path?
Amare the evidently male ant knows that that his colony has to travel along the isoceles triagle ABC with smallest angle 15 degrees, but he wants to solve the general problem knowing that almost all queens have the same obscure rules and if he cannot mate with his queen perhaps he can abscond to some other colony to mate with that queen dazzling her with an optimal route, or something, I'm not an myrmecologist. So instead, he will solve the case where the smallest angle is some \theta \in [0, \frac{\pi}{3}).
Amare decides to set up an optimization problem by labeling setting the point A as the origin and B at the point (1,0), thus surmising that C is the point (\cos \theta, \sin \theta). He decides to model his first point on the AC side of the triangle by the variable (\alpha \cos \theta, \alpha \sin \theta) then the point he visits along the AB side as (\beta, 0) and finally returning to the AC side at (\gamma \cos \theta, \gamma \sin \theta) for some 0 \leq \alpha, \beta, \gamma \leq 1. Let d_1(\alpha) = \sqrt{\alpha^2 - 2 \cos \theta \alpha + 1} be the length of Amare's first transit from AB to AC, let d_2(\alpha, \beta) = \sqrt{\alpha^2 - 2 \alpha \beta \cos \theta + \beta^2} be the length of his passage from AC back to AB and d_3(\beta, \gamma) = \sqrt{\beta^2 - 2 \beta \gamma \cos \theta + \gamma^2} the length of the final leg of his journey. Then Amare's total distance traveled is \begin{align*} d(\alpha, \beta, \gamma) &= d_1(\alpha) + d_2(\alpha, \beta) + d_3(\beta, \gamma) \\ &=\sqrt{\alpha^2 - 2 \cos \theta \alpha + 1} + \sqrt{ \alpha^2 - 2 \alpha \beta \cos \theta + \beta^2} + \sqrt{ \beta^2 - 2 \beta \gamma \cos \theta + \gamma^2}.\end{align*}
Taking the gradient, Amare gets that \nabla d = \begin{pmatrix} \frac{\alpha - \cos \theta}{d_1(\alpha)} + \frac{\alpha - \beta \cos \theta}{d_2(\alpha, \beta)} \\
\frac{\beta - \alpha \cos \theta}{d_2(\alpha, \beta)} + \frac{\beta - \gamma \cos \theta}{d_3(\beta, \gamma)} \\ \frac{\gamma - \beta \cos \theta }{d_3(\beta, \gamma)} \end{pmatrix}. For the time being, Amare just wants to find when \nabla d = 0, so he first notices that if this is the case then \gamma = \beta \cos \theta, which in turn means that d_3(\beta, \gamma) = \sqrt{ \beta^2 - 2 \beta \gamma \cos \theta + \gamma^2} = \beta \sin \theta.
Therefore, if \nabla d = 0, then \gamma = \beta \cos \theta and plugging back into \frac{\partial}{\partial \beta} d=0, we also have the equation \frac{\beta - \alpha \cos \theta}{d_2(\alpha, \beta)} + \frac{\beta - \gamma \cos \theta}{d_3(\beta, \gamma)} = \frac{\beta - \alpha \cos \theta}{d_2(\alpha, \beta)} + \sin \theta = 0, or equivalently, \beta = -d_2 \sin \theta + \alpha \cos \theta. Plugging this value of \beta, back into d_2(\alpha, \beta)^2, we get \begin{align*} d_2^2 &= \alpha^2 - 2 \alpha (-d_2\sin \theta + \alpha \cos \theta) \cos \theta + (- d_2 \sin \theta + \alpha \cos \theta)^2 \\ &= \alpha^2 - 2 \alpha^2 \cos^2 \theta + 2 \alpha d_2 \sin \theta \cos \theta + d_2^2 \sin^2 \theta - 2 \alpha d_2 \sin \theta \cos \theta + \alpha^2 \cos^2 \theta \\ &= (1- \cos^2 \theta) \alpha^2 + d_2^2 \sin^2 \theta\end{align*} or equivalently d_2(\alpha, \beta) = \alpha \tan \theta. Plugging this value back into the formula for \beta, we get \beta = -d_2 \sin \theta + \alpha \cos \theta = \alpha \bigl( \cos \theta - \sin \theta \tan \theta\bigr) = \alpha \frac{\cos 2\theta}{\cos \theta}.
So finally, plugging back into \frac{\partial}{\partial \alpha} d = 0 we get \begin{align*}0 &= \frac{\alpha - \cos \theta}{d_1} + \frac{\alpha - \beta \cos \theta}{d_2}\\ &= \frac{\alpha - \cos \theta}{d_1} + \frac{ \alpha - \alpha \frac{\cos 2 \theta}{\cos \theta} \cos \theta }{ \alpha \tan \theta}\\ &= \frac{\alpha - \cos \theta}{d_1} + \frac{1 - \cos 2\theta}{\tan \theta}\\ &= \frac{\alpha - \cos \theta}{d_1} + \sin 2\theta\end{align*} or equivalently d_1 = \frac{\cos \theta - \alpha}{ \sin 2\theta}. Plugging this back into d_1^2 we get \alpha^2 - 2 \alpha \cos \theta + 1 = \frac{ \cos^2 \theta - 2 \alpha \cos \theta + \alpha^2 }{ \sin^2 2\theta } or equivalently \cos^2 2\theta \alpha^2 - 2 \cos \theta \cos^2 2\theta \alpha + \cos^2 \theta - \sin^2 2\theta = 0. Solving the quadratic equation we get \begin{align*}\alpha &= \frac{2 \cos \theta \cos^2 2\theta \pm \sqrt{ 4 \cos^2 \theta \cos^4 2\theta -4 (\cos^2 2\theta) (\cos^2 \theta - \sin^2 2\theta)}}{2 \cos^2 2\theta}\\ &= \cos \theta \pm \frac{ 2 \cos 2\theta \sqrt{\cos^2 \theta \cos^2 2\theta - \cos^2 \theta + \sin^2 2\theta}}{2\cos^2 2\theta} \\ &= \cos \theta \pm \frac{\sqrt{\cos^2 \theta ( \cos^2 2\theta - 1) + \sin^2 2\theta}}{\cos 2\theta} = \cos \theta \pm \frac{ \sqrt{ \sin^2 2\theta (1 - \cos^2 \theta) }}{\cos 2\theta} \\ &= \cos \theta \pm \frac{ \sin 2\theta \sin \theta }{\cos 2\theta} = \cos \theta \pm \sin \theta \tan 2\theta = \frac{\cos \theta \cos 2\theta \pm \sin \theta \sin 2\theta}{\cos 2\theta}\end{align*} that is either \alpha = \frac{\cos \theta}{\cos 2\theta} \,\,\, \text{ or } \,\,\, \alpha = \frac{\cos 3\theta}{\cos 2\theta}. Since \frac{\cos \theta}{\cos 2\theta} \not \in [0,1] for any \theta \in [0,\frac{\pi}{3}), Amare will go with \alpha = \frac{\cos 3\theta}{\cos 2\theta} whenever \theta \in [0, \frac{\pi}{6}) and in this case, d_1 = \frac{\cos \theta - \frac{\cos 3\theta}{\cos 2\theta}}{\sin 2\theta} = \frac{\sin \theta}{\cos 2\theta}. Note that when \theta \in [\frac{\pi}{6}, \frac{\pi}{3}) we have \alpha = 0 and d_1 = 1.
So if \theta \in [0, \frac{\pi}{6}), then \begin{align*}\hat{\alpha} &= \frac{\cos 3\theta}{\cos 2\theta}, \\\hat{\beta} &= \hat{\alpha} \frac{\cos 2\theta}{\cos \theta} = \frac{\cos 3\theta}{\cos \theta} \\ \hat{\gamma} &= \hat{\beta} \cos \theta = \cos 3\theta\end{align*} and the shortest distance is \begin{align*}\hat{d} &= d(\hat{\alpha}, \hat{\beta}, \hat{\gamma}) = d_1 + d_2 + d_3 = \\ &= \frac{\sin \theta}{\cos 2\theta} + \frac{\cos 3\theta}{\cos 2\theta} \tan \theta + \frac{\cos 3\theta}{\cos \theta} \sin \theta\\ &= \sin \theta \left( \frac{\cos \theta + \cos 3\theta + \cos 2\theta \cos 3\theta}{\cos \theta \cos 2\theta} \right) \\ &= \sin \theta \left( \frac{ \cos \theta + 2 \cos^2 \theta \cos 3\theta }{\cos \theta \cos 2\theta } \right) \\ &= \sin \theta \left( \frac{1 + 2 \cos \theta \cos 3\theta}{\cos 2 \theta} \right) \\ &= \sin \theta \left( \frac{1 + \cos 4\theta + \cos 2\theta}{\cos 2\theta} \right) \\ &= \sin \theta \left( \frac{2 \cos^2 2\theta + \cos 2\theta }{\cos 2\theta} \right)\\ &= \sin \theta ( 2 \cos 2\theta + 1 ) = \sin \theta (2 \cos^2 \theta + \cos 2\theta) \\ &= \sin 2\theta \cos \theta + \sin \theta \cos 2\theta = \sin 3\theta. \end{align*} In particular, when \theta = \frac{\pi}{12}, we get that Amare's shortest path for his home colony's queen is \hat{d} = \sin \frac{\pi}{4} = \frac{\sqrt{2}}{2}. Whenever \theta \in [\frac{\pi}{6}, \frac{\pi}{3}) then \hat{\alpha}=\hat{\beta}=\hat{\gamma} = 0 and \hat{d} = 1.