# A Straightforward optimization problem, but without calculus

I am helping a middle schooler out with the following Art of Problem Solving competition problem:

An ant travels from the point $$A (0,-63)$$ to the point $$B (0,74)$$ as follows. It first crawls straight to $$(x,0)$$ with $$x \ge 0$$, moving at a constant speed of $$\sqrt{2}$$ units per second. It is then instantly teleported to the point $$(x,x)$$. Finally, it heads directly to $$B$$ at 2 units per second. What value of $$x$$ should the ant choose to minimize the time it takes to travel from $$A$$ to $$B$$?

A straightforward but somewhat tedious solution involves using calculus to optimize the time taken as a function of x (with this method we get $$\approx 23.3$$). However, the student I am helping has not been introduced to calculus, and I was beating my head against a wall trying to find a clever way to solve this with simpler methods like algebra with quadratics or geometry. For instance, The function of x which represents the time of the ants travel is:

$$T = \frac{\sqrt{x^2 + 63^2}}{\sqrt{2}} + \frac{\sqrt{x^2 + (74-x)^2}}{2}$$

I thought that, instead of minimizing $$T$$ w.r.t $$x$$, I could minimize $$T^2$$ , which I would then be able to algebraically massage into the form of a quadratic equation. Simple knowledge of the properties of these equations would allow for a location of the minimum. This approach stalled out due to the cross term that results from the RHS. Any help would be appreciated

• Regardless of how much time has passed, you would want the distance from (x, x) to (0, 74) be a minimum. This will be the solution. Commented Jan 16, 2021 at 18:09
• @JimClark That is not true... Commented Jan 16, 2021 at 18:16
• @JimClark I thought that this would be the case at first, but you have to recognize that the ant is traveling across the two segments at different speeds. If we were to just minimize the segment you mention, we would have to pick x = 37, but this is not a global minimum of the distance function above. T(37) ~ 77.8, but T(23.3) ~ 75.3, which is less than what we would get if we were to just minimize the segment you mentioned. Commented Jan 16, 2021 at 18:18
• Nice work on the formatting, welcome to MSE. Commented Jan 16, 2021 at 18:46
• I was grossly mistaken. I read it as if it traveled to the origin then was transported. Commented Jan 16, 2021 at 23:37

This question can be solved 'in a flash' when looked at in the right way.

If you look at the second term in your expression for time, you can simplify it to $$\frac{\sqrt{(x-37)^2+37^2}}{\sqrt2}.$$

We have now, in effect, made it a route with two legs travelled at the same speed, $$\sqrt2$$.

Furthermore, you will be able to draw this as a route travelling from $$(0,0)$$ to $$(37,100)$$ via a point at $$(x,63)$$.

For a straight line route make $$x/37=63/100$$ and the problem is solved.

• Very nice transformations! Commented Jan 16, 2021 at 18:54
• Thanks! a very elegant solution. Commented Jan 16, 2021 at 19:07

We rephrase the problem: the bug does not teleport, but instead heads from $$(0,-63)$$ to $$(x,0)$$ at $$\sqrt{2}$$ units per second and then heads from $$(x,0)$$ to $$(0,74-x)$$ at $$2$$ units per second, since the time taken is the same for the bug.

Now, the key is that the points $$(0,74-x)$$, $$(x,0)$$, and $$(37,37)$$ always form an isosceles right triangle! So, we say that the bug heads from $$(0,-63)$$ to $$(x,0)$$ at $$\sqrt{2}$$ units per second, and then travels from $$(x,0)$$ to $$(37,37)$$ at $$\sqrt{2}$$ units per second as well (since the time taken for the bug is again the same).

Now, to minimize the time, we want $$(0,-63)$$, $$(x,0)$$ and $$(37,37)$$ to be on a line (since the shortest distance between 2 points is a line.) The equation for the line through $$(0,-63)$$ and $$(37,37)$$ is $$y = \frac{100}{37}x - 63$$, so the bug heads through $$(\frac{2331}{100},0)$$, giving our answer of $$\frac{2331}{100}$$.

• Nice work finding that triangle Commented Jan 16, 2021 at 21:26