Hello, ihmth!
There is a back-door approach to this problem,
. . involving optics and striaght-line paths.
But I'll use the expected Calculus set-up.
1) A ship lies 6 mi. from shore.
Opposite a point 10 mi. farther along the shore another ship lies 18 mi. offshore.
A boat from the first ship is to land a passenger and then proceed to the other ship.
What is the least distance the boat can travel? Code:
* C
* |
* |
* |
A * * |
| * * | 16
| * * |
6 | * * |
| * * |
| * * |
B * - - - - - * - - - - - - - - - * D
x P 10 - x
The first ship is 
The second ship is at 
And: . 
Let
be the landing point.
Then: . 
In right triangle 
In right triangle ^2 + 18^2} )
The distance travelled is: . ^{\frac{1}{2}} + \left(x^2-20x+424\right)^{\frac{1}{2}})
. . and that is the function we must minimize.