Electric field lines between surfaces of hollow sphere I was wondering what was the direction of the electric field between the two surfaces of a hollow sphere with constant charge density $\rho$. With the help of Gauss' Law I got the following absolute values for $\vec{E}$:
$r<r_1$: $E = 0$
$r_1<r<r_2$: $E = \frac{\rho}{3 \epsilon_0} (r - \frac{r_1^3}{r})$
$r_2 < r$: $E = \frac{\rho}{3 \epsilon_0} \frac{r_2^3 - r_1^3}{r^2}$.
I would think that the field lines are directed outwards for $r>r_2$ and inwards for $r_1<r<r_2$ because there is more positive charge on the outer border of the shell than on the inner one (the volume element is there greater). But when I graph $E(r)$ it then creates a surprising discontinuity at $r_2$ that makes me think it might also be directed radially outwards. Can someone please clear up my doubts?
Thanks a lot in advance.
Julien.
 A: Due to the spherical symmetry, the electric field can never be directed inwards (assuming $\rho$ is positive.)  To prove this, proceed by contradiction:


*

*Suppose there was some point in space where the electric field pointed inwards.  Let $R$ denote the distance between this point and the center of the sphere.

*By spherical symmetry, all points at this same distance $R$ from the center of the sphere must have an inward-directed electric field.

*If we then take a Gaussian surface to be a sphere of radius $R$, the integral of the electric flux over this surface will be $\oint \vec{E} \cdot d\vec{a} < 0$, since $\vec{E}$ and $d\vec{a}$ point in opposite directions.

*By Gauss's Law, the total charge enclosed in this sphere must therefore be negative.  This is a contradiction, because $\rho$ is positive or zero everywhere in space.

By the way, your electric field magnitude isn't "discontinuous";  the value of the electric field as you approach $r_2$ (or $r_1$) from the inside is the same as you approach that same point from the outside.  It does, however, have a "kink" in the plot.  A general rule of thumb is that if the charge distribution $\rho$ is defined at all points in space and has a discontinuous $n$th derivative, then $\vec{E}$ will have a discontinuous $(n+1)$th derivative.  Here, since the function $\rho$ is itself discontinuous at $r = r_1$ and $r = r_2$ (we can think of this as the "0th" derivative being discontinuous), then the first derivative of $\vec{E}$ is also discontinuous.
A: EDITED INTERPRETATION:  Uniform Volume Charge Density between at $r_1$ and $r_2$
If $\rho$ is a uniform volume charge density for $r_1\le r\le r_2$, then we have from Gauss's Law for $r\in [r_1,r_2]$
$$\begin{align}
\oint_{|\vec r|=r}\vec E(\vec r)\cdot \hat n\,dS&=4\pi r^2E_r(r)\\\\
&=\frac{1}{\epsilon_0}4\pi (r^3-r_1^3)\rho
\end{align}$$
Therefore, for $r_1<r<r_2$, the electric field $\vec E(\vec r)$ is given by
$$\bbox[5px,border:2px solid #C0A000]{\vec E(\vec r)=\hat r \frac{\rho}{\epsilon_0}\left(r-\frac{r_1^3}{r^2}\right)} \tag 1$$
For $r_2<r$, application of Gauss's Law reveals that
$$\oint_{|\vec r|=r}\vec E(\vec r)\cdot \hat n\,dS=4\pi r^2E_r(r)=\frac{4\pi \rho}{\epsilon_0}\left( r_2^3-r_1^3\right)$$
Therefore, for $r_2<r$, the electric field $\vec E(\vec r)$ is given by
$$\bbox[5px,border:2px solid #C0A000]{\vec E(\vec r)=\hat r \frac{\rho}{\epsilon_0}\left(\frac{r_2^3-r_1^3}{r^2}\right)} \tag 2$$
Note that for $r=r_1$, the electric field as given by expression in $(1)$ is $0$ and the electric field is continuous at $r_1$.
For $r=r_2$, the electric field as given by expression in $(1)$ is $\vec E(\vec r)=\hat r \frac{\rho}{\epsilon_0}\left(\frac{r_2^3-r_1^3}{r_2^2}\right)$, which is equal to the electric field as given by $(2)$ for $r=r_2$.   Hence, the electric field is continuous at $r_2$.

ORIGINAL INTERPRETATION:  Surface Charge Layers at $r_1$ and $r_2$
The result in the OP is not quite correct.  The charge density $\rho$ is a surface charge density with units C/$\text{m}^2$.  The total charge on the surface $r=r_1$ is $4\pi r_1^2 \rho$ while the total charge on the surface $r=r_2$ is $4\pi r_2^2 \rho$.  The total charge enclosed is therefore is the sum $4\pi (r_1^2+r_2^2)\rho$.
Applying Gauss's Law to the region $r_1<r<r_2$ reveals 
$$\begin{align}
\oint_{|\vec r|=r}\vec E(\vec r)\cdot \hat n\,dS&=4\pi r^2E_r(r)\\\\
&=\frac{1}{\epsilon_0}4\pi r_1^2\rho
\end{align}$$
Therefore, for $r_1<r<r_2$, the electric field $\vec E(\vec r)$ is given by
$$\bbox[5px,border:2px solid #C0A000]{\vec E(\vec r)=\hat r \frac{\rho}{\epsilon_0}\left(\frac{r_1}{r}\right)^2}$$
For $r_2<r$, application of Gauss's Law reveals that
$$\oint_{|\vec r|=r}\vec E(\vec r)\cdot \hat n\,dS=4\pi r^2E_r(r)=\frac{4\pi \rho}{\epsilon_0}\left( r_1^2+r_2^2\right)$$
Therefore, for $r_2<r$, the electric field $\vec E(\vec r)$ is given by
$$\bbox[5px,border:2px solid #C0A000]{\vec E(\vec r)=\hat r \frac{\rho}{\epsilon_0}\left(\frac{r_1^2+r_2^2}{r^2}\right)}$$


NOTE: 
The electric field is discontinuous across the surface charge layers with 
$$E_r(r_i^+)-E_r(r_i^-)=\frac{\rho}{\epsilon_0}$$
for $i=1,2$.

