A pipeline is to be laid from a point $A$ on one bank of a river of width $1$ unit to a point $B$ $2$ units downstream on the opposite bank, as shown in Figure 8.40.
Because it costs more to lay the pipe under water than on dry land, it is proposed to take it in a straight line across the river to a point $C$ and then along the river bank to $B$. If it costs $\alpha ~\%$ more to lay a given length of pipe under the river than along the bank, write down a formula for the cost of the pipeline, specifying the domain of the function carefully. What recommendation would you make about the position of $C$ when (a) $\alpha = 25$, (b) $\alpha = 10$?
I may have the wrong working equation:
Cost = length of pipe x cost/length
assuming cost/length is $1/unit, therefore,
Cost(underwater) = Cost(riverbank) + (0.25 x Cost(riverbank))
$$\frac{dL}{dx}=\frac{d}{dx} \left( \sqrt{x^2 + 1} + (2-x) \right) = \frac{x}{\sqrt{x^2 + 1}} - 1$$

Let us think a bit more on this problem: Let's say that the pipe under water costs $\mathscr{K}_1$ per meter with a length of $\text{L}_1$ meter, the width of the river is $\mathscr{W}$. The costs for the pipe on land is $\mathscr{K}_2$ per meter with a length of $\text{L}_1$ meter.
So, we can write:
$$\mathscr{K}_{\space\text{total}}=\mathscr{K}_1\cdot\text{L}_1+\mathscr{K}_2\cdot\text{L}_2\tag1$$
For $\text{L}_1$, we can write:
$$\text{L}_1=\left|\text{AC}\right|=\sqrt{\mathscr{W}^2+x^2}\tag2$$
For $\text{L}_2$, we can write:
$$\text{L}_2=\left|\text{BC}\right|=2\cdot\mathscr{W}-x\tag3$$
So, we can rewrite $\left(1\right)$ as follows:
$$\mathscr{K}_{\space\text{total}}=\mathscr{K}_1\cdot\sqrt{\mathscr{W}^2+x^2}+\mathscr{K}_2\cdot\left(2\cdot\mathscr{W}-x\right)\tag4$$
Let's find:
$$\frac{\partial\mathscr{K}_{\space\text{total}}}{\partial x}=0\space\implies\space x=\frac{\sqrt{5\cdot\left(\mathscr{K}_1\cdot\mathscr{K}_2\cdot\mathscr{W}\right)^2-\left(\mathscr{K}_1^2\cdot\mathscr{W}\right)^2}-2\cdot\mathscr{K}_2\cdot\mathscr{W}}{\mathscr{K}_1^2-\mathscr{K}_2^2}\tag5$$
Now, we also know that:
$$\mathscr{K}_1=\frac{100+\left(\alpha\space\text{%}\right)}{100}\cdot\mathscr{K}_2\tag6$$