# How to solve this related rates calculus problem?

An oil rig lies 20 km off the coast of Newfoundland. A town lies 80 km along the coast from the nearest point on land to the rig. A pipe is to be drilled from the rig to the town. The cost per km of the pipe under water is \$2.5 million, but on land is \$1.5 million. Find the route that results in the cheapest pipeline, and determine that lowest cost.

I was struggling to do this problem and I have no idea how to start. Please help!!!

• Welcome to MSE. Please read this text about how to ask a good question. – José Carlos Santos Aug 8 '19 at 11:22
• Draw a few maps of how the rig could be connected to the town with a variety of points where the pipe meets the land. Label the length of the section on land and at sea with a variable e.g. $l$ and $s$ and then try to come up with a formula for the cost. – badjohn Aug 8 '19 at 11:24
• I agree with @badjohn. Start by drawing a map and writing the distances on the map. Come back when you have the map and tell us what you got. – Matti P. Aug 8 '19 at 11:30

Let $$x$$ be the pipe length of on land. Then, the length under the water has to be according to the diagram,
$$\sqrt{20^2+(80-x)^2}$$
So, the total construction cost as $$x$$ varies takes the form
$$c(x)=2.5\sqrt{20^2+(80-x)^2}+1.5x.$$
Then, the optimal pipe length for the cheapest cost can be found by setting $$dc(x)/dx=0$$. You should find 65 miles of pipes on land.