Calculus Optimization - Finding the minimum cost

In oil pipeline construction, the cost of pipe to go underwater is 60% more than the cost of pipe used in dry-land situations. A pipeline comes to a river that is 1 km wide at point A and must be extended to a refinery, R on the other side, 8 km down the river. Find the best way to cross the river (assuming that it is straight) so that the total cost of the pipe is kept to a minimum.

I am very confused with this question. I have came up with the equation:

$c(x) = xc + \sqrt{(8-x)^2+1}(1.6c)$

I am not sure on how to find the derivative of this, nor how to use to 60% to find the answer.

• Yeah I don't understand the question. A tl;dr would be nice with a little diagram. – Shahar Apr 1 '14 at 1:30
• You have already dealt with the 60% increase in the cost per kilometer to pass underwater. Your first term is the overland distance times some cost per kilometer (the number is irrelevant, since it will "drop out" in the optimization). The second term is the underwater distance, which you have found correctly, times (100% + 60%) or 1.6 times the overland cost. Write your cost function as $\ Cx \ + \ 1.6C \cdot (1 + [8-x]^2)^{1/2} \ ,$ differentiate each term (using the chain rule on the second term), and set the sum of the derivatives equal to zero. Solve for $\ x \ .$ – colormegone Apr 1 '14 at 1:30
• The result you get for $\ x \$ is the distance downriver at which you would place the crossing point to take the pipeline underwater. You are not asked to calculate the cost function evaluated at that value of $\ x \ ,$ so you can stop there. – colormegone Apr 1 '14 at 1:32
• One could imagine crossing the river perpendicularly. Or maybe turn by angle $\theta$ from the perpendicular. Then the cost is $1.6\sec\theta+8-\tan\theta$. Minimize, checking endpoints. – André Nicolas Apr 1 '14 at 1:42
• Treating this as a refraction problem, the critical angle will be $\sin^{-1}(1/1.6)$ – Henry Apr 1 '14 at 1:48

In the description user481710 has chosen, $\ x \$ km. represents the distance from the refinery location $\ R \$ at which the pipeline reaches the opposite bank of the river, having entered the river at point $\ A \$ and emerging at point $\ B \$ . The distance measured along the river from $\ A \$ to $\ B \$ is then $\ 8 - x \$ km. ; as the width of the river is 1 km., the (straight-line) length of pipeline running underwater is as OP found, $\ [ \ (8 - x)^2 \ + \ 1^2 \ ]^{1/2} \$ .

With the cost per kilometer of running pipeline overland taken as $\ c \$ , the per-kilometer cost for underwater pipeline is $\ 1.6 \cdot c \$ , making the cost function as OP correctly gives,

$$C(x) \ = \ 1.6 \cdot c \ [ \ (8 - x)^2 \ + \ 1^2 \ ]^{1/2} \ + \ c \cdot x \ \ .$$

The actual value of $\ c \$ is unimportant: it is only the relative cost of underwater versus overland pipe-laying that affects the optimization.

For interest's sake, we can generalize the problem to make that relative cost factor $\ \alpha \$ , and carry out the calculation for the minimal cost of the pipeline:

$$\frac{dC}{dx} \ = \ \frac{d}{dx} \left(\alpha \cdot c \ [ \ (8 - x)^2 \ + \ 1 \ ]^{1/2} \ + \ c \cdot x \right)$$

[applying the Chain Rule to the first term]

$$= \ c \ \alpha \ \cdot \ \frac{1}{2} \ [ \ (8 - x)^2 \ + \ 1 \ ]^{-1/2} \ \cdot \frac{d}{dx} [ \ (8 - x)^2 \ + \ 1 \ ] \ \ + \ \ c \cdot 1$$

[applying the Chain Rule to the factor still to be differentiated]

$$= \ c \ \alpha \ \cdot \ \frac{1}{2} \ [ \ (8 - x)^2 \ + \ 1 \ ]^{-1/2} \ \cdot \ 2 \ (8 - x) \cdot (-1) \ \ + \ \ c$$

[setting the derivative equal to zero in order to locate the critical point of $\ C(x) \$ ]

$$= \ -c \ \cdot \frac{\alpha \ (8 - x)}{\sqrt{ (8 - x)^2 \ + \ 1 \ }} \ + \ \ c \ \ = \ \ 0 \ \ \Rightarrow \ \ \frac{\alpha \ (8 - x)}{\sqrt{ (8 - x)^2 \ + \ 1 \ }} \ = \ 1 \ \ ,$$

