# Optimal route consisting of rowing then walking

Problem

You're in a boat on point A in the water, and you need to get to point B on land. Your rowing speed is 3km/h, and your walking speed 5km/h.

See figure:

Find the route that takes the least amount of time.

My idea

I started by marking an arbitrary route:

From here, I figure the total time is going to be $$T = \frac{R}{3\mathrm{km/h}} + \frac{W}{5\mathrm{km/h}}$$

Since this is a function of two variables, I'm stuck.

A general idea is to express $W$ in terms of $R$ to make it single-variable, and then apply the usual optimization tactics (with derivatives), but I'm having a hard time finding such an expression.

Any help appreciated!

EDIT - Alternative solution?

Since the distance from A to the right angle (RA) is traveled 3/5 times as fast as the distance between RA and B, could I just scale the former up?

That way, I get A-RA being a distance of $6\cdot\frac53 = 10\mathrm{km}$, which makes the hypotenuse $\sqrt{181}$ the shortest distance between A and B. And since we scaled it up, we can consider it traversable with walking speed rather than rowing speed!

Thoughts?

• but .. where is the river / land border ? – G Cab Oct 5 '17 at 21:56
• The horizontal leg of the triangle would simultaneously be the border and the walking route. It sounds strange, but the idea is that the distance between the shoreline and the walking path is "negligible", thus they can be seen as one-and-the-same. – Alec Oct 6 '17 at 8:27
• Thanks, now it is clear. Another question, do you know (accept) trigonometric approach? – G Cab Oct 6 '17 at 21:12
• @GCab - Yes. I've reached an answer of 3.4hours with that approach. However, $\frac{\sqrt{181}}{5}$ doesn't give the same answer, and I can't figure out why that wouldn't work, and if there's some adjustment that needs to be made. Or if it needs to be discarded completely. – Alec Oct 7 '17 at 11:01
• I think the answer is here, so wikipedia gets the bonus: en.wikipedia.org/wiki/Fermat%27s_principle – Ethan Bolker Oct 8 '17 at 14:23

• a) the solution

The formula has already been indicated by wgrenard and AdamBL $$T = {1 \over 3}\sqrt {36 + \left( {9 - W} \right)^{\,2} } + {1 \over 5}W$$

differentiating that $${{dT} \over {dW}} = {{5W + 3\sqrt {36 + \left( {9 - W} \right)^{\,2} } - 45} \over {15\,\sqrt {36 + \left( {9 - W} \right)^{\,2} } }}$$ and equating to $0$ gives \eqalign{ & {{dT} \over {dW}} = 0\quad \Rightarrow \quad 3\sqrt {36 + \left( {9 - W} \right)^{\,2} } = 45 - 5W\quad \Rightarrow \cr & \Rightarrow \quad 9\left( {36 + \left( {9 - W} \right)^{\,2} } \right) = 25\left( {9 - W} \right)^{\,2} \quad \Rightarrow \cr & \Rightarrow \quad 9 \cdot 36 = 16\left( {9 - W} \right)^{\,2} \quad \Rightarrow \quad W = 9 - \sqrt {{{9 \cdot 36} \over {16}}} = 9 - {9 \over 2} = {9 \over 2} \cr} which is a minimum, because the function is convex as already indicated.

Thus $$\left\{ \matrix{ W_m = 9/2 \hfill \cr T_m = 17/5 \hfill \cr R_m = 15/2 \hfill \cr} \right.$$

• b) Scaling

Your idea of scaling according to speed is quite entangling.
That means (if I understood properly) that you are transforming the triangle from space to time units.
But, by introducing different scaling factors for the two coordinates, you undermine the Euclidean norm, which does not " transfer" between the two systems (if assumed valid in one, shall be modified in the other).

Consider for example the transformation sketched below.

From the mathematical point of view it is a linear scale transformation $$\left( {\matrix{ {y_1 } \cr {y_2 } \cr } } \right) = \left( {\matrix{ {1/v_1 } & 0 \cr 0 & {1/v_2 } \cr } } \right) \left( {\matrix{ {x_1 } \cr {x_2 } \cr } } \right)$$

Now, with constant $v_1, \,v_2$, any path in $x$ will transform in the corresponding path in $y$ (going through corresponding points).
If the path is a curve parametrized through a common parameter $\lambda$, not influencing the $v_k$'s, then, at any given value of $\lambda$ the point on the $x$ plane will transform into the corresponding point in $y$ plane $$\left( {\matrix{ {y_{1}(\lambda) } \cr {y_{2}(\lambda) } \cr } } \right) = \left( {\matrix{ {1/v_1 } & 0 \cr 0 & {1/v_2 } \cr } } \right) \left( {\matrix{ {x{_1}(\lambda) } \cr {x_{2}(\lambda) } \cr } } \right)$$ and the minimal path in one plane will be the corresponding minimal path in the other.

