Solution (source code)

= Solution

At <electrostatic equilibrium> the <electric field> in the metal is zero. The empty cavity also has zero <electric field>, by the <uniqueness theorem for the electrostatic potential>. The <electric charge> lies on the outer surface. For the isolated <conducting sphere>, <spherical symmetry> and <Gauss's law> give
$$
\boxed{\mathbf E(r)=\begin{cases}0,&r<R,\\ \dfrac{Q}{4\pi\epsilon_0r^2}\hat{\mathbf r},&r>R.\end{cases}}
$$
Taking the <electric potential> to vanish at infinity and using $E_r=-d\phi/dr$ gives
$$
\boxed{\phi(r)=\begin{cases}\dfrac{Q}{4\pi\epsilon_0R},&r\leq R,\\ \dfrac{Q}{4\pi\epsilon_0r},&r\geq R.\end{cases}}
$$
The <electric potential> is continuous at the surface, while the normal <electric field> jumps by $\sigma/\epsilon_0$, with <surface charge density> $\sigma=Q/(4\pi R^2)$.