A pump house is to be placed at some point $X$ along a river, A pipe from point $A$ and a pipe from point $B$ will then be connected to the point $X$. How far should $X$ be away from $M$, so that the total length of the pipes $\overline{AX}$ and $\overline{BX}$ are minimised?
I just need help with setting up the function.

$AM+XB$ is minimum when reflexing $B$ in $D$ wrt $MB$ we connect $AD$. The point $X$ where $AD$ intersects $MN$ is the minimum required. Because any other point $P$ is such that $AP+PD>AD$ for the triangular inequality.
$\triangle ACD$ similar $\triangle AMX$
$MX:AM=CD:AC$
$MX=\frac{AM\cdot CD}{AC}=\frac{10}{3}$km