where $\ c \$ may be "divided out" since it is non-zero. Since the underwater length of pipeline can never be zero, we can multiply the equation through by the denominator. Algebraic re-arrangement leads us to

$$\sqrt{ (8 - x)^2 \ + \ 1 \ } \ = \ \alpha \ (8 - x) \ \ \Rightarrow \ \ (8 - x)^2 \ + \ 1 \ = \ \alpha^2 \ (8 - x)^2$$

$$\Rightarrow \ \ ( \ \alpha^2 \ - \ 1 \ ) \ (8 - x)^2 \ = \ 1 \ \ \Rightarrow \ \ 8 - x \ = \ \sqrt{\frac{1}{\alpha^2 \ - \ 1}} \ \ .$$

For this specific problem,

$$\ \alpha \ = \ 1.6 \ \ \Rightarrow \ \ 8 - x \ = \ \sqrt{\frac{1}{1.6^2 \ - \ 1}} \ \approx \ 0.80 \ \text{km.} \ \ \Rightarrow \ \ x \ \approx \ 7.20 \ \text{km.} \ \ .$$

So we find that emerging from the river (point $\ B \$ ) 7.2 kilometers away from the refinery gives the least total cost for the pipeline. If we graph the cost function, however, we find that in practice the cost is not particularly "sensitive" to the placement of that point; a shift of 0.5 kilometer in either direction only increases the cost by about 1% .

The location of the value of $\ x \$ for which $\ C(x) \$ is minimal is marked by the arrow. The minimum in the cost function is rather "flat", however, as the vertical scale suggests.

If we consider other relative cost factors $\ \alpha \ \ge \ 1 \$ , we see from our result above that $\ ( \ 8 - x \ ) \$ is never zero, so it is never cheapest to lay the pipeline straight across the river. (The minimum does draw closer to the "straight-across" solution as $\ \alpha \$ increases, as we'd expect.)

We also find that the minimum only disappears for $\ \alpha \ = \ 1 \$ , with the least cost occurring if we use the zero "endpoint" of the allowed interval $\ 0 \ \le \ x \ \le \ 8 \ .$ This is reasonable: if it costs just the same to lay pipeline overland or under the river, the cheapest solution is to run the line straight from $\ A \$ to $\ R \$ .

The cost function $\ C(x) \$ for various values of $\ \alpha \$ . The position $\ x \ = \ 0 \$ corresponds to the location $\ R \$ of the refinery; the region in green is excluded, as this lies further from the refinery than the point "straight across" the river from $\ A \$ .

$$\ \$$

Following the approach described by André Nicolas in his comment, for which the variable is the angle $\ \theta \$ that the underwater pipeline makes to the line straight across the river, we have

$$\frac{1}{\sqrt{ (8 - x)^2 \ + \ 1 \ }} \ = \ \cos \ \theta \ \ \ \text{and} \ \ \frac{(8 - x)}{1} \ = \ \tan \ \theta \ \ ,$$

so the cost function becomes $\ C(\theta) \ = \ 1.6 \ \sec \ \theta \ \ + \ \ ( 8 \ - \tan \ \theta) \$ . We find the critical point from

$$\frac{dC}{d\theta} \ = \ 1.6 \ \sec \ \theta \ \tan \ \theta \ \ - \ \ \sec^2 \ \theta \ \ = \ \ \sec \ \theta \ \cdot \ ( \ 1.6 \ \tan \ \theta \ - \ \sec \ \theta \ ) \ \ = \ \ 0 \ \ ;$$

since secant cannot be zero, the critical point is found from

$$1.6 \ \tan \ \theta \ - \ \sec \ \theta \ \ = \ \ 0 \ \ \Rightarrow \ \ 1.6 \ \sin \ \theta \ = \ 1 \ \ ,$$

from which we obtain $\ \theta \ \approx \ 38.7º \$ , which produces the same distance value we determined above. This is related to Henry's remark, in which he suggests a physical analogy: light follows the path of least time from point $\ A \$ to $\ R \$ . If the "river" represents a medium with a refractive index of 1.6 , which takes light 1.6 times longer to pass through than it does in an equal length of air or vacuum, the "critical angle" path it would follow traveling through that medium and then emerging into air would look the same as that of our minimal-cost pipeline.

• Thank you kindly. This is a pretty widely-assigned sort of optimization exercise, so I thought it might be worthwhile to discuss it more generally. It was also a nice observation on the part of one of the commentators that the minimal path has a relation to "Snell's Law" of refraction. – colormegone Jul 10 '14 at 3:58