Is there a reason why a EM wave reflects invertedly when it meets a boundary point with a greater index of refraction. In the case of ropes, if remember correctly, the reason why it inverts is to agree with Newtons third law. But, its unclear why for EM waves, upon reflection, a phase change of $\pi$ occurs.
1 Answer
The reason is not quite as intuitively put as for ropes, but it is essentially to make the fields consistent with the electromagnetic boundary conditions, which in turn can be traced to (1) Kirchoff's voltage law and (2) no conduction currents can flow in a dielectric.
Consider a tiny, thin rectangular loop running parallel to the interface with one half just inside one medium and the other half just inside the other. The total $\oint \vec{E}\cdot \,{\rm d} \vec{r}$ around the loop must be nought (Kirchoff's voltage law): in this case this can be seen by applying Faraday's law to the loop: because it is very thin, there is no magnetic flux through it. So:
The tangential components of the electric field vector must be continuous across a dielectric boundary
Reasoning likewise with Ampère's law we get (because there is no surface sheet current for a nonconducting dielectric, thus no flux of conduction or displacement current through a thin loop):
The tangential components of the magnetic field vector must be continuous across a dielectric boundary
Like conditions, which can be inferred from the two Gauss laws applied to a small cylindrical volume with its ends on either side of the interface, are that the normal components of the displacement $\vec{D}$ and induction $\vec{B}$ must also be continuous, but we don't need those for this simple example.
So consider a plane wave meeting the interface propagating normal to the interface. There are three plane waves: the incident, reflected and transmitted waves and the continuity conditions above ensure that the electric field of all these is in the same direction. Since plane waves have their magnetic fields orthogonal to the electric fields, the magnetic fields must all be the the same direction, orthogonal to the incident electric field. If $E_+$, $E_-$ and $E_t$ are the incident, reflected and throughgoing waves, then the first continuity condition is:
$$E_+ + E_- = E_t\qquad(1)$$
Now we do the same for the magnetic fields, but we take heed that the magnetic field $H_-$ will be in the opposite direction to the incident one, because the Poynting vector (direction of propagation) for the reflected wave is backwards, thus:
$$H_+ - H_i = H_t\qquad(2)$$
Now we put the relationships defining the mediums: $H_\pm = \sqrt{\frac{\epsilon_1}{\mu_1}} E_\pm = \frac{n_1}{c} H_pm$ and $H_t=\frac{n_2}{c} E_t$ and so:
$$\left(\begin{array}{cc}1&-1\\\frac{n_2}{c}&\frac{n_1}{c}\end{array}\right)\left(\begin{array}{c}E_t\\E_-\end{array}\right) = \left(\begin{array}{c}1\\\frac{n_1}{c}\end{array}\right) E_+$$
which, on inversion of the matrix, yields the reflexion and transmission co-efficients, in particular:
$$\frac{E_-}{E_+} = \frac{n_1-n_2}{n_1+n_2}$$
which is negative whenever $n_2 > n_1$ i.e. when the wave crosses into an optically denser medium.