Electrostatic energy of alternating-charge concentric shells (source code)

= Electrostatic energy of alternating-charge concentric shells
{title2=$W=\frac{q^2}{8\pi\epsilon_0r_1}$}

A first spherical shell with charge $q$ followed by shells of charges $2(-1)^{n+1}q$ leaves enclosed charge $(-1)^{n+1}q$ after each shell. <Gauss's law> therefore gives the same squared <electric field> $q^2/(16\pi^2\epsilon_0^2r^4)$ in every gap outside the first radius. Integrating the <electrostatic energy> density over all space gives $W=q^2/(8\pi\epsilon_0r_1)$, independent of the other shell radii.