Solve this related rates calculus problem

calculus

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!!!

Best Answer

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.

enter image description here