Ant highway with energy loss

Calculus Level 3

An ant starts at the center of the image. The ant only has enough energy to walk for 10 meters (1 meter = 1 grid) on one of the highways (directly north, east, south, and west) before stopping.

However, if it goes off the highway, more energy is needed for the same distance. That is, the further the ant deviates, the greater the energy consumption, as represented by the factor 1 + 0.4 d 1+0.4d , where d d is the distance in meters to the nearest highway. For example, if the ant is 1 meter away from the nearest highway, it uses 1.4 times the energy on the highway to walk 1 meter.

What is the area (in square meters) of the set of points the ant can reach before getting tired and stopping?

The above is one possible path (in red). The ant walks 5 meters north and then curves off towards the right. The above is one possible path (in red). The ant walks 5 meters north and then curves off towards the right.


The answer is 185.46.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

4 solutions

Mark Hennings
Jul 29, 2018

Restrict attention to when the ant is moving in the octant x 0 x \ge 0 , 0 y x 0 \le y \le x . Suppose that the ant leaves the x x -axis at ( K , 0 ) (K,0) . To travel furthest, we are interested in minimizing the energy expenditure E = K + K x ( 1 + α y ) 1 + ( y ) 2 d x E \;= \; K + \int_K^x(1 + \alpha y)\sqrt{1 + (y')^2}\,dx (where α = 0.4 \alpha = 0.4 ) for paths y ( x ) y(x) for K < x < 10 K < x < 10 such that y ( K ) = 0 y(K) = 0 . This Calculus of Variations problem tells us that F y F y F- y'\frac{\partial F}{\partial y'} is constant, where F = ( 1 + α y ) 1 + ( y ) 2 F = (1 + \alpha y)\sqrt{1 + (y')^2} . Solving the differential equation 1 + α y 1 + ( y ) 2 = c o n s t \frac{1+\alpha y}{\sqrt{1+(y’)^2}} = \mathrm{const} this means that we are looking at functions of the form 1 + α y ( x ) = cosh ( α ( x K ) t ) + 1 t 2 sinh ( α ( x K ) t ) x > K 1 + \alpha y(x) \; = \; \cosh\big(\tfrac{\alpha(x-K)}{t}\big) + \sqrt{1-t^2}\sinh\big(\tfrac{\alpha(x-K)}{t}\big) \hspace{2cm} x > K where 0 < t 1 0 < t \le 1 . The energy expenditure along this path to the point x > K x > K is E ( x ) = K + 1 2 t ( X K ) + 1 4 α [ ( 2 t 2 ) sinh ( 2 α ( x K ) t ) + 2 1 t 2 cosh ( 2 α ( x K ) t ) 2 1 t 2 ] E(x) \; = \; K + \tfrac12t(X-K) + \tfrac{1}{4\alpha}\left[(2-t^2)\sinh\big(\tfrac{2\alpha(x-K)}{t}\big) + 2\sqrt{1-t^2}\cosh\big(\tfrac{2\alpha(x-K)}{t}\big) - 2\sqrt{1-t^2}\right] For particular values of t , K t,K , we can determine the value of x > K x > K for which E ( x ) = 10 E(x)= 10 . The corresponding value of y y for this value of x x marks the dying place of the ant on this path.

Numerical experimentation with Mathematica shows that the dying places are further away from the x x -axis when t = 1 t=1 , which is when the ant departs from the x x -axis as smoothly as possible (so that y ( K ) = 0 y'(K) = 0 ) (see the blue path). Other values of t t "fill in" gaps the the t = 1 t=1 curves leave behind (red paths), and also move the ant into the y > x y > x region. The y > x y> x region is not important, since the ant can reach those points more efficiently by starting along the y y -axis. The t < 1 t < 1 paths are most important in that they enable the ant to reach points in the lune between the t = 1 t=1 path for K = 0 K=0 (the dashed line) and the line y = x y=x .

By symmetry, then, we want 8 8 times area of the shaded wedge-shaped region near the x x -axis (the diagram shows two of the regions we need altogether). We now have to determine the equation of the curved portion of that region (the dying places of the ant moving with t = 1 t=1 , as K K varies from 0 0 to 10 10 . A point ( X , Y ) (X,Y) on that curve satisfies the equations 1 + α Y = cosh ( α ( X K ) ) 10 = 1 2 ( X + K ) + 1 4 α sinh ( 2 α ( X K ) ) 1 + \alpha Y \; = \; \cosh(\alpha(X-K)) \hspace{2cm} 10 \; = \; \tfrac12(X+K) + \tfrac{1}{4\alpha}\sinh(2\alpha(X-K)) Eliminating K K from these equations, we obtain the equation 10 = X 1 2 α cosh 1 ( 1 + α Y ) + 1 2 α ( 1 + α Y ) ( 1 + α Y ) 2 1 10 \; = \; X - \tfrac{1}{2\alpha}\cosh^{-1}(1 + \alpha Y) + \tfrac{1}{2\alpha}(1 + \alpha Y)\sqrt{(1 + \alpha Y)^2 - 1} Since we are only interested in the portion of this curve corresponding to the parameter 0 < K < 10 0 < K < 10 , we need to find the start and end points. The point K = 10 K=10 occurs at ( 10 , 0 ) (10,0) , and the value for K = 0 K=0 can be found to occur at x = 4.05115 x = 4.05115 . This left-hand endpoint does not lie on the line y = x y=x , although it appears to do so from the first picture. A close-up view of that point of the graph shows that the wedge-shaped region meets the line y = x y=x at ( u , u ) (u,u) , where u = 4.06205 u = 4.06205 . There is a very small amount of overlap. Thus we need to calculate 8 0 u ( 10 + 1 2 α cosh 1 ( 1 + α Y ) 1 2 α ( 1 + α Y ) ( 1 + α Y ) 2 1 Y ) d Y 185.466 8\int_0^u \left(10 + \tfrac{1}{2\alpha}\cosh^{-1}(1 + \alpha Y) - \tfrac{1}{2\alpha}(1 + \alpha Y)\sqrt{(1 + \alpha Y)^2 - 1} - Y\right)\,dY \; \approx \; \boxed{185.466}

Ever since I found this would be a POTW I've been worried that I was completely wrong since no one had gotten it correct. Seeing this solution is a great relief. I'm not well versed with cosh and sinh but cosh-1 has a nice form with logarithms which I used instead. And then I had to approximate things at the end.

I was hoping to see a solution like yours to see how to actually solve this problem. I don't know if my solution actually makes much sense, but it challenged me mightily.

Jeremy Galvagni - 2 years, 10 months ago

Log in to reply

It's pretty scary heading into a POTW without a solver. This problem took me quite a while - I still do not have a good analytic reason (although there are compelling heuristic ones) why the t = 1 t=1 dying places are optimal - and I used Mathematica to evaluate the final integral (although an explicit solution is possble). I enjoyed the challenge you set...

On the downside, look forward to the Brilliant algorithm downgrading your problem to Level 3 once a few thousand people have looked at it. It has happened to me twice now

Mark Hennings - 2 years, 10 months ago

It would have been nice for me to have had a litlte more time to try to solve your problem in time for posting it for POTW. Then when I saw that Mark became a solver, I knew thd odds favored both of you being right, so I peeked both yours and Marks solutions. The minute I saw Mark's curves ending perpendicular to the boundary, I knew he had it.

Maybe I should still finish solving this to see if I can offer a 2nd corroborating value, if other solvers are slow in coming forward.

Michael Mendrin - 2 years, 10 months ago

Log in to reply

Oh right. Perpendicular to the boundary! That might be the hint I need to finish my solution.

Jeremy Galvagni - 2 years, 10 months ago

Energy-optimal lines will, of course, always be perpendicular to energy contours ("isojoules"?).

Mark Hennings - 2 years, 10 months ago

I kept reworking this one as I was really hoping that it would have an elegant solution - clearly not there..

Krishnaraj Sambath - 2 years, 10 months ago
Jeremy Galvagni
Jul 25, 2018

This solution isn't exact but I hope it is precise enough.

First, let's find the shape of the curved path. Think of the energy requirement as the classic swimming vs running optimization problem. When the swimming speed is a factor 0 < a < 1 0<a<1 of the running speed, the angle with the shore you should swim can be shown to be θ = arctan a 2 1 \theta = \arctan{\sqrt{a^{2}-1}} .

In this case, if we let x x =the distance from the highway and we measure the angle clockwise from due north (as in the picture) the angle becomes 90 arctan ( . 4 x + 1 ) 2 1 90-\arctan{\sqrt{(.4x+1)^{2}-1}} and we can create a slope function:

f ( x ) = tan ( 90 arctan 0.16 x 2 + 0.8 x ) = 1 0.16 x 2 + 0.8 x f'(x)=\tan{(90-\arctan{\sqrt{0.16x^{2}+0.8x}})}=\frac{1}{\sqrt{0.16x^{2}+0.8x}}

The antiderivative of this giving the actual optimum path for the ant to get as far to the right as possible (thanks to WolframAlpha):

f ( x ) = 5 log ( 0.2 x + 1 + 0.2 x ) + C f(x)=5\log{(\sqrt{0.2x+1}+\sqrt{0.2x})}+C , where the constant is just the point where the ant veers off the highway. This is the function plotted on the picture with C = 5 C=5 . I will continue to use C C for this.

Now we need to find the actual distance the ant can go along this path. This isn't just the length of the curve, though, because it has to factor in the energy requirement as x x increases. In other words, I'd like to use the integral 1 + 1 0.16 x 2 + 0.8 x d x = 0.4 x + 1 0.16 x 2 + 0.8 x = x 2 + 5 x \int \sqrt{1+\frac{1}{0.16x^{2}+0.8x}}dx=\int \frac{0.4x+1}{\sqrt{0.16x^2+0.8x}}=\sqrt{x^{2}+5x} but I can't. I have to multiply the integrand by an extra factor of 0.4 x + 1 0.4x+1 which makes the answer much messier:

( 0.4 x + 1 ) 2 0.16 x 2 + 0.8 x d x = x x + 5 ( 0.2 x 2 + 1.5 x + 2.5 ) + 2.5 log ( 0.2 x + 1 + 0.2 x ) \int \frac{(0.4x+1)^{2}}{\sqrt{0.16x^{2}+0.8x}}dx =\sqrt{\frac{x}{x+5}}(0.2x^{2}+1.5x+2.5)+2.5\log{(\sqrt{0.2x+1}+\sqrt{0.2x}})

If the limits of integration are 0 0 and x m a x x_{max} then it might be possible to find a function for the set of the furthest points that are reachable. For a given C C traveled along the highway, the ant will use energy 10 C 10-C to travel off the highway. The best I could do was set the integral equal to different values of 10 C 10-C and solve numerically for x m a x x_{max} then find y m a x = f ( x m a x ) + C y_{max}=f(x_{max})+C . The green dotted line is from letting C = 5 C=5 and solving to get x m a x 2.0650 x_{max}\approx 2.0650 when corresponds to y m a x 8.0253 y_{max}\approx8.0253 which is the point where the line and curve cross.

So what I did to find an approximate area was I found these points for C = 0 , 1 , 2 , . . . 10 C=0,1,2,... 10 and fit a quartic polynomial. The branches of the north and east highways cross at about 4.062 , 4.062 4.062,4.062 corresponding to C = 0.013 C=0.013 .

A final bit of integrating on the polynomial gives each eighth of the final shape having area 23.1826 23.1826 and the final area approximately 185.46 m 2 \boxed{185.46}m^{2}

I don't understand the problem. In the example, the ant is 1 meter away from the nearest highway. But since the highways form a grid and are 1 m apart, the and ant can never be more than 0.5 meters away from the nearest highway.

Tapani Lindgren - 2 years, 7 months ago
Darko Simonovic
Aug 1, 2018

Here is an alternative derivation of the cost function E ( x , y ) E(x,y) to the Mark Hennings's solution. Please take a look at his derivation, as it is clearly explained. This derivation could be viewed as a dynamic programming scheme in the limit of Δ x \Delta x and Δ y \Delta y going to zero.

General steps are similar to Mark Hennings's solution (except of no Calculus of Variations). Additionally to the cost function E ( x , y ) E(x,y) , the starting point has to be derived separately, in order to check if the ant started from negative part of the x-axis, thus making calculated boundary a false one.

Here is the sketch:

i) Derive the cost function E ( x , y ) E(x,y) . Ant is starting from ( x , 0 ) (x,0) with the initial cost E ( x , 0 ) = x E(x,0)=x (thus negative x x will boost the ant's energy).

ii) Find boundary such that E ( x , y ) = 10 E(x,y)=10 .

iii) Find numerically the intersection between diagonal and the boundary. Equivalently, find point x d x_d , such that E ( x d , x d ) = 10 E(x_d,x_d)=10 (above the diagonal, the ant will take y-axis route)

iv) The ant might start from negative x x -axis, thus derive the starting position for each point X 0 ( x , y ) X_0(x,y) and check if X 0 ( x d , x d ) < 0 X_0(x_d,x_d)<0

