# Least-effort way from A to B via X

Points A, B and X form a rougly equilateral triangle.

I need to pull a cart from A to B, and also need to visit X, but I don't need to have the cart with me there. Walking with the cart costs me double the energy of walking without.

To spend as little energy as possible, I think I'd need to pull the cart to somewhere near the middle of the triangle (I will call this point R), leave it there, walk to X and back to the cart, and pull the cart on to B.

How can one calculate where exactly R is?

-
What have you tried so far? –  Mitch Oct 16 '11 at 17:18
Do you need to start at A and end up at B, or does that constraint apply only to the cart? That is, is a path like A→B→X or X→A→B a valid solution? –  Ilmari Karonen Oct 16 '11 at 18:19
@IlmariKaronen ABX would be ok, XAB not –  Bart van Heukelom Oct 16 '11 at 18:40
@Bart: Then, given that the triangle is "roughly equilateral", $A\to B\to X$ is very likely to be a superior solution. (Namely, even $ARBX$ would be shorter than $ARXRB$, and $ABX$ is then just a further optimization). –  Henning Makholm Oct 16 '11 at 19:42

It's clear that the solution must have the structure you describe for some $R$. Thus, write down an expression for the total energy spent, as a function of the coordinates of $R$. Differentiate this function with respect to $x$ and $y$. Set both partial derivatives to $0$ to find a minimum, and solve.

In the general case you'll probably find $R$ as the intersection of two conics, which is not nice to do algebraically. So it is worthwhile to look for some symmetry in your concrete problem. In particular, if AXB is isosceles you can guess that $R$ must lie on the center line, and then you need to solve for only one unknown, with the equation reducing to a linear one.

-

$f(e)=eb+2\frac{e}{2}c+eb=e(2b+c)$ ,where $e$ is energy per meter.

We may write (picture bellow) following:

$$b=\sqrt{(\frac{a}{2})^2+d^2} ; c=\frac{a\sqrt{3}}{2}-d$$

so $$f(d)=2\sqrt{(\frac{a}{2})^2+d^2}+\frac{a\sqrt{3}}{2}-d$$

and has minimal value for $f'(d)=0$

-