Suppose the pipe goes underwater directly from the resort to point P, which is x miles away from the point on the shoreline that's closest to the resort. By Pythagoras, the distance from the resort to P is: sqrt(x^2 + 3^2) = sqrt(x^2 + 9) Suppose that it costs 1 unit of money per mile to lay pipe on land, so therefore it costs 1.5 units of money to lay pipe underwater. So the cost of the pipe above is: 1.5*sqrt(x^2 + 9) So the distance from P to the fresh water source is 10 - x, so the cost of laying that pipe is 10 - x. Total cost of pipe: C = 1.5*sqrt(x^2 + 9) + 10 - x dC/dx = ((1.5x) / sqrt(x^2 + 9)) - 1 To minimize C, set the derivative to zero: ((1.5x) / sqrt(x^2 + 9)) - 1 = 0 (1.5x) / sqrt(x^2 + 9) = 1 1.5x = sqrt(x^2 + 9) (1.5x)^2 = x^2 + 9 2.25x^2 = x^2 + 9 2.25x^2 - x^2 = 9 1.25x^2 = 9 x^2 = 9 / 1.25 x = sqrt(9/1.25) x = 2.683