You are asked to design a piping system that will connect a drilling rig 12 miles offshore to refinery on shore 20 miles down the coast. What values of x and y will give the least expensive connection if underwater pipe (x-section) costs $50.000 per mile and land-based pipe (y-section) costs $30.000 per mile?

Draw a diagram. Let P be the point on shore where the pipe goes underwater.

Then if D is the drill rig, and R is the refinery,

x^2 = 12^2 + (20-y)^2
and the cost is
c = 50x+30y
c = 50√(144 + (20-y)^2) + 30y

dc/dy = 50(y-20)/√(y^2 - 40y + 544) + 30
dc/dy=0 when

y = 11
so, x = 15