Find the electric field a distance $z$ from the center of a spherical surface of radius $R \text { (Fig. } 2.11),$ which carries a uniform charge density $\sigma .$ Treat the case $z < R$ (inside) as well as $z > R$ (outside). Express your answers in terms of the total charge $q$ on the sphere. [Hint:Use the law of cosines to write $r$ in terms of $R$ and $\theta .$ Be sure to take the positive square root:
$\sqrt{R^{2}+z^{2}-2 R z}=(R-z) \text { if } R > z, \text { but it's }(z-R) \text { if } R < z .]$.