v) Calculate integral A = 8 y = 0 x d [ x ( y ) y ] d y A=8*\int_{y=0}^{x_d}\left[x(y)-y\right]dy

i) Derive the cost function E(x,y)}

If E ( x , y f i x e d ) E(x,y_{fixed}) is known for all x, the goal is to find E ( x , y f i x e d + Δ y f i x e d ) E(x,y_{fixed}+\Delta y_{fixed}) . Looking backwards from a point ( x f i x e d , y f i x e d + Δ y f i x e d ) (x_{fixed},y_{fixed}+\Delta y_{fixed}) , the ant had to choose an optimal route going through some previous point ( x , y f i x e d ) (x,y_{fixed}) , and the goal is to find optimal x. I will drop subscript f i x e d _{fixed} from the rest of the text and introduce x = x f i x e d Δ x x=x_{fixed}-\Delta x (where Δ x \Delta x is the only parameter to vary). Energy function is:

E ( x , y + Δ y ) = min Δ x [ E ( x Δ x , y ) + ( 1 + α y ) Δ x 2 + Δ y 2 ] E(x,y+\Delta y) = \min\limits_{\Delta x} \left[ E(x-\Delta x,y) + (1+\alpha y)\sqrt{\Delta x^2 +\Delta y^2}\right]

