Draw the related figure.
\
is the offshore well,
is oil refinery.
is a right angle triangle.
and 
is the point between
and
such that
and
.
Let
be the cost per km on land.
Cost of
.
Cost of
.
Total cost
.
.
Since
is cost per km on land,
is constant.

Differentiate on each side with respect to
.
.

Find the critical numbers by equating first derivative to zero.
\








.


is minimum when
.
.