\documentclass[11pt,fleqn]{article}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% template that does not use Revtex4
%%% but allows special fonts
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%
%%% Please use this template.
%%% Edit it using e.g. Notepad
%%% Ignore the header (do not change it)
%%% Process the file in the Latex site
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Page setup
\topmargin -1.5cm
\oddsidemargin -0.04cm
\evensidemargin -0.04cm
\textwidth 16.59cm
\textheight 24cm
\setlength{\parindent}{0cm}
\setlength{\parskip}{0cm}
% Fonts
\usepackage{latexsym}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{bm}
% Math symbols I
\newcommand{\sinc}{\mbox{sinc}}
\newcommand{\const}{\mbox{const}}
\newcommand{\trc}{\mbox{trace}}
\newcommand{\intt}{\int\!\!\!\!\int }
\newcommand{\ointt}{\int\!\!\!\!\int\!\!\!\!\!\circ\ }
\newcommand{\ar}{\mathsf r}
\newcommand{\im}{\mbox{Im}}
\newcommand{\re}{\mbox{Re}}
% Math symbols II
\newcommand{\eexp}{\mbox{e}^}
\newcommand{\bra}{\left\langle}
\newcommand{\ket}{\right\rangle}
% Mass symbol
\newcommand{\mass}{\mathsf{m}}
\newcommand{\Mass}{\mathsf{M}}
% More math commands
\newcommand{\tbox}[1]{\mbox{\tiny #1}}
\newcommand{\bmsf}[1]{\bm{\mathsf{#1}}}
\newcommand{\amatrix}[1]{\begin{matrix} #1 \end{matrix}}
\newcommand{\pd}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\eps}{\epsilon}
\newcommand{\fd}[2]{\frac{d #1}{d #2}}
\newcommand{\ffd}[2]{\frac{d^2 #1}{d #2^2}}
\newcommand{\fdl}[2]{(d #1/d #2)}
% Other commands
\newcommand{\hide}[1]{}
\newcommand{\drawline}{\begin{picture}(500,1)\line(1,0){500}\end{picture}}
\newcommand{\bitem}{$\bullet$ \ \ \ }
\newcommand{\Cn}[1]{\begin{center} #1 \end{center}}
\newcommand{\mpg}[2][1.0\hsize]{\begin{minipage}[b]{#1}{#2}\end{minipage}}
\newcommand{\Dn}{\vspace*{3mm}}
% Figures
\newcommand{\putgraph}[2][0.30\hsize]{\includegraphics[width=#1]{#2}}
% heading
\newcommand{\heading}[1]{\begin{center} \Large {#1} \end{center}}
\newcommand{\auname}[1]{\begin{center} \bf Submitted by: #1 \end{center}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% DO NOT EDIT BEFORE THIS LINE
%% START YOUR TEXT FROM HERE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\heading{Electric field}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% LEAVE THE PART BETWEEN THE COMMENTED LINES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{\bf The problem:}
\Dn
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Given a thin sphere, radius $R$, charge $Q$ (divided evenly across the sphere), calculate
the electric field inside and outside of the sphere:
\begin{enumerate}
\item using direct integration (the Coulomb's law).
\item using the Gauss's law.
\end{enumerate}
Using the result, calculate the electric field of a homogeneously charged solid sphere, radius $R$, charge $Q$.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% LEAVE THE PART BETWEEN THE COMMENTED LINES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Dn
{\bf The solution:}
\Dn
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1.According to the Coulomb's law
%
\begin{eqnarray}
d\vec E = \frac{k dq (\vec r-\vec {r'})}{|\vec r-\vec {r'}|^3}
\end{eqnarray}
%
In our case:
%
\begin{eqnarray}
\sigma &=& \frac{dq}{da} = \frac{Q}{A} = \frac{Q}{4\pi R^2} \\
da &=& R^2 \sin\theta d\theta d\phi \\
dq &=& \frac{Q\sin\theta}{4\pi} d\theta d\phi
\end{eqnarray}
For simplicity let us choose
\begin{eqnarray}
\vec{r} = (0,0,z)
\end{eqnarray}
(any other point can be reached by rotating
the coordinates) and
\begin{eqnarray}
\vec{r'} = (R\sin\theta \cos\phi,R\sin\theta \sin\phi, R\cos\theta)
\end{eqnarray}
%
then
\begin{eqnarray}
|\vec r-\vec {r'}| = (R^2 + z^2 - 2Rz\cos\theta)^{1/2}
\end{eqnarray}
%
Therefore,
%
\begin{eqnarray}
E = \frac{kQ}{4\pi}\int^{\pi}_{0} {\sin\theta d\theta\int^{2\pi}_{0} d\phi
\frac{1}{(R^2 + z^2 - 2Rz\cos\theta)^{3/2}}
(-R\sin\theta \cos\phi,-R\sin\theta \sin\phi,z- R\cos \theta)}
\end{eqnarray}
$E_x$ and $E_y$ both equal $0$ (since $\sin\phi$ and $\cos\phi$ are both periodic for $2\pi$).
%
\begin{eqnarray}
E_z = \frac{kq}{2} \int^{\pi}_{0} \frac{\sin\theta(z-R\cos\theta)}
{(R^2 + z^2 - 2Rz\cos\theta)^{3/2}} d\theta
\end{eqnarray}
%
substituting $\cos\theta $ for t we get:
%
\begin{eqnarray}
E_z &=& \frac{kQ}{2} \int^{1}_{-1} \frac{z-Rt}{(R^2 + z^2 - 2Rzt)^{3/2}} dt \\
%
&=&\frac{kQ}{2} \cdot (-1) \frac{\partial}{\partial z} \int^{1}_{-1} \frac{dt}{(R^2 + z^2 - 2Rzt)^{1/2}} \\
%
&=&\frac{kQ}{2} \frac{\partial}{\partial z} \left[ \frac{1}{Rz}(R^2 + z^2 - 2Rzt)^{1/2}|^{1}_{-1}\right] \\
%
&=&\frac{kQ}{2} \frac{\partial}{\partial z} \left[ \frac{1}{Rz} (|R-z| - |R+z|)\right] \\
E_z
&=&
\begin{cases}
kq/z^2, & |z|>R \\
0, & |z|R$ then all of charge is in the sphere, and we get :
%
\begin{eqnarray}
E =\frac{kQ}{r^2}
\end{eqnarray}
%
and if $r_1R$ each thin sphere induces $dE_r = \frac{k dq}{r^2}$. Therefore,
$E_r = \frac{k Q}{r^2}$.
For $rR
\end{cases}
\end{eqnarray}
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}