# Where should the junction box be placed to minimize the length of wire needed in the following case:Two isolated farms are situated 12 km apart on a straight country road that runs parallel to the main highway 20 km away. The power company decides to run a wire from the highway to a junction box, and from there, wires of equal length to the two houses.

The junction box is at an equal distance from the two farms. If a line perpendicular to the country road is drawn between the farms, the junction box is on it. Let the junction box be x km from the highway. It is 20 - x km from the country road.

The length of wire from the junction box to each of the farms is `sqrt((20 - x)^2 + 36)` . The length of the wire from the highway to the junction box is x. The total length of the wire required is `x + 2*sqrt((20 - x)^2 + 36)`

This has to be minimized. The derivative of `x + 2*sqrt((20 - x)^2 + 36)` is `1 + (2*(1/2)*2*(20 - x)*-1)/sqrt((20 - x)^2 + 36)` . Equating this to 0 and solving for x.

=> `1 + (2*(1/2)*2*(20 - x)*-1)/sqrt((20 - x)^2 + 36)` = 0

=> `-2*(20 - x) = -1*sqrt((20 - x)^2 + 36)`

=> `40 - 2x = sqrt((20 - x)^2 + 36)`

=> 4x^2 + 1600 - 160x = (20 - x)^2 + 36

=> 4x^2 + 1600 - 160x = 400 + x^2 - 40x + 36

=> 3x^2 - 120x + 1164 = 0

The equation has two roots `20 + 2*sqrt 3 and 20 - 2*sqrt 3` . The distance cannot be greater than 20.

The junction box should be placed `20 - 2*sqrt 3` km from the highway.