In a plane electromagnetic wave propagating in vacuum or a non-dispersive medium, the energy is equally shared between the electric field and the magnetic field.
The instantaneous energy density of the electric field ($u_E$) is given by $u_E = \frac{1}{2}\epsilon_0 E^2$, where $E$ is the instantaneous electric field strength and $\epsilon_0$ is the permittivity of free space.
The instantaneous energy density of the magnetic field ($u_B$) is given by $u_B = \frac{1}{2\mu_0}B^2$, where $B$ is the instantaneous magnetic field strength and $\mu_0$ is the permeability of free space.
For an electromagnetic wave, the magnitudes of the electric and magnetic fields are related by $E = cB$, where $c$ is the speed of light in vacuum. Also, $c = \frac{1}{\sqrt{\epsilon_0 \mu_0}}$.
Substitute $E=cB$ into the expression for $u_E$:
$u_E = \frac{1}{2}\epsilon_0 (cB)^2 = \frac{1}{2}\epsilon_0 c^2 B^2$.
Since $c^2 = \frac{1}{\epsilon_0 \mu_0}$,
$u_E = \frac{1}{2}\epsilon_0 \left(\frac{1}{\epsilon_0 \mu_0}\right) B^2 = \frac{1}{2\mu_0}B^2$.
This is exactly the expression for $u_B$.
So, $u_E = u_B$ for the instantaneous energy densities.
If $U_E$ and $U_B$ are the average energy densities, they are obtained by averaging the instantaneous values over one period or a long time. Since $u_E(t) = u_B(t)$ at every instant, their averages must also be equal.
$U_E = \langle u_E \rangle = \langle \frac{1}{2}\epsilon_0 E^2 \rangle$.
$U_B = \langle u_B \rangle = \langle \frac{1}{2\mu_0}B^2 \rangle$.
Since $u_E = u_B$ at all times, it follows that $U_E = U_B$.
\[ \boxed{U_E = U_B} \]