# Writing an objective function

I have this problem here: How to write a formula for the objective function?

A powerhouse is located on one bank of a straight river that is $30$ feet wide. A factory is situated on the opposite bank of the river, $200$ feet downstream from the point $P$ directly opposite the powerhouse. What is the most economical path for a cable connecting the powerhouse to the factory if it costs $4$ dollars per foot to lay the cable under water and $2$ dollars per foot on land?

Choose a point on the side of the river that the factory is on, $x$ feet downstream from the powerhouse. Plan to run the cable from the powerhouse to that point under water, then from that point to the factory on land.
• @MalazKreiker: No, you made several mistakes. You only need one variable, as I showed in my outline. In my version, the distance under water is not $x$, it is the hypotenuse of a right triangle where one side is $x$. The distance on land is the remaining distance from the end of that hypotenuse to the factory: this is a simple line segment, but the distance here is also not $x$. Both those distances are functions of $x$, which you need to find. Draw a diagram to represent the problem's situation and add my information to that diagram. Jan 2 '16 at 15:46