Hello, warsatan!

An offshore oil well is 2 kilometers off the coast.

The refinery is 4 kilometers down the cost.

If laying pipe in the ocean is twice as expensive as on land,

what path should the pipe follow in order to mimize the cost?

Code:

```
. . . . W
. . . . * The oil well is at W.
. . . . | \ The refinery is at R.
. . . . | \
. . . 2 | \ The pipe is laid underwater to B
. . . . | \ then along the coast to R.
. . . . | \
. . . - + - - - - - * - - - - - *
. . . . A . . x . . B . .4-x. . R
```

Let \(\displaystyle p\) = price for laying pipe on land (per kilometer).

Then \(\displaystyle 2p\) = price of laying pipe underwater.

From right triangle WAB, we get:

.\(\displaystyle WB\:=\:\sqrt{x^2\,+2^2}\) km of underwater pipe.

. . This will cost:

.\(\displaystyle 2p\sqrt{x^2 + 4}\) dollars.

Let \(\displaystyle x\,=\,AB\)

There will be \(\displaystyle 4 - x\) km of pipe laid along the shore.

. . This will cost:

.\(\displaystyle p(4 - x)\) dollars.

The total cost is:

.\(\displaystyle C\:=\:2p(x^2\,+\,4)^{\frac{1}{2}}\,+\,p(4\,-\,x)\)

And

*that* is the function you must minimize . . .