Using algebra and calculus i need to solve this written question for x City a is separated by a 2km wide river and are located as shown in Figure 1 (not drawn to scale). A road is to be built between city A to B that crosses a bridge straight across the river. 
Use the Sign Test to determine the type of stationary point 
Test to see if you have a minimum

Move $B$ $2$km closer to the river, in a direction perpendicular to the river, and ignore the river.  Then you won't even need to use calculus.
Specifically, the shortest distance between $A$ and$B$ is now the straight line distance
$$\sqrt{17^2+12^2}=\sqrt{433}$$
and the value of $x$ will be given by similar triangles:
$$x=17\times\frac{9}{12}=\frac{51}{4}\ .$$
Moving $B$ back where it was adds the $2$ km length of the bridge for a total of $2+\sqrt{433}$ km.
