Consider a charged sphere of radius $a$ and volume charge density $\rho$. Find the total work done to assemble this sphere, i.e total electric potential of this sphere. Use, $$U ={1\over 8\pi} \int_{\text{Entire field}} E^2 dv$$
I am using cgs unit instead of SI to get rid of pesky $k$ from my equations.
Consider a sphere of arbitrary volume $v$ less than the sphere in question.
Then I got $$v = \frac43\pi r^3 \iff r = \left({3v \over 4\pi}\right)^{1/3}$$
Since $\displaystyle E = {Q\over r^2} = {\rho v\over r^2} = {\rho v^{1/3}(4\pi)^{2/3}\over 3^{2/3}}$, I got $$E^2 = {\rho^2 v^{2/3}(4\pi)^{4/3}\over 3^{4/3}} $$
Plugging this in the given equation,
$$U = {1\over 8\pi}\int^{V_f}_0 {\rho^2 v^{2/3}(4\pi)^{4/3}\over 3^{4/3}} dv$$
Where $V_f$ is the volume of the sphere in the question.
Hence I got $$U = {1\over 10}\left({4\pi\over 3}\right)^{1/3}{\rho^2v^{5/3} }$$
Since $q^2 = (\rho v)^2$, where $q$ is the total charge of the sphere, $$U = {1\over 10} \left({4\pi\over 3}\right)^{1/3} {Q^2 \over v^{1/3}}$$
Substituting for $\displaystyle v = {4\over 3}\pi a^3$, I get,
$$U = {Q^2\over 10a}$$.
The given answer is $\displaystyle U = \frac35{Q^2 \over a}$.
I am missing a factor of $6$ in my answer. I think I messed up my limits on integral. Please help me.
Hint: So far, you've only included the energy due to the field inside the sphere. But there is also a field outside the sphere---specifically, $E=Q/r^2$ for $r>a$---and this must be counted if we want the total energy required to assemble the sphere. (Imagine you want to add a bit of charge to the sphere; to do so, you'll have to bring it in from infinity and therefore do work against the field outside on the way.) This gives exactly the contribution required for the final result.