E ( x , y ) + E y Δ y = min Δ x [ E ( x , y ) E x Δ x + ( 1 + α y ) Δ x 2 + Δ y 2 ] E(x,y) + \frac{\partial E}{\partial y} \Delta y = \min\limits_{\Delta x} \left[ E(x,y) - \frac{\partial E}{\partial x} \Delta x + (1+\alpha y)\sqrt{\Delta x^2 +\Delta y^2}\right]

To minimize right hand side, derivative with respect to Δ x \Delta x has to be identical to zero:

E x = ( 1 + α y ) Δ x Δ x 2 + Δ y 2 \frac{\partial E}{\partial x} = (1+\alpha y)\frac{\Delta x}{\sqrt{\Delta x^2 +\Delta y^2}}

Plugging back Δ x \Delta x into the equation for E ( x , y ) E(x,y) and rearranging gives:

E y = ( 1 + α y ) 2 ( E x ) 2 \frac{\partial E}{\partial y} =\sqrt{\left(1+\alpha y\right)^2- \left(\frac{\partial E}{\partial x}\right)^2}

It would be nice if E x \frac{\partial E}{\partial x} is constant. Let's try solution of the form E ( x , y ) = E ( x , 0 ) + F ( y ) E(x,y) = E(x,0) + F(y) , where E ( x , 0 ) = x E(x,0)=x . This indeed satisfy boundary condition and reduces PDE to an ordinary differential equation:

