As always, draw a diagram. Label the water works W. It sounds like C,W,D are in a straight line. If so, there is really very little calculus involved here. In fact, the least cost pipeline is to build it right at D. If C and D are x miles apart, and W is y miles from C, then the cost (in 000's) is
c(x) = 3x + 7(y-x)
dc/dx = 3 - 7
Somehow I think there is something you left out of the problem.
You have been asked to determine where a water works should be built along a river between Chesterville and Denton to minimize the total cost of the pipe to the towns.
(a) Assume that the same size (and cost) pipe is used to each town. (This part can be done quickly without using calculus.)
(b) Assume that the pipe to Chesterville costs $3000 per mile and to Denton it costs $7000 per mile.
1 answer