### General case

Let us now consider the case where * A* is above the coast line. In the following application, for a given choice of velocities (of running and swimming), by moving

*, we can see the time that the lifeguard takes to reach the swimmer, for each of the choices of*

**C***in the coast line; and, hence, we can determine the approximated best position of*

**C***, that is, the one that defines the fastest path.*

**C**^{2}

Let * D* and

*be the points in the coast line that are closer, respectively, from*

**E***and*

**A***. The ratio between the distances from*

**B***, to*

**C***and to*

**D***, measures the degree of separation of the path on the sand, in terms of the perpendicular to the coast line; and, similarly for the ratio between the distances from*

**A***, to*

**C***and to*

**E***, in the path in the water. In the previous application, the quotient between those two ratios, that changes according to the position of*

**B***, is also represented (in red), as well as the quotient, independent of*

**C***(and independent of*

**C****and**

*A**), between the velocity of running and the velocity of swimming (in green).*

**B**By moving the point * C*, it is possible to observe that the optimal path, corresponding to the smallest amount of time (black curve) seems to be obtained when the ratio of the slopes and the ratio of the velocities are equal, which happens when the projection of

*in the x-axis is the intersection of the green curve with the red curve.*

**C**In the next section, we will prove that the best path is, indeed, the one for which both ratios are equal.

^{2}If you have Geogebra installed, you might prefer to import the applet from here and run it locally.