Hey jingato.

I take it the riverbed is on the x-axis and the water is travelling along the y-axis (or vice-versa).

In this scenario you have three options. The choices of running will depend on any solution where the guy gets over the edge of the river.

Now in a normal situation of normal geometry, the smallest distance is given by a straight line and if the edge of the bed is parallel with the y-axis, then the short distance is a perpendicular one.

This means the best strategy if they have to get to the edge of the river-bed (and this river is in a straight-line segment) is to go directly for the edge straight away.

You can prove it mathematically by looking at the time to getting to the edge of the river by using the time to get to river bed based on the angle from the x and y axes respectively.

For a right-angled triangle the hypotenuse = SQRT(x^2 + y^2) = r and x = r*cos(theta) while y = r*sin(theta). You want to minimize the distance r since you will always travel at the same speed regardless of the direction you can take, and you must have the condition that r*cos(theta) >= distance to the edge.

If the edge distance is e then e - rcos(theta) is a minimum. Differentiate this with respect to theta gives rsin(theta) = 0. Since r > 0 the solution for this where the angle is in-between 0 and pi/2 gives a solution angle = 0. This means the best way to get to the bank is to run straight towards it.

If those guys aren't satisfied with that then you would need to derive an arc-length formula that minimizes the distance to get where the final x-offset is -e (i.e. a distance of e to the river-bed).

Also you would have to say whether you are closer to the left or right hand sides as well if they get really picky.