Originally Posted by

**Tclack** an offshore oil well located 5km from the shore. That point is 8km from the oil collection facility. It costs a million dollars per km to build piping in the water and 500,000 dollars per km to build piping on the shore. What location should you place the point where the shore and sea connection to minimize the cost of laying the piping?

Cost = c

$\displaystyle c=1,000,000WP + 500,000PB$

$\displaystyle WP=\sqrt{(WA)^2 + (AP)^2} $

$\displaystyle AP= 8km-PB $

$\displaystyle WP=\sqrt{25+(8-PB)^2}=\sqrt{89-16PB+(PB)^2}$

$\displaystyle c=1,000,000\sqrt{89-16PB+(PB)^2} + 500,000PB$

$\displaystyle dc/dPB = 1,000,000\frac{-16+2PB}{2\sqrt{89-16PB+

(PB)^2}}+500,000=0$

$\displaystyle -\sqrt{89-16PB+(PB)^2}=-16+2PB$

$\displaystyle 89-16PB+(PB)^2 = 256-32PB+4(PB)^2$

$\displaystyle 3(PB)^2-16PB+167=0$

oops, The quadratic gives me a negative square root. Where did I go wrong?

P.S. I've solved this done by turning AP into x and PB into 8-x. I get the solution that way. I was trying to do it as above and I cannot get it, Both methods should give me the answer, but THIS way won't work for some reason.