Use Derivatives to solve problems: Distance-time Optimization

A problem to minimize (optimization) the time taken to walk from one point to another is presented. First an applet is used to fully understand the problem and then an analytical method, using derivatives and other calculus concepts and theorems, is developed in order to find an analytical solution to the problem.

Problem : You decide to walk from point A (see figure below) to point C. To the south of the road through BC, the terrain is difficult and you can only walk at 3 km/hr. However, along the road BC you can walk at 5 km/hr. The distance from point A to the road is 5 km. The distance from B to C is 10 km. What path you have to follow in order to arrive at point C in the shortest ( minimum ) time possible?

Interactive Tutorial

We first try to understand the problem using the applet below. There are several possible paths one can follow to go from A to C. On the left panel of the applet, is shown possible paths: You may walk from point A to a certain point P, somewhere on the road between B and C, and continue along the road to get to point C. The question is: What is the position of point P that will minimize the time taken to go from A to C?


Your browser is completely ignoring the <APPLET> tag!

Use the mousse to press and drag point P. What you are doing here is changing distance BP = x. On the right panel you have the time plotted against x. As you can see there seem to be one value of x for which the time is smallest (minimum). You may also plot the whole graph using the "on" and "off" buttons above it.

The total time t taken from A to C is calculated as follows:

t = distance AP / 3 km/hr + distance PC / 5 km/hr

Analytical Tutorial

We now look at a solution using derivatives and other calculus concepts. Let distance BP be equal to x. Let us find a formula for the distances AP and PC. Using Pythagorean theorm, we can write:

distance AP = sqrt(5 2 + x 2)

distance PC = 10 - x

We now find time t
1 to walk distance AP.(time = distance / speed).

t 1 = distance AP / 3 = sqrt(5 2 + x 2) / 3

Time t
2 to walk distance PC is given by

t 2 = distance PC / 5 = (10 - x) / 5

The total time t is found by adding t
1 and t 2.

t = sqrt(5
2 + x 2) / 3 + (10 - x) / 5

we might consider the domain of function t as being all values of x in the closed interval [0 , 10]. For values of x such that point P is to the left of B or to the right of c, time t will increase.

To find the value of x that gives t minimum, we need to find the first derivative dt/dx (t is a functions of x).

dt/dx = (x/3) / sqrt(5
2 + x 2) - 1/5

If t has a minimum value, it happens at x such that dt/dx = 0.

(x/3) / sqrt(5
2 + x 2) - 1/5 = 0

Solve the above for x. Rewrite the equation as follows.

5x = 3sqrt(5
2 + x 2)

Square both sides.

2 = 9(5 2 + x 2)

Group like terms and simplify

2 = 225

Solve for x (x >0 )

x = sqrt(225/16) = 3.75 km.

dt/dx has one zero. The table of sign of the first derivative dt/dx is shown below.

table of sign of the first derivative dt/dx

The first derivative dt/dx is negative for x < 3.75, equal to zero at x = 3.75 and positive for x >3.75. Also the values of t at x = 0 and x = 10 (the endpoints of the domain of t) are respectively 3.6 hrs and 3.7 hrs. The value of t at
x = 3.75 is equal to 3.3 hrs and its is the smallest. The answer to our problem is that one has to walk to point P such BP = 3.75 km then procced along the road to C in order to get there in the shortest possible time.


1 - Solve the same problem as above but with the following values.

diagram for exercise

solution to the above exercise

x = 6.26 km (rounded to 2 decimal places).

More references on
calculus problems