# Inconsistency with electrostatic energy formulas

The energy of point charge configuration can be written as: $$W = \frac{1}{2}\sum_{i=1}^{n}q_{i}V(r_{i}) \, ,$$ which can take both positive and negative values. However, when we integrate the equation to get the energy of a continuous charge dustribution: $$W = \frac{1}{2}\int\rho Vd\tau \Rightarrow W = \frac{\epsilon_{0}}{2}\left [ \int E^{2} d\tau + \oint VE\cdot da\right ] \, .$$

Take the volume to integrate to be all space, then the second term vanishes: $$W = \frac{\epsilon_{0}}{2}\int E^{2}d\tau \, .$$ This formula can take only positive values.

So there is a discrepancy between the two formulas. What caused the discrepancy? According to Griffith's Introduction to Electrodynamics, it says in the former equation $V(r_{i})$ represent the potential due to all charges but $q_{i}$, whereas later $V(r_{i})$ is the full potential. But why would the original charge has any potential when there is no other charge already present?

The difference is the zero point. When summing over charges, the reference is a state in which this charges are infinitely separated. Those are still distinct, localized charges, just separated from each other.

When integrating $E^2$ over all space, the reference state has all charge separated. Even the individual charges from the first method are broken up, so that $E=0$ everywhere.

The second method has its reference at an "absolute zero", so to speak. The first method has its reference with a lot of positive energy needed to gather the individual charges. That's why the first method can have negative values.

$$W = \frac{1}{2}\sum_{i\neq j}q_{i}V_j(\vec r_{i}) \, .$$
$$W = \frac{1}{2}\sum_{i\neq j}\frac{q_iq_j}{4\pi\epsilon_0|\vec r_i-\vec r_j|} \, .$$