Let P be located x km east of the refinery. By the Pythagorean Theorem, the distance d from the refinery to P is:
d(x) = √(x^2 + 1^2)
= √(x^2 + 1)
And, also by the Pythagorean Theorem, the distance k from P to the storage tanks is:
k(x) = √((8 - x)^2 + 3^2)
= √(x^2 - 16x + 73)
The total cost C of the pipeline is given as:
C(x) = 300,000d + 600,000k
= 300,000√(x^2 + 1) + 600,000√(x^2 - 16x + 73)
And, the minimum cost of the pipeline will be given for dC/dx = C'(x) = 0.
C'(x) = 0
=>
300,000x / √(x^2 + 1) + 300,000(2x - 16) / √(x^2 - 16x + 73) = 0
=>
x / √(x^2 + 1) = (16 - 2x) / √(x^2 - 16x + 73)
=>
x√(x^2 - 16x + 73) = (16 - 2x)√(x^2 + 1)
=>
x^2(x^2 - 16x + 73) = (16 - 2x)^2 (x^2 + 1)
=>
x^4 - 16x^3 + 73x^2 = 4x^4 - 64x^3 + 260x^2 - 64x + 256
=>
3x^4 - 48x^3 + 187x^2 - 64x + 256 = 0
This looks really hard to solve. But, using a calculator, we discover that:
x ≈ 6.296361114
= 6.30 km (rounded to two decimal places)