F ( y ) = α y ( y + 2 / α ) F'(y)=\alpha\sqrt{y(y+2/\alpha)}

Solving F ( y ) F(y) using Euler substitution or a table of integrals with F ( 0 ) = 0 F(0)=0 gives:

E ( x , y ) = x + α y + 1 2 y ( y + 2 / α ) 1 α ln ( α y / 2 + 1 + α y / 2 ) E(x,y) = x+\frac{\alpha y+1}{2}\sqrt{y(y+2/\alpha)} - \frac{1}{\alpha}\ln \left(\sqrt{\alpha y/2+1}+\sqrt{\alpha y/2}\right)

ii) The boundary

E ( x , y ) = 10 E(x,y) =10 is easy to invert. x ( y ) = 10 α y + 1 2 y ( y + 2 / α ) + 1 α ln ( α y / 2 + 1 + α y / 2 ) x(y)=10 - \frac{\alpha y+1}{2}\sqrt{y(y+2/\alpha)} + \frac{1}{\alpha}\ln \left(\sqrt{\alpha y/2+1}+\sqrt{\alpha y/2}\right)

iii) Find numerically intersection between diagonal and the boundary

for x = y = 4.06205 x=y=4.06205 the cost is E ( 4.06205 , 4.06205 ) = 10.00000636... E(4.06205,4.06205)=10.00000636...

