I am a Calculus 1 student and I have an optimization word-problem that is giving me a lot of trouble.
It has two variables. I have found the value for $y$, but when I plugged it into the equation and tried to solve for the $x$ I couldn't find it's value. I used Symbolab to solve it, but it came up with a decimal number that's extremely complicated when written as a fraction. My professor has given us very complicated problems before, but the complexity of this number is such that I feel like it's very likely I did something wrong.
I have checked other parts of my work with Symbolab and I am still not sure where I went wrong, but I would really appreciate it if you would take a look and determine if there are any parts that don't look right to you.
An oil refinery is located on the north bank of a straight river which is $2$km wide. A pipeline is to be constructed from the refinery to storage tanks located 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 to a point $P$ on the north bank and $\$800,000$ per km under the river to the tanks. To minimize the cost of the pipeline, where should $P$ be located?
$P=$ The area where the pipeline enters the river.
$x=$ The horizontal distance between the oil refinery and the storage tanks.
$y=$ The euclidean distance between $P$ and the storage tanks.
The Pythagorean theorem states $2^2+(6-x)^2=y^2$.
The cost of the pipeline is $C = 400,000x+800,000y$.
finding $y$:
$$4+(6-x)^2 = y^2 \to y= \pm \sqrt{4+(6-x)^2}$$
Differentiating $C = 400,000x+800,000\sqrt{4+(6-x)^2}$:
$$\frac{d}{dx}\sqrt{4+(6-x)^2}=\frac{1}{2\sqrt{4+(6-x)^2}}\cdot-2(6-x)=\frac{-(6-x)}{\sqrt{4+(6-x)^2}}$$
$$\frac{d}{dx}800,000\sqrt{4+(6-x)^2}=[\frac{-(6-x)}{\sqrt{4+(6-x)^2}}\cdot800,000] = \frac{-800,000(6-x)}{\sqrt{4+(6-x)^2}}$$
$$\frac{d}{dx}400,000x+800,000\sqrt{4+(6-x)^2}=400,000-\frac{800,000(6-x)}{\sqrt{4+(6-x)^2}}$$
Setting $400,000-\frac{800,000(6-x)}{\sqrt{4+(6-x)^2}} = 0$ and solving for $x$.
$$x=4.84530..$$
I'm not completely sure how to write the fraction out with math notation here because a single square root seems to cover part of the numerator and all of the denominator, but you can see it if you plug $400,000-\frac{800,000(6-x)}{\sqrt{4+(6-x)^2}} = 0$ into Symbolab's "solve for" calculator.