note that if we draw a diagram of the situation, we will have a right-triangle. the hypotenuse of this triangle is the distance between the two boats, and it is the function for this distance that we want to minimize for the period 3pm to 4pm.

Let at 3pm

so, at 4pm

Let the boat moving at 21 km/h be boat

Let the boat moving at 13 km/h be boat

Let be the distance between the two boats

thus, for ,

the distance boat is from the dock is given by:

the distance boat is from the dock is given by:

By Pythagoras' theorem:

the distance is minimized if the square of the distance is minimized, so let , we have:

now we want to find such that is minimized.