Electromagnetism boundary condition 
The dielectric slab surrounded by air as shown in diagram has permittivity $\epsilon$ different from air and permeability almost same as air. Electric field everywhere within the slab is given to be $$E = ( 5 \hat{j} + 10 \hat{k} ) \times \cos(wt - bx).$$
I need to find electric and magnetic field just outside, on top of the slab.
I use boundary conditions and get that the magnetic field and $z$-component of electric field remain the same but y component of electric field is scaled due to relative permittivity. However the fields so obtained do not satisfy the Maxwell's equation of curl of $E$ equal to time derivative of $B$ because the $B$ is the same but $E$ has changed.
I'm not able to get the mistake in this. Is it right to apply boundary conditions the way I've done? OR is it that such a field can't exist at all?
 A: The boundary conditions, as noted in the comment below the original post, are:
\begin{align*}
E_{1z} &= E_{2z} & \epsilon_r E_{1y} &= E_{2y} \\
B_{1y} &= B_{2z} & B_{1z} &\approx B_{2z}
\end{align*}
(I'm using 1 to denote the dielectric and 2 to denote the air.  The "approximate equals" sign above is because we're assuming $\mu_1 \approx \mu_2$.)
These are pretty easy to solve for $\vec{E}_2$ and $\vec{B}_2$, as noted above;  the results are
$$
\vec{E}_2 = (5 \epsilon_r \hat{j} + 10 \hat{k}) \cos(\omega t - kx)
$$
$$
\vec{B}_2 = (10 \hat{j} - 5 \hat{k}) k \sin(\omega t - kx)
$$
These appear to violate Maxwell's equations, assuming that the fields do not depend on $y$ or $z$:
$$
\nabla \times \vec{E}_2 = - \frac{\partial E_{2z}}{\partial x} \hat{y} + \frac{\partial E_{2y}}{\partial x} \hat{z} = (10 \hat{j} - 5 \epsilon_r \hat{k} ) k \sin(\omega t - kx)
$$
$$
- \frac{\partial \vec{B}_2}{\partial t}= (10 \hat{j} - 5 \hat{k} ) \omega \sin(\omega t - kx)
$$
But what's important to note here is that these are only the field values at $y = 0$.  In fact, this is just telling us that $\partial E_x/\partial y \neq 0$ along the interface.  
(ETA:  what's below this point is probably not a good way to think about things.  See edit below.)
In fact, it might be possible to think of this situation as the limit of $\theta \to \pi/2$ of total internal reflection.  Suppose you had a wave traveling in the $xy$-plane towards the interface in the diagram above, with its polarization in the plane of reflection.  This would give rise to a reflected wave in the dielectric, and an evanescent wave in the air.  This evanescent wave would, in general, have non-zero $E_x$ and $E_y$, and since everything dies off exponentially in the $y$-direction, we would have $\partial E_x/\partial y \neq 0$.  I suspect (although I haven't proven it) that you can view your problem as the case of total internal reflection in the case of grazing incidence, and that the fact that $\partial E_x/\partial y \neq 0$ is just a manifestation of evanescent waves in the air in this limit.
What's less than satisfying about this explanation, of course, is that it demands that the electric field gains a component in the $x$-direction in the air even though it has no $x$-component in the dielectric.  I honestly don't know enough about evanescent waves to know whether this is a dealbreaker for this interpretation or not.
EDIT:  Having gone through the calculations, I'm not as sure about the evanescent-wave interpretation.  The basic idea I had was that you could write down the usual three-wave solution at an interface (incident, transmitted, and reflected), use the Fresnel equations to find the total $E_x$ above and below the interface, and then show that if you took the limit appropriately as the incidence angle $\theta \to \pi/2$, you could get a situation where $E_x \to 0$ in the dielectric but $E_x \nrightarrow 0$ in the air.  However, assuming I did the algebra correctly, the ratio of the $E_x$ values immediately above & below the interface will be
$$
\frac{\tilde{E}_{x,\text{dielec}}}{\tilde{E}_{x,\text{air}}} = \frac{i\sqrt{\epsilon \sin^2 \theta - 1} + \cos \theta}{\sqrt{\epsilon} \sqrt{\epsilon \sin^2 \theta - 1}},
$$
which approaches $i/\epsilon \neq 0$ as $\theta \to \pi/2$.  Thus, you can't view this situation as the grazing-incidence limit of total internal reflection.
I'm still moderately confident in my answer above (that $\partial E_x /\partial y \neq 0$ at the boundary, even though $E_x$ itself vanishes), but so far I can't address the unsatisfactory aspects of this answer that I noted above.
A: It seems to me that a plane wave description of the field in the dielectric medium can be valid only at distances(-y direction) large compared to the wavelength of the wave. Here I am assuming that the xz plane itself is the upper boundary of the dielectric. The modified variation of the field below the dielectric boundary must be used to evaluate the fields across it.
A: You can derive the boundary conditions from maxwell's equations in time independent form, along with snell's law and the continuity of photons.
You replace $\nabla$ with $\Delta$, the difference of forces.  $\Delta\times E=0$ has the effect that the horizontal component of E is 0, because there is no field vertical to E or H, and $\Delta\cdot B = 0$ means that the vertical component of B and D are unchanged.
The continuity of a photon means that $c D = H$ and $c B = E$, where c is the local speed of light (ie $c_0/n$), and $D/B = H/E = 1/Z_w = \sqrt{\epsilon/\mu}$.  Put together, you get
$c D = H = Zc B = Z E$ is the result of the fields in a photon, by Snell's law.