But we shall also have that $$\frac{d}{{d\lambda }}\left( {\matrix{ {y_{1}(\lambda) } \cr {y_{2}(\lambda) } \cr } } \right) = \left( {\matrix{ {1/v_1 } & 0 \cr 0 & {1/v_2 } \cr } } \right) \frac{d}{{d\lambda }}\left( {\matrix{ {x{_1}(\lambda) } \cr {x_{2}(\lambda) } \cr } } \right)$$ that is that the "velocities" compose vectorially.

Therefore if $\lambda$ is the time, you shall go from $A$ to $C$ with a composition of a vertical rowing speed and a horizontal walking speed (a "$\infty$-thlon"), which takes the same time as rowing $AH$ and walking $HC$.

When, instead, you just row on $AC$, then you shall change the above matrix - for that segment only - according to the $\angle AC$, and of course you loose the correspondence minimal to minimal as based on the Euclidean norm (straight line $A'B'$).

• The question has recieved a nice handful of good answers. I'm still somewhat perplexed as to the alternative solution, which I was hoping to focus on with the bounty, but since you're the only one who even mentioned it, the bounty goes here. I would be interested to learn more about the entangling nature of that strategy though. Do you have any links, or simply a concept I should look into? – Alec Oct 12 '17 at 7:23
• Thanks for appreciation. I will try and add more elaboration to clear the "scaling" matter. – G Cab Oct 12 '17 at 8:48
• @Alec: I expanded on the 2nd part: wish I succeeded and make it more clear and .. convincing. – G Cab Oct 12 '17 at 13:31

The portion of the line on the top left is $9-w$. So by the Pythagorean theorem $R^2 = 36 + (9-w)^2$. I think this is the relationship you are looking for.

You do not need to worry about the hypotenuse in the larger right triangle.

Consider the right triangle that has R as the hypotenuse. Left side of this triangle will have length $6$ and the top side will have length $(9-W)$. By the Pythagorean theorem, $R^{2} = 36+(9-W)^2$.

Solving for R and inserting in your original equation yields $T= \frac{1}{3} \sqrt{36+(9-W)^{2}} + \frac{1}{5} W$. This function is strictly convex, so you can simply minimize it by solving $\frac{d\ T}{d\ W}=0$ (the 'usual optimization tactics').

Regarding your alternative solution, I am unsure what you are arguing. The shortest distance between the points A and B will always be the line connecting them. As you have shown in your drawing, $|AB|=3\sqrt{13} \ne\sqrt{181}$.

• No, I mean if we've scaled the left-most side to 10km (by multiplying 5/3), the hypotenuse will be $\sqrt{10^2 + 9^2} = \sqrt{181}$. – Alec Oct 4 '17 at 7:39
• Yes, that is correct. If I understand you correctly, though, you are arguing that it will always be optimal to row the entire way, since the hypotenuse will always be the shortest distance from A to B. That's obviously not the case. – AdB Oct 5 '17 at 15:37
• Nono, I'm not arguing that it's faster to row always. I'm saying that if we scale the rowing distance up by 5/3, then we can consider that distance to be traversable by walking speed instead of rowing speed. – Alec Oct 5 '17 at 17:09

Snell's Law is usually applied to optics, but it is based on the quickest path through two media in which the speed of light differs. Snell's Law says that $$n_1\sin(i_1)=n_2\sin(i_2)\tag1$$ where $i_k$ is the angle of incidence to the boundary of the path and $n_k$ is inversely proportional to the speed in the particular medium ($n_kv_k=c$).

We can adapt this to the current situation by noting that $(1)$ is equivalent to $$\frac{\sin(i_1)}{v_1}=\frac{\sin(i_2)}{v_2}\tag2$$ If we travel at all along the shore, $\sin(i_2)=1$ (the angle of incidence is $90^\circ$). Since $v_1=3$ and $v_2=5$, we must have $\sin(i_1)=\frac35$, which implies that $\tan(i_1)=\frac34$.

If $\tan(i_1)=\frac34$, and the width of the river is $6$ km, then the downriver distance must be $\frac34\cdot6=4.5$ km.

This path takes $\frac{7.5}3+\frac{4.5}5=3.4$ hours.

• Wait, so we must find an angle such that we only travel 4.5km by water? I must be interpreting that wrong, because the shortest possible water-distance must be 6km, right? – Alec Oct 8 '17 at 20:50
• No, the downriver distance is $4.5$ km, the river is still $6$ km wide, so that makes that water distance $\sqrt{4.5^2+6^2}=7.5$ km. – robjohn Oct 8 '17 at 22:55
• Ah, gotcha! Yeah, that was a nice take on this problem. I never would have connected this to Snell's Law on my own. – Alec Oct 9 '17 at 7:47