There is a question that says,

A new cottage s built across the river and 300m downstream from the nearest telephone relay station. The river is 120m wide. In order to wire the cottage for phone service, wire will be laid across the river under water, and along the edge of the river above ground. The cost to lay wire under water is $15/m and the cost to lay wire above ground is $10/m. How much wire should be laid under water to minimize the cost? Be sure to check that your answer is indeed a minimum.

I drew a picture to illustrate the cottage, river and telephone station,

I did a calculation trying to see what the total cost would be if the wire was to be laid by going across the river vertically so the whole 120m and then 300m horizontally to the cottage,

C=15(120)+10(300) \par

=4800

and then I decided to see how it would look if the wire went diagonal through the river to the other side by doing the pythagorean theorem pretending that the 120m across the river was one side of a square and then another side would be 120m and the diagonal after using the pythagorean was 169.7m. Then I went 300-169.7=130.3 and did this,

C=15(169.7)+10(130.3)

=3848.5

So it would cost less to go across the river diagonally, but I need to figure this out using a function. So I know that the function should look like this,

c^2=a^2+b^2

c^2=x^2+120^2

sqrt(c^2)=sqrt(x^2+14400)

c=sqrt(x^2+14400)

C=10(300-x)+15(x^2+14400)^(1/2)

C'=-10+15x(x^2+14400)^-(1/2)

So now I need to find the x's and this is where I am confused.

0=-10+15x(x^2+14400)^-(1/2)

I was struggling to figure out how to do this so I found someone figured this out online and came up with the answer,

1)

C=10(300-x) +15(x^2+120^2)^(1/2)

dC/dx= 15x/(x^2+14400)^(1/2) -10

0=15x/(x^2+14400)^(1/2) -10

no steps showing how they arrived at this,

x=107.33

161 m of wire under water

2)

y=(2000+200x)(48-2x)

dy/dx=5600-800x

0=5600-800x

x=7

$34 produces max profit

And then I tried plugging, 0=-10+15x(x^2+14400)^-(1/2) into mathway.com and they show the x's as 0, 120i, 120i. So once again I'm at a loss as to which was is right, although mathway provides steps so I'm more inclined to go with that answer however I'm not even sure how to solve past that answer either.

I'm teaching myself calculus and I apologize if I'm making this out to be more complicating than it probably is but I want to make sure I can figure these problems out the right way. Thanks for your time and help!

Edit: don't mind the attachment at the bottom of my post, I'm not sure how to delete it.