# Electrostatic energy

### Energy of a system of charges

If one has two point charges $q_i$ and $q_j$, the potential energy of this pair is

$U_{ij} = \frac1{4\pi\epsilon_0} \frac{q_i q_j}{r_{ij}}$

where $r_{ij}$ is the distance between the two charges.

If we have N charge system,

$U = \sum_{all pairs}U_{ij} = \frac12\sum_{i=1}^N\sum_{\substack{j=1 \\ i\neq j}}^N U_{ij} = \frac12\sum_{i=1}^N\sum_{\substack{j=1 \\ i\neq j}}^N \frac{q_i q_j}{4\pi\epsilon_0 r_{ij}}$

If we regroup,

$U = \frac12\sum_{i=1}^N q_i \left( \sum_{j=1}^N \frac{q_j}{4\pi\epsilon_0 r_{ij}}\right) = \frac12\sum_{i=1}^N q_i V_i(\mathbf{r}_i)$

If charges are continuously distributed,

$U = \frac12 \int_{\mathrm{all\_ space}} \rho(\mathbf{r}) V(\mathbf{r}) d\tau$

### Energy of a system of conductors

As charges are all on the surface of a conductor, and its potential is constant,

$U_i = \frac12 V_i \int_{S_i} \sigma_i da_i = \frac12 Q_i V_i$

So, the total energy of the system is

$U = \frac12 \sum_{i=1}^N Q_i V_i$

#### Isolated conductor

$U = \frac12 QV = \frac{Q^2}{2C} = \frac12 CV^2$

for sphere,

$U = \frac12 \frac{Q^2}{r\pi\epsilon_0 a}$

### Energy in terms of Electric field

By replacing $\rho = \epsilon_0 \nabla\cdot\mathbf{E}$

$U = \frac{\epsilon_0}{2} \int V(\nabla\cdot\mathbf{E}) d\tau$

By using $V(\nabla\cdot\mathbf{E}) = -\mathbf{E}\cdot\nabla V + \nabla\cdot(V\mathbf{E}) = \mathbf{E}^2+\nabla\cdot(V\mathbf{E})$

\begin{align} U &= \frac{\epsilon_0}{2}\int\mathbf{E}^2 d\tau + \frac{\epsilon_0}{2}\int\nabla\cdot(V\mathbf{E})d\tau \\ &= \frac{\epsilon_0}{2}\int\mathbf{E}^2 d\tau + \frac{\epsilon_0}{2}\oint_S (V\mathbf{E})\cdot d\mathbf{a} \\ &= \frac{\epsilon_0}{2}\int_{all\_space}\mathbf{E}^2 d\tau \end{align}

As $r \rightarrow \infty$

$V \sim \frac1{r}$ and $|\mathbf{E}| \sim \frac1{r^2}$

This leads to the definition of energy density

$u_e = \frac12 \epsilon_0 \mathbf{E}^2$

### Energy in dielectric

\begin{align} U &= \frac12\int_{allspace}\rho_f V d\tau = \frac12\int V(\nabla\cdot\mathbf{D})d\tau \\ &= \frac12\int\nabla\cdot(V\mathbf{D})d\tau - \frac12\int\mathbf{D}\cdot\nabla Vd\tau \\ &= \frac12\oint_S V\mathbf{D}\cdot d\mathbf{a} + \frac12\int\mathbf{D}\cdot\mathbf{E} d\tau \\ &= \frac12\int\mathbf{D}\cdot\mathbf{E} d\tau \end{align}

This leads to the definition of energy density

$u_e = \frac12\mathbf{D}\cdot\mathbf{E} = \frac12\epsilon\mathbf{E}^2 = \frac12\frac{\mathbf{D}^2}{\epsilon}$
$\mathbf{F} = -\nabla U = -\frac{\partial U}{\partial x}\hat{\mathbf{x}}$