Suppose there are N charges fixed at arbitrary locations , how do I calculate the total electrostatic energy ? I can think of two ways. one being the straightforward coulomb's law : k=1/(4*pi*ε) Q=k/2 * ΣiΣj qiqj / |ri-rj| ; i≠j the other method is to integrate energy density with respect to volume , which would most likely depend on the distribution of the charges. My questions are, do these methods yield the same result ? If so , how could I show that they are equivalent in both mathematical and physical sense?