Electrostatics interaction energy problem A point charge Q is placed at the center of a spherical cavity of radius 'b' carved inside a solid conducting sphere of radius 'a'  then the total energy of system is 
My attempt at the solution- lets call the small sphere B and the large sphere A. So to calculate the total energy of the system, we have the following
1. Self energy of A
2. Self energy of B
3. Interaction energy of pount charge Q and sphere B
4. Interaction energy of A and B
I am able to calculate 1,2,3 but I do not know how I am supposed to calculate 4. The answer is interaction energy for A and B is going to be zero but I don't know how. 
 A: This is almost equivalent to finding the total electrostatic energy distributed in all space.
The electrostatic energy density in terms of the electric field is:
$$u=\frac{\epsilon_0 E^2}{2}$$
$\begin{align}
U_{total}&= \text{Energy inside the cavity}+\text{Energy in the body of the conductor}+\text{Energy oustide in free space}\\
&=\frac{\epsilon_0}{2}\int\limits_{0}^{b}\left(\frac{Q}{4 \pi\epsilon_0 r^2}\right)^24\pi r^2 dr+\underbrace{0}_{\text{field inside a conductor is 0}}+\frac{\epsilon_0}{2}\int\limits_{a}^{\infty}\left(\frac{Q}{4 \pi\epsilon_0 r^2}\right)^24\pi r^2 dr\\
&=\frac{\epsilon_0}{2}\times \frac{4 \pi Q^2}{\left(4 \pi \epsilon_0\right)^2}\times \left(-\frac{1}{r}\Big|_{0}^b+-\frac{1}{r}\Big|_{a}^\infty\right)\\
&=\frac{Q^2}{8 \pi \epsilon_0}\times\left(\frac{1}{r}\Big|_{0}+\frac{1}{a}-\frac{1}{b}\right)\\
&=\underbrace{\frac{Q^2}{8 \pi \epsilon_0}\times\frac{1}{r}\Big|_{0}}_{\text{Energy to create a point charge Q in free space}}+\frac{Q^2}{8 \pi \epsilon_0} \times \left(\frac{1}{a}-\frac{1}{b} \right)
\end{align}$
$$\therefore U_{total}-\text{Self energy of a point charge Q}=\frac{Q^2}{8 \pi \epsilon_0} \times \left(\frac{1}{a}-\frac{1}{b} \right)$$
Note how the inifnte result was caught and interpreted appropiately in arriving at the final answer.
Explanation:(on OP's request)


*

*The energy of the system really means the energy needed to assemble the charges adiabatically(or slowly). From Work-Energy theorem, one has:
$$W_{\text{total}}=W_{\text{external agent}}+W_{field}(\text{or}\; U)=\Delta T$$ For slow process, the change in kinetic energy of the charge element($dT$) is zero always. Hence $W_{ext}=-W_{field}$. So we see that the work done by the external agent in assembling the charges is stored in the electrostatic field. Hence the reason why I chose to compute $W_{field}$.

*"Almost" equivalence was used because, the space of integration of field energy contained a point charge. This meant that it would have an infinite contribution to the energy in the region close to it. This infinite energy is really the energy required to create the charge in the first place! This is obviously not what the external agent ever does. He just places charges around.

*One can do the following as well, for the cavity energy, where one is careful about the source(point sources are delta functions):


$\begin{align}W_{\text{cavity field}}&=\frac{1}{2}\int\rho V d\tau+\frac{1}{2}\int \sigma V d \tau\\
&=\frac{1}{2}\int Q \delta^3({\mathbf{r})} \frac{Q}{4 \pi \epsilon_0 r}4 \pi r^2 dr+\frac{1}{2}\frac{-Q}{4 \pi \epsilon_0 b}\int \sigma d \tau=0+\frac{Q}{8 \pi \epsilon_0 b}\times(-Q)=-\frac{Q^2}{8 \pi \epsilon_0 b}
\end{align}$ 
This method avoids the self-energy contribution as the kind of source gets explicitly specified.
