Answer:
- come ashore 1.75 km west of the refinery
- cost: $2.4 million
Explanation:
You want to know the least-cost path of a pipeline from 3 km offshore to 4 km east of the closest point on shore. The cost of pipe in the water is $0.5M/km, and onshore is $0.3M/km.
Generic solution
The solution in the general case for this kind of question is that the sine of the angle between the route directly to shore and the least-cost route is the ratio of the onshore cost to the in-water cost.
sin(α) = (0.3M/km)/(0.5M/km) = 3/5
The distance from the closest point onshore (E) to the least-cost onshore point is the product of the distance from shore and the tangent of this angle:
distance downshore = (3 km)·tan(arccos(3/5)) = 2.25 km
Since the refinery is 4 km downshore, this point is 1.75 km from the refinery.
The pipe should follow a direct path underwater from the well to a point 1.75 km west of the refinery, then downshore the remaining 1.75 km to the refinery.
Cost equation
If x represents the distance from the refinery to the point where the pipeline comes ashore, the cost of the route in millions will be ...
c = 0.5√(3² +(4-x)²) +0.3x
where the square root function is calculating the underwater length of the pipeline using the Pythagorean theorem.
Minimization
This cost function will be minimized when its derivative with respect to x is zero.
c' = 0.5(1/2)(2x -8)/√(x² -8x +25) +0.3 = 0
0 = 0.5(x -4) +0.3√(x² -8x +25) . . . . . . numerator of the combined terms
4 -x = 0.6√(x² -8x +25) . . . . multiply by 2, add 4-x
16 -8x +x² = 0.36x² -2.88x +9 . . . . . . square both sides
0.64x² -5.12x +7 = 0 . . . . . subtract the right side
x = (5.12 -√(5.12² -4(0.64)(7)))/(2(0.64)) = 2.24/1.28 = 1.75
The route with lowest cost comes ashore 1.75 km from the refinery.
__
Additional comment
The cost of the pipeline will be ...
c = 0.5√(9 +(4-1.75)²) +0.3(1.75) = 0.5√14.0625 +0.525
c = 2.4 . . . . million dollars
The attached graph shows the cost function has a minimum of 2.4M at a distance of 1.75 km from the refinery. The cost is only 2.5M if the pipe runs directly from the well to the refinery (x=0).