iv) Derive the starting position for each point X 0 ( x , y ) X_0(x,y)

Similarly as with E ( x , y ) E(x,y) , we define X 0 ( x , y ) X_0(x,y) to be a point on x x -axis at which ant left the x x -axis (thus X 0 X_0 act as a memory storage for the ant to remember initial x x as it traverses on an optimal route). Thus X 0 ( x , 0 ) = x X_0(x,0)=x and:

X 0 ( x , y + Δ y ) = X 0 ( x Δ x , y ) X_0(x,y+\Delta y) = X_0(x-\Delta x, y)

with Δ x \Delta x being a parameter to be optimized. The optimal relation Δ y Δ x = α y ( y + 2 / α ) \frac{\Delta y}{\Delta x}=\alpha\sqrt{y(y+2/\alpha)} is the one already found in the process of calculating E ( x , y ) E(x,y) taking into account that E ( x , y ) x = 1 \frac{\partial E(x,y)}{\partial x}=1 .

X 0 ( x , y ) + X 0 ( x , y ) y Δ y = X 0 ( x , y ) X 0 ( x , y ) x Δ x X_0(x,y) + \frac{\partial X_0(x,y)}{\partial y}\Delta y=X_0(x,y)-\frac{\partial X_0(x,y)}{\partial x}\Delta x

X 0 ( x , y ) y α y ( y + 2 / α ) + X 0 ( x , y ) x = 0 \frac{\partial X_0(x,y)}{\partial y}\alpha\sqrt{y(y+2/\alpha)}+\frac{\partial X_0(x,y)}{\partial x}=0

Similarly to E ( x , y ) E(x,y) , it would be nice if both terms are constants, thus postulate a solution of the form X 0 ( x , y ) = X 0 ( x , 0 ) + G ( y ) X_0(x,y)=X_0(x,0)+G(y) , which successfully reduces PDE to ODE, while satisfying boundary conditions. Complete solution is:

X 0 ( x , y ) = x + 2 α ln ( α y / 2 + 1 + α y / 2 ) X_0(x,y) = x+\frac{2}{\alpha}\ln \left(\sqrt{\alpha y/2+1}+\sqrt{\alpha y/2}\right)

Now, one can verify that X 0 ( x = 4.06205 , y = 4.06205 ) = 0.0127 X_0(x=4.06205,y=4.06205)=0.0127 , meaning that ant left from (0.0127,0) in order to reach (4.06205,4.06205).

v) Finally computing the integral

Integral from the x = y x=y (diagonal) to the boundary, which is given as x = x ( y ) x=x(y) is:

A= 8 y = 0 y = 4.06205 ( 10 α y + 1 2 y ( y + 2 / α ) + 1 α ln ( α y / 2 + 1 + α y / 2 ) y ) d y 185.466 8\int_{y=0}^{y=4.06205}\left(10 - \frac{\alpha y+1}{2}\sqrt{y(y+2/\alpha)} + \frac{1}{\alpha}\ln \left(\sqrt{\alpha y/2+1}+\sqrt{\alpha y/2}\right) - y\right)dy\approx 185.466

EDIT :

