Whats the meaning of this equation relating electric field and potential energy? My electrodynamics teacher was explaining that it is required to apply some energy (or do some work) on charges in order to arrange them in space. When he stated an example about energy in a capacitor the result was
$$U = \frac{1}{2}\frac{Q^2}{\epsilon_0 A / d}$$
Where


*

*$Q$ is Capacitor charge

*$A$ is area of capacitor

*$d$ is distance between plates

*$\epsilon_0$ is the permittivity of space
He later stated that it was equivalent to write it like this:
$$U = \frac{\epsilon_{0}}{2}E^2(Ad)$$
Where $E$ is the electric field inside the capacitor.
Then, as an analogy, he told us that for any other charge set, we could find something similar, and told us that it could be calculated as
$$U = \frac{\epsilon_{0}}{2} \int_v E^2 \, dV$$


*

*How do I get to the second equation?

*What does the integral in the third equation mean? How do I interpret it physically?
 A: You have  
$${U = \frac{1}{2}\frac{Q^2}{\frac{\epsilon_{0}A}{d}}}$$ 
$${\frac{\epsilon_{0}A}{d}}=C\equiv\textrm{ the capacitance of the capacitor.}$$  
Hence  
$${U=\frac{1}{2}\frac{Q^2}{C}}$$
Now $\displaystyle{Q=CV}$,  where  V is the p.d. between the capacitor plates.  
So,  $${U=\frac{1}{2}CV^2}$$
or  $${U=\frac{1}{2}\frac{\epsilon_{0}A}{d}V^2}$$  
Now the V (scalar potential) and the electric field are related as:  
$\mathbf E= -\mathbf\nabla V$,  which is valid for static electric fields as in the case of electric field between capacitor plates 
where $\displaystyle{\mathbf \nabla V=\frac{\partial V}{\partial x}\hat{\textbf{x}}+\frac{\partial V}{\partial y}\hat{\textbf{y}}+\frac{\partial V}{∂z}\hat{\textbf{z}}}$  
called the gradient of $V$ which gives you the maximum rate of change of V in all the three dimensions.   
$\therefore$  $\displaystyle{V=-\int {\textbf{E}}.d{\textbf{r}}}$  
Substituting this value of V in the equation for $U$, we get  
$$\displaystyle{U=\frac{1}{2}\frac{\epsilon_0A}{d}\int (\textbf{E}.d{\textbf{r}})^2}$$  
or  
$$\color{red}{\displaystyle{ U=\frac{\epsilon_0}{2}\int_\textrm{all space} E^2d\tau}}$$  
where $d\tau$ is the elemental volume  
This is the electrical energy stored in the electric field of a charge configuration. This equation is valid for any charge configuration. This equation tells you that the electric energy is stored in the electric field when integrated over all space. The all space has certain importance because the electric field drops of as square of distance and hence it will be zero only if the distance from the charge is infinity. So, to get the entire energy of a charge configuration, you need to integrate the square of electric field taken over a small volume over the entire space. This means that the electric field itself exists as a manifestation of electric field which is the property of an electric charge. Greater the magnitude of the charge, greater will be the electric field and the energy stored in the field. The energy stored in the field drops off as you move farther away from the charge. Since the electric field drops off by square of distance from the charge, the energy drops off by the fourth power of distance from the charge. So this means the electric energy is well confined near the charge while the electric field could spread out to some distance. That region of space is called the sphere of influence of the charge.  
Now, in the case of the parallel plate capacitor, the electric field exists only in between the plates and so the energy stored by a capacitor appears in between the plates. But if you treat the plates individually, the electric energy is present around the plate, but when you reconfigure it by placing another plate at some finite distance to it in a parallel plate capacitor arrangement, the electric field modifies and there is no single field of the plates, but only the superposition of field due to the combination of the plates. In such a configuration, no field exist outside the plates. So the entire energy of the modified field appears in between the plates.  However, don't confuse this energy as the potential difference between the plates as you can easily verify from the equation. The energy in between the plates is the work done to assemble the charged plates configuration. But potential difference is the work done in order to move a unit positive charge from one plate to the other. The energy required for that also comes from the energy stored in the field between the plates. Remember that the energy stored in the field contains an $E^2$ term, while the potential difference contain only $E$ term.
A: For a discrete system of $N$ charges, the potential energy associated with their configuration is given by 
\begin{align}U&= \frac12\,\sum_{j=1}^N \, q_j\sum_{k\ne j}\,\frac1{4\pi\epsilon_0}\,\cdot \frac{q_k}{r_{jk}}\\ &= \frac12\,\sum_{j=1}^N \, q_j\,\varphi(\mathbf r_j)\tag 1 \end{align}
where $\varphi$ is the scalar potential due to all charges other than $q_j\,.$
Potential energy stored in the system of continuous charge can be inferred from $(1)$ viz:
$$U= \frac12\int \rho(\mathbf r)\,\varphi(\mathbf r)\,\mathrm d^3\mathbf r \tag 2$$
Now, using $\mathbf\nabla\cdot \mathbf E= \dfrac \rho{\epsilon_0}$ in $(2)$ we get,
$$U=  \frac{\epsilon_0}2\int \mathbf \nabla\cdot \mathbf E(\mathbf r)\,\varphi(\mathbf r)\,\mathrm d^3\mathbf r\tag 3$$
Now using the identity $ \mathbf \nabla \cdot \left( \varphi\,\mathbf A \right) = \varphi \left( \mathbf {\nabla }\cdot \mathbf A\right) +\mathbf A \cdot \mathbf {\nabla }\varphi\,^{\dagger}$ in $(3)\,,$ we get 
$$U= \frac{\epsilon_0}2\left[\int\, \mathbf \nabla \cdot \left( \varphi\,\mathbf E \right)\,\mathrm d^3\mathbf r- \int\, \mathbf E \cdot \mathbf {\nabla }\varphi\,\mathrm d^3\mathbf r\right]\tag 4$$
Using divergence theorem; we can rewrite $(4)$ as:
$$U= \frac{\epsilon_0}2\left[\int \varphi\,\mathbf E \,\mathrm d^2\mathbf r- \int\,\mathbf E \cdot \mathbf {\nabla }\varphi \,\mathrm d^3\mathbf r\right]\tag5$$
Now, using $\varphi(\mathbf r\to \infty)= 0\,$ and $\mathbf E= -\mathbf \nabla \varphi$ in $(5)\,,$ we get:
$$U= -\frac{\epsilon_0}2 \int\,\mathbf E\cdot (-\mathbf E)\,\mathrm d^3\mathbf r\tag 6$$
And, from $(6)\,$ it is concluded that 
$$U= \frac{\epsilon_0}2 \int\,\mathbf E\cdot \mathbf E\,\mathrm d^3\mathbf r\;.$$

How do I interpret it physically?

This is the energy required to assemble the system of charges in that specific configuration.

$^\dagger$  Check this post for its derivation.
