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 , where 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?
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.
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.
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 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
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.
Log in to reply
Oh right. Perpendicular to the boundary! That might be the hint I need to finish my solution.
Energy-optimal lines will, of course, always be perpendicular to energy contours ("isojoules"?).
I kept reworking this one as I was really hoping that it would have an elegant solution - clearly not there..
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 of the running speed, the angle with the shore you should swim can be shown to be θ = arctan a 2 − 1 .
In this case, if we let x =the distance from the highway and we measure the angle clockwise from due north (as in the picture) the angle becomes 9 0 − arctan ( . 4 x + 1 ) 2 − 1 and we can create a slope function:
f ′ ( x ) = tan ( 9 0 − arctan 0 . 1 6 x 2 + 0 . 8 x ) = 0 . 1 6 x 2 + 0 . 8 x 1
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 lo g ( 0 . 2 x + 1 + 0 . 2 x ) + 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 . I will continue to use 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 increases. In other words, I'd like to use the integral ∫ 1 + 0 . 1 6 x 2 + 0 . 8 x 1 d x = ∫ 0 . 1 6 x 2 + 0 . 8 x 0 . 4 x + 1 = x 2 + 5 x but I can't. I have to multiply the integrand by an extra factor of 0 . 4 x + 1 which makes the answer much messier:
∫ 0 . 1 6 x 2 + 0 . 8 x ( 0 . 4 x + 1 ) 2 d x = x + 5 x ( 0 . 2 x 2 + 1 . 5 x + 2 . 5 ) + 2 . 5 lo g ( 0 . 2 x + 1 + 0 . 2 x )
If the limits of integration are 0 and x m a x then it might be possible to find a function for the set of the furthest points that are reachable. For a given C traveled along the highway, the ant will use energy 1 0 − C to travel off the highway. The best I could do was set the integral equal to different values of 1 0 − C and solve numerically for x m a x then find y m a x = f ( x m a x ) + C . The green dotted line is from letting C = 5 and solving to get x m a x ≈ 2 . 0 6 5 0 when corresponds to y m a x ≈ 8 . 0 2 5 3 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 , . . . 1 0 and fit a quartic polynomial. The branches of the north and east highways cross at about 4 . 0 6 2 , 4 . 0 6 2 corresponding to C = 0 . 0 1 3 .
A final bit of integrating on the polynomial gives each eighth of the final shape having area 2 3 . 1 8 2 6 and the final area approximately 1 8 5 . 4 6 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.
Here is an alternative derivation of the cost function 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 and Δ 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 ) , 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 ) . Ant is starting from ( x , 0 ) with the initial cost E ( x , 0 ) = x (thus negative x will boost the ant's energy).
ii) Find boundary such that E ( x , y ) = 1 0 .
iii) Find numerically the intersection between diagonal and the boundary. Equivalently, find point x d , such that E ( x d , x d ) = 1 0 (above the diagonal, the ant will take y-axis route)
iv) The ant might start from negative x -axis, thus derive the starting position for each point X 0 ( x , y ) and check if X 0 ( x d , x d ) < 0
v) Calculate integral A = 8 ∗ ∫ y = 0 x d [ x ( y ) − y ] d y
i) Derive the cost function E(x,y)}
If E ( x , y f i x e d ) is known for all x, the goal is to find E ( x , y f i x e d + Δ y f i x e d ) . Looking backwards from a point ( x f i x e d , y f i x e d + Δ y f i x e d ) , the ant had to choose an optimal route going through some previous point ( x , y f i x e d ) , and the goal is to find optimal x. I will drop subscript f i x e d from the rest of the text and introduce x = x f i x e d − Δ x (where Δ x is the only parameter to vary). Energy function is:
E ( x , y + Δ y ) = Δ x min [ E ( x − Δ x , y ) + ( 1 + α y ) Δ x 2 + Δ y 2 ]
E ( x , y ) + ∂ y ∂ E Δ y = Δ x min [ E ( x , y ) − ∂ x ∂ E Δ x + ( 1 + α y ) Δ x 2 + Δ y 2 ]
To minimize right hand side, derivative with respect to Δ x has to be identical to zero:
∂ x ∂ E = ( 1 + α y ) Δ x 2 + Δ y 2 Δ x
Plugging back Δ x into the equation for E ( x , y ) and rearranging gives:
∂ y ∂ E = ( 1 + α y ) 2 − ( ∂ x ∂ E ) 2
It would be nice if ∂ x ∂ E is constant. Let's try solution of the form E ( x , y ) = E ( x , 0 ) + F ( y ) , where E ( x , 0 ) = x . This indeed satisfy boundary condition and reduces PDE to an ordinary differential equation:
F ′ ( y ) = α y ( y + 2 / α )
Solving F ( y ) using Euler substitution or a table of integrals with F ( 0 ) = 0 gives:
E ( x , y ) = x + 2 α y + 1 y ( y + 2 / α ) − α 1 ln ( α y / 2 + 1 + α y / 2 )
ii) The boundary
E ( x , y ) = 1 0 is easy to invert. x ( y ) = 1 0 − 2 α y + 1 y ( y + 2 / α ) + α 1 ln ( α y / 2 + 1 + α y / 2 )
iii) Find numerically intersection between diagonal and the boundary
for x = y = 4 . 0 6 2 0 5 the cost is E ( 4 . 0 6 2 0 5 , 4 . 0 6 2 0 5 ) = 1 0 . 0 0 0 0 0 6 3 6 . . .
iv) Derive the starting position for each point X 0 ( x , y )
Similarly as with E ( x , y ) , we define X 0 ( x , y ) to be a point on x -axis at which ant left the x -axis (thus X 0 act as a memory storage for the ant to remember initial x as it traverses on an optimal route). Thus X 0 ( x , 0 ) = x and:
X 0 ( x , y + Δ y ) = X 0 ( x − Δ x , y )
with Δ x being a parameter to be optimized. The optimal relation Δ x Δ y = α y ( y + 2 / α ) is the one already found in the process of calculating E ( x , y ) taking into account that ∂ x ∂ E ( x , y ) = 1 .
X 0 ( x , y ) + ∂ y ∂ X 0 ( x , y ) Δ y = X 0 ( x , y ) − ∂ x ∂ X 0 ( x , y ) Δ x
∂ y ∂ X 0 ( x , y ) α y ( y + 2 / α ) + ∂ x ∂ X 0 ( x , y ) = 0
Similarly to 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 ) , 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 )
Now, one can verify that X 0 ( x = 4 . 0 6 2 0 5 , y = 4 . 0 6 2 0 5 ) = 0 . 0 1 2 7 , 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 (diagonal) to the boundary, which is given as x = x ( y ) is:
A= 8 ∫ y = 0 y = 4 . 0 6 2 0 5 ( 1 0 − 2 α y + 1 y ( y + 2 / α ) + α 1 ln ( α y / 2 + 1 + α y / 2 ) − y ) d y ≈ 1 8 5 . 4 6 6
EDIT :
Please see comments bellow. As pointed out by Mark Hennings, initial form of PDE: ( ∂ x ∂ E ) 2 + ( ∂ y ∂ E ) 2 = ( 1 + α y ) 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 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 .
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.
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.
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.)
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.
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.
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?
Problem Loading...
Note Loading...
Set Loading...
Restrict attention to when the ant is moving in the octant x ≥ 0 , 0 ≤ y ≤ x . Suppose that the ant leaves the x -axis at ( K , 0 ) . To travel furthest, we are interested in minimizing the energy expenditure E = K + ∫ K x ( 1 + α y ) 1 + ( y ′ ) 2 d x (where α = 0 . 4 ) for paths y ( x ) for K < x < 1 0 such that y ( K ) = 0 . This Calculus of Variations problem tells us that F − y ′ ∂ y ′ ∂ F is constant, where F = ( 1 + α y ) 1 + ( y ′ ) 2 . Solving the differential equation 1 + ( y ’ ) 2 1 + α y = c o n s t this means that we are looking at functions of the form 1 + α y ( x ) = cosh ( t α ( x − K ) ) + 1 − t 2 sinh ( t α ( x − K ) ) x > K where 0 < t ≤ 1 . The energy expenditure along this path to the point x > K is E ( x ) = K + 2 1 t ( X − K ) + 4 α 1 [ ( 2 − t 2 ) sinh ( t 2 α ( x − K ) ) + 2 1 − t 2 cosh ( t 2 α ( x − K ) ) − 2 1 − t 2 ] For particular values of t , K , we can determine the value of x > K for which E ( x ) = 1 0 . The corresponding value of y for this value of 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 -axis when t = 1 , which is when the ant departs from the x -axis as smoothly as possible (so that y ′ ( K ) = 0 ) (see the blue path). Other values of t "fill in" gaps the the t = 1 curves leave behind (red paths), and also move the ant into the y > x region. The y > x region is not important, since the ant can reach those points more efficiently by starting along the y -axis. The t < 1 paths are most important in that they enable the ant to reach points in the lune between the t = 1 path for K = 0 (the dashed line) and the line y = x .
By symmetry, then, we want 8 times area of the shaded wedge-shaped region near the 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 , as K varies from 0 to 1 0 . A point ( X , Y ) on that curve satisfies the equations 1 + α Y = cosh ( α ( X − K ) ) 1 0 = 2 1 ( X + K ) + 4 α 1 sinh ( 2 α ( X − K ) ) Eliminating K from these equations, we obtain the equation 1 0 = X − 2 α 1 cosh − 1 ( 1 + α Y ) + 2 α 1 ( 1 + α Y ) ( 1 + α Y ) 2 − 1 Since we are only interested in the portion of this curve corresponding to the parameter 0 < K < 1 0 , we need to find the start and end points. The point K = 1 0 occurs at ( 1 0 , 0 ) , and the value for K = 0 can be found to occur at x = 4 . 0 5 1 1 5 . This left-hand endpoint does not lie on the line 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 at ( u , u ) , where u = 4 . 0 6 2 0 5 . There is a very small amount of overlap. Thus we need to calculate 8 ∫ 0 u ( 1 0 + 2 α 1 cosh − 1 ( 1 + α Y ) − 2 α 1 ( 1 + α Y ) ( 1 + α Y ) 2 − 1 − Y ) d Y ≈ 1 8 5 . 4 6 6