Please see comments bellow. As pointed out by Mark Hennings, initial form of PDE: ( E x ) 2 + ( E y ) 2 = ( 1 + α y ) 2 \left(\frac{\partial E}{\partial x}\right)^2 + \left(\frac{\partial E}{\partial y}\right)^2 =\left(1+\alpha y\right)^2 did not have a unique solution. This was my bad, as I blindly squared equation. Changed the form of the PDE (so no squaring). I believe solution to this PDE is unique given boundary condition, but it is beyond my level to prove it (except as a numerical construction). Added few words to make clear that solution satisfies boundary condition.

There is one more place where I took square / square root (when deriving Δ y / Δ x \Delta y / \Delta x in iv ), but that one should be safe, given already found solution for E(x,y), and the implicit, but crucial point during the construction that Δ y > 0 \Delta y > 0 .

It is a shame that a key part of your argument in (i) is “it would be nice if”... There are solutions to your PDE that are not of the form you want.

Mark Hennings - 2 years, 10 months ago

Log in to reply

Thank you for catching that part. I vaguely remembered something about uniqueness and boundary conditions, and I intuitively believed that given a solution that satisfy boundary conditions and the PDE will lead to uniqueness.

My other rational is the way E(x,y) is build computationally: given an empty discrete 2D array E(x,y) and an initial E(x,y=0)=x, it is built upwards, adding each row E(x,y+dy), given a previous one E(x,y). This can be done as a dynamic programming scheme (initial equation), or as a discretization of the PDE. This filling of the 2D array is unique in the first schemes, but the arbitrariness with the PDE completely skipped my attention. Unfortunately the square messes things up, as square root has 2 solutions. I should have left PDE without squaring it, making it a bit messier, but unique (probably).

This said, I am not able to derive uniqueness of the "non-squared" version of PDE (except as a numerical construction), but I would like to here your thoughts on this.

Darko Simonovic - 2 years, 10 months ago
Vinod Kumar
Aug 2, 2018

In my approach, the ant travels vertically along the y-highway and goes off at 45° into positive (x-y) quardant from y=0 to y=10.

The approach gives symmetry along (y =x and y=-x) in all quadrants and divides the field in 8 equal zones.

The vertical distance 'x' along the slanted line at 45° into the field from y-axis after traveling distance 'y' along y-axis is given by the energy integral along the slanted curve from

(x+0.2x^2)√(1+tan(45°)^2)=(10-y), which using WolframAlpha gives

x=(1/2)[√{(10(10-y)√2)+25} -5],

The maximum value of x=3.95022 occurs when ants goes into the field along 45 ° slanted line from the origin i.e. at y=0 and ant stops at (3.95,3.95)

Thus, in general, the new coordinate at ant stoppage is (x, x+y).

The area under the curve along the y-axis in the positive (x-y) quadrant is given by WolframAlpha

Integral [(x√2)(dy/√2)] (y, 0 to 10) = {25(((1+4√2)^(3/2)) -1)/(6√2)} -25 =22.6568

Multiplying by 8, the total area covered by the ant (Answer=181.2547)

This is't perfectly correct but Brilliant allows you to be within 3%, so it's a reasonable estimate.

Even though the actual path is a curve that begins tangent to the y-axis, a 45-degree segment gets you surprisingly close.

(My solution is also an estimate.)

Jeremy Galvagni - 2 years, 10 months ago

Log in to reply

I think, a curve, which has y-axis and 45° degree slanted line as two tangents, can be a option. It will have more of wolfram alpha.

Vinod Kumar - 2 years, 10 months ago

Log in to reply

Because the energy requirement increases with distance, the paths are not straight lines. I did make a problem where energy off the highway is doubled. https://brilliant.org/problems/ant-highway/?ref_id=1531027 This has straight line paths, but not 45 degrees.

Jeremy Galvagni - 2 years, 10 months ago

It is certainly an option, just not the best one. You need to show that no other curve can do better/go further. The study of which curves produce optimal results of various kinds is called the Calculus of Variations, and handles a whole range of classical problems, like the brachistochrone problem - if a marble has to slide from point A to point B under gravity along a smooth track, and has to do so in the shortest time, what is the shape of the path?

Mark Hennings - 2 years, 10 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...