# Minimizing the cost of a pipeline over land and water.

An oil refinery is located on the north bank of a straight river that is $2$ km wide. A pipeline is to be constructed from the refinery to storage tanks on the south bank of the river $6$ km east of the refinery. The cost of laying pipe is $\$400,000$per km over land and$\$800,000$ per km under the river to the tanks. How should the oil company lay the pipe in order to minimize the cost? What is the minimum cost?

So I got x=2.617 once I found my derivative and solved. So to receive the cost would I multiple x by the two amounts?

Straight line (diagonally through the river) from the refinery to the storage tanks is due to Pythagoras theorem $$2^2+6^2=4^2$$ equal to $4$km. Any other connection forms a triangle with sides $l$ (part of pipeline on land in km) and $r$ (part of pipeline below the river in km), so that $l^2+r^2-2lr\cos{\theta}=4^2$. So, you want to minimize the cost $$\min_{l, r}400,000l+800,000r$$ subject to the constraint $$l^2+r^2-2lr\cos{\theta}=4^2$$ where $θ$ is the angle between the sides $l$ and $r$, with $0^o\le θ\le 90^o$. The objective funcion can be equivalently restated as $$\min_{l, r}l+2r$$
Let $x$ be the length of pipe that is laid to the east of the refinery over land, where $x \in [0, 6]$. Then by forming a right triangle, it follows by Pythagoras that the length of pipe that is laid under the river is given by the expression: $$\sqrt{2^2 + (6 - x)^2}$$ Thus, the desired objective function to be minimized is: $$f(x) = 400000x + 800000\sqrt{4 + (6 - x)^2}$$
To do this, cross the river first at an angle $x$ with the direct route across and then go along the bank the remaining distance (it doesn't matter which bank you go along, the cost is the same). Take $\$400,000$as one unit of money to lose unnecessary zeros etc in the calculation. The distance across the water is$\cfrac 2{\cos x}$km at a cost of$\cfrac 4{\cos x}$units. The distance on land is$\left(6 - 2 \tan x\right)$km at a cost of$\left(6 - 2 \tan x\right)$units. The total cost is$\left(6 - 2\tan x+\cfrac 4{\cos x}\right)$units Using$\left(\cfrac uv\right)'=\cfrac {u'v-v'u}{v^2}$with the derivative of$\sin x$being$\cos x$and the derivative of$\cos x$being$-\sin x$we find: The derivative of$\tan x$is$\left(\cfrac {\sin x}{\cos x}\right)'=\cfrac {\cos^2x+\sin^2x}{\cos^2 x}=\cfrac 1{\cos^2 x}$And$\left(\cfrac 1{\cos x}\right)' = \cfrac {\sin x}{\cos^2 x}$• What would the derivative of the total cost equation be? – Maggie Nov 5 '14 at 21:08 • @Maggie The derivative of$\tan x$is$\sec^2 x$and the derivative of$\sec x$is$\tan x \sec x\$ or you might want to do it in terms of sine and cosine functions (recommended here). I think this is a cleaner method than the others proposed if you know the derivatives of trigonometric functions. If you don't, you'll have to use another method. – Mark Bennet Nov 5 '14 at 21:12