# How can we use the electrostatic boundary conditions for electromagnetic waves?

The boundary conditions for an electromagnetic wave passing from one linear dielectric media to the other (both having no free charges or current) are taken as:

$$B_{\perp_1} -B_{\perp_2} =0$$

$${\varepsilon_1} \cdot E_{\perp_1} -{\varepsilon_2}\cdot E_{\perp_2} =0$$

$$\frac{B_{||_1}} {\mu_1}-\frac{B_{||_2}}{\mu_2} = 0$$

$$E_{||_1}-E_{||_2} = 0$$

But the last two equations were derived for the electrostatic case where $$\int{\vec E \cdot d\vec{l}} = -\frac{d\phi}{dt} = 0$$ and $$\int{\vec B \cdot d\vec{l}} = \mu_0 \varepsilon_0 \frac{d\phi_e}{dt} + \mu_0 i = 0$$.

But in the e.m. waves, $$\vec E$$ and $$\vec B$$ are changing. So why can we use these conditions?

The tangential field boundary conditions follow from the curl equations $$\vec \nabla\times\vec{E}=-\frac{\partial\vec{B}}{\partial t}$$ $$\vec \nabla\times\vec{H}=\vec{J}+\frac{\partial\vec{D}}{\partial t}.$$ The boundary conditions as you have written them assume linear media and no surface current at the interface.
These boundary conditions are typically derived by applying (the integral forms of) the curl equations to a small rectangle, with two sides on either side of the interface and parallel to it (see here). The crucial assumption is that the quantities on the right-hand sides of the curl equations (with the exception of $$\vec{J}$$) are not localized to the interface. We assume that the rectangle can be made so small that the fields on the rectangle are almost position-independent on both sides of the interface. As the sides of the rectangle parallel to the interface are brought closer, the fluxes of the quantities that appear on the right hand side (with the possible exception of $$\vec{J}$$) go to zero, along with the rectangle area.
Notice that the reason the surface current density remains in the general $$\vec{H}_\parallel$$ boundary condition is that the area integral of the current density doesn't go to zero as you bring together the sides of the rectangle parallel to the interface, if there is current flow localized to the interface. You don't normally see this with $$\vec{B}$$ and $$\vec{D}$$.
Here is an example where you might need to include the fields in the boundary condition. Suppose you have a very thin magnetic sheet separating media 1 and 2. Let's say a strong time-varying tangential magnetic field exists in this sheet, and you want to abstract the sheet away into a boundary condition rather than solving for the fields inside it. Then the boundary condition for $$\vec{E}$$ would be
$$\hat{n} \times (\vec{E}_2 - \vec{E}_1) = -\frac{\partial \vec{\phi}_s}{\partial t}$$ where $$\hat{n}$$ is the unit normal vector pointing toward medium 2 and $$\vec{\phi}_s$$ is the surface magnetic flux per unit length within the sheet, analogous to surface current density.