Step 1: Set up:
Let the wall be a circle with centre \(O\) and radius \(r\). Let \(N\) and \(S\) be the north and south gates, so \(NS = 2r\). The house \(H\) is 3 km north of \(N\), so \(HN = 3\) and \(HS = 2r+3\). The point \(P\) is 9 km east of \(S\).
Step 2: Tangents:
The east-west line through \(S\) is tangent to the circle at \(S\), so the tangent length from \(P\) is \(PS = 9\). The line of sight \(HP\) just touches the wall, so it is tangent at some point \(T\), and \(PT = PS = 9\).
By the tangent-secant rule from \(H\): \(HT^2 = HN \cdot HS = 3(2r+3)\).
Step 3: Use the right triangle \(HSP\):
\(HS\) is vertical and \(SP\) horizontal, so \(HP^2 = (2r+3)^2 + 81\). Also \(HP = HT + TP = \sqrt{3(2r+3)} + 9\).
Let \(d = 2r+3\). Then \((\sqrt{3d}+9)^2 = d^2+81\), so \(3d + 18\sqrt{3d} = d^2\), i.e. \(18\sqrt{3d} = d(d-3)\).
Squaring: \(972\,d = d^2(d-3)^2\), so \(d(d-3)^2 = 972\).
Step 4: Solve:
For \(d>3\) the expression \(d(d-3)^2\) increases with \(d\), and \(d = 12\) gives \(12 \times 81 = 972\). So \(2r + 3 = 12\), \(r = 4.5\) km and the diameter is \(2r = 9\) km.
Final Answer:
The correct option is (3): 9 km