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?
 A: 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.
A: *

*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'$). 
A: 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}$.
A: 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.
