Possibility A1 involves a $500,000 mountain drilling cost and 3 months lost time at $50,000 per month, on top of the regular $300,000 per mile costs. 25 miles * 300000 = 7,500,000 + 500,000 + 3 * 50000 = $8,150,000 total cost.

Possibility A2 is just going the long way around, but on level ground all the way. This is 27 miles * 300000 = $8,100,000, so is a little cheaper so far.

Going straight across, paying an extra $200,000 per mile ($500,000 total) to go the shortest path involves a little Pythagorean Theorem work. The short side is 5, the long side is 20, so the hypotenuse is √[5²+20²] = √[25+400] = √425 = 20.616 miles

Going 20.616 miles at 500,000 per mile is 20.616 * 500000 = $10,308,000, and that is far too expensive.

The problem states that there is an optimum path across the private land, so we can pick a point and see if we can get a better answer near it. If we go straight across the land from north to south and call that point A, we can cut off 2 miles from the outer distance at the cost of the increase price. 5*500,000 + 20 * 300,000 = 2,500,000 + 6,000,000 = 8,500,000, which is larger in cost than going around. Moving the target point 1 mile east and call that B, we get √[5²+1²] = √26 = 5.099 miles diagonally and 19 miles linearly. 5.099*500,000 + 19*300,000 = 8,249,500, and that is an improvement. This means that we know that the cost decreases as B moves eastward, but at some point it heads back up towards 10,308,000. The key is finding the minimum point.

Let's look at the distance from A to B and call it x. The distance across the land is √[5²+x²] and the linear distance to the refinery from B is 20-x. This means the cost is going to be 500,000 * √[25+x²] + 300,000*(20-x)

We already know that this is a function (from x=0 to x=20) that is concave up, is decreasing near x=0 and increasing near x=20, so there must be a minimum. To find that, we take the derivative and set it to zero.

500000 * √[25+x²] + 300000*(20-x) = 0

500000√[25+x²] + 6000000 – 300000x = 0

- 300000 = 0

- 300000 = 0

= 0

25x² = 225 + 9x²

16x² = 225

x² = 225 / 16

x = 15 / 4 = 3.75

This is the point where the cost function is at its minimum, so aim for the point 3.75 miles east of point A. The total cost is:

500000√(25+(225/16))+300000(20-3.75)

500000√(25+14.0625)+300000(16.25)

500000√(39.0625)+300000(16.25)

500000*6.25 + 300000 * 16.25

3125000+ 4875000

$8,000,000 (well, didn't that work out nicely?)

The best solution is to avoid the mountain entirely and forget about taking the long way around. Start from the well and get easement permits to take the pipeline diagonally across the private land to a point 3.75 miles east of the point directly south of the well, and run eastward to the refinery. The total cost for everything